Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Listening for device updates

Todo: Example payloads

Sending commands

Todo: Example payloadsAs mentioned earlier, each entity will provide their state_topic in the config payload. This means that in order to get the updates for the devices/entities you want, you need to listen to the topics provided.

When an update to a device occur, Glamox Connect will then send the delta on the given state topic. This means that you will NOT get the full state of the entity, only the change.

Example:
Given a state for a light as following

Code Block
{
  "brightness": 100,
  "color_temp": 200,
  "color_temp_kelvin": 5000,
  "state": ON
}

If we change the brightness of the light in the example to 80%, the state update sent on the state_topic will be as following

Code Block
{
  "brightness": 80
}

Similar for sensors, typical status updates will look like this

Code Block
{
  "lux": 670
}
Code Block
{
  "temperature": 25.1
}
Code Block
{
  "occupancy": ON
}

Sending commands

If you want to send commands to a device, you will need to send it to the entity on the command_topic provided in the config payload.

Lets look at the previously given config payload for a light. In the config payload we have the following line

command_topic: connect/light/001fee00000053a6/17880107102b0c/set

To change a value for this entity we need to send a valid json payload to the given topic

Turning the light off:

Code Block
{
  "state": OFF
}

Changing brightness:

Code Block
{
  "brightness": 80
}