Skip to content

Sensor State

A Binary or State sensor has a current value: a switch is on or off, a thermostat is heating or idle. That value can change in two ways, and the platform keeps track of both:

  • The device reports it, because something changed on the device itself, such as someone flipping a physical switch. That’s what this guide covers.
  • You or an automation send a command, and the device confirms it. See Sending Commands.
Data direction Can report state Can receive commands
Send Yes No
Receive No Yes
Exchange Yes Yes

Use Exchange for something that can change both ways, such as a smart relay with a button on it. Telemetry sensors send readings instead.

With the Node.js SDK:

device.turnOn('relay') // a Binary sensor
device.turnOff('relay')
device.reportState('mode', 'heat') // a State sensor

With the Embedded C SDK:

device.reportState("relay", "1");
device.reportState("mode", "heat");

After a command, there’s no need to report the new value as well: acknowledging the command confirms it.

  • Node.js SDK: the call returns false and the report is dropped. Report the current state again once the device reconnects.
  • Embedded C SDK: only the latest value per sensor is kept, and it’s delivered on reconnect. Flip a switch five times while offline, and the console gets the final position.

A sensor’s page shows its current value and how it got there:

  • Last reported — on a Send sensor, when the device last reported a value. The page notes that the sensor can’t receive commands.
  • Last confirmed — on a Receive or Exchange sensor, when the value was last confirmed.

The page’s history table lists every change: the value, who or what made it (Device, a team member’s name, or an automation’s name), and when. The page updates on its own while you have it open.

A state change can start an automation, through a Sensor Event trigger on that sensor, and conditions can compare against a sensor’s current value. See Automations.