Reading state
Stored state
Section titled “Stored state”Thing Edges keeps the last state each device reported. Reading it does not wake the device.
| Route | Gives |
|---|---|
GET /iot-core/state/devId/<deviceId> |
One device |
GET /iot-core/state/<locationId> |
Every device of a home |
GET /iot-core/state/<locationId>/<mac> |
One device of a home, by its MAC |
The state field has the same shape as in state messages:
{ "<element>": { "<attribute>": [attribute, values…] } }.
Online status
Section titled “Online status”GET /iot-core/thing-status/<userId> lists whether each of the user’s devices is online, and since when.
Fresh state
Section titled “Fresh state”To ask the device itself, see Asking the device.
Better than polling
Section titled “Better than polling”To keep your own copy of every device’s state, use Data Streaming instead of reading state in a loop: changes arrive as they happen, and they do not count towards IoT Core usage.