You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The application configuration file must be in the following format:
82
-
```
83
-
[application]
84
-
org=$orgId
85
-
id=$myApplication
86
-
auth-method=apikey
87
-
auth-key=$key
88
-
auth-token=$token
89
-
```
90
-
91
-
####Subscribing to Device events
92
-
By default, this will subscribe to all events from all connected devices. Use the type, id and event parameters to control the scope of the subscription. A single client can support multiple subscriptions.
93
-
94
-
#####Subscribe to all events from all devices
95
-
```python
96
-
client.connect()
97
-
client.subscribeToDeviceEvents()
98
-
```
99
-
100
-
#####Subscribe to all events from all devices of a specific type
To process the events received by your subscroptions you need to register an event callback method. The messages are returned as an instance of the Event class:
121
-
* event.device - string (uniquely identifies the device across all types of devices in the organization $deviceType:$deviceId)
122
-
* event.deviceType - string
123
-
* event.deviceId - string
124
-
* event.event - string
125
-
* event.format - string
126
-
* event.data - dict
127
-
* event.timestamp - datetime
128
-
129
-
```python
130
-
defmyEventCallback(event):
131
-
print"%s event '%s' received from device [%s]: %s"% (event.format, event.event, event.device, json.dumps(event.data))
132
-
133
-
...
134
-
client.connect()
135
-
client.eventCallback = myEventCallback
136
-
client.subscribeToDeviceEvents()
137
-
```
138
-
139
-
140
-
####Subscribing to Device status
141
-
By default, this will subscribe to status updates for all connected devices. Use the type and id parameters to control the scope of the subscription. A single client can support multiple subscriptions.
142
-
143
-
#####Subscribe to status updates for all devices
144
-
```python
145
-
client.connect()
146
-
client.subscribeToDeviceStatus()
147
-
```
148
-
149
-
#####Subscribe to status updates for all devices of a specific type
To process the status updates received by your subscriptions you need to register an event callback method. The messages are returned as an instance of the Status class:
164
-
165
-
The following properties are set for both "Connect" and "Disconnect" status events:
166
-
* status.clientAddr - string
167
-
* status.protocol - string
168
-
* status.clientId - string
169
-
* status.user - string
170
-
* status.time - datetime
171
-
* status.action - string
172
-
* status.connectTime - datetime
173
-
* status.port - int
174
-
175
-
The following properties are only set when the action is "Disconnect":
0 commit comments