FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
webthing-python/webthing/event.py at master · WebThingsIO/webthing-python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
WebThingsIO
/
webthing-python
Public
Notifications
You must be signed in to change notification settings
Fork
36
Star
175
Code
Issues
2
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
webthing-python
/
webthing
/
event.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (40 loc) · 1.22 KB
Breadcrumbs
webthing-python
/
webthing
/
event.py
Copy path
File metadata and controls
53 lines (40 loc) · 1.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""High-level Event base class implementation."""
from
.
utils
import
timestamp
class
Event
:
"""An Event represents an individual event from a thing."""
def
__init__
(
self
,
thing
,
name
,
data
=
None
):
"""
Initialize the object.
thing -- Thing this event belongs to
name -- name of the event
data -- data associated with the event
"""
self
.
thing
=
thing
self
.
name
=
name
self
.
data
=
data
self
.
time
=
timestamp
()
def
as_event_description
(
self
):
"""
Get the event description.
Returns a dictionary describing the event.
"""
description
=
{
self
.
name
: {
'timestamp'
:
self
.
time
,
},
}
if
self
.
data
is
not
None
:
description
[
self
.
name
][
'data'
]
=
self
.
data
return
description
def
get_thing
(
self
):
"""Get the thing associated with this event."""
return
self
.
thing
def
get_name
(
self
):
"""Get the event's name."""
return
self
.
name
def
get_data
(
self
):
"""Get the event's data."""
return
self
.
data
def
get_time
(
self
):
"""Get the event's timestamp."""
return
self
.
time
Back
|
FazBrowse Home
|
New Git URL