Sending Commands to devices

You can use OmniCore to send commands to devices. Commands are transitory, one-time directives sent to devices that are connected to OmniCore and subscribed to the commands topic.

Compared to device configurations, commands are faster, can be sent more frequently, and are independent of other OmniCore features. When choosing between commands and configurations, consider whether you need persistence/knowledge over time (configurations) or prefer speed and/or time-bound directives (commands).

Commands can be useful when you want to:

  • Send messages quickly to many devices at a specific time

  • Send large-volume messages to many devices at a specific time

  • Send time-bound directives that should expire

  • Send incremental device settings

Commands have the following characteristics:

  • Directly sent to subscribed, connected devices

  • Not persisted in OmniCore

  • Dropped for devices that are not subscribed and connected at the time the command is sent

  • Not unique (duplicates may be sent, though this is unlikely)

  • Not sent in any particular order (but delivered roughly in the send order)

  • In any format (blob of data)

Currently, OmniCore supports commands over MQTT only (not HTTP).

The below diagram depics sending a direct command to a device,

A key capability is the ability to broadcast messages to multiple devices simultaneously. The above method of sending commands to multiple devices involves iterating through each device and sending the command one at a time. This can be a time-consuming process and can be error prone. With OmniCore's broadcast feature, you can send messages to all the devices in a registry with just one command, saving you time and effort. To use this feature, you simply need to send the command to the appropriate MQTT topic. The topic follows the format: /myhome//broadcast, where myhome ' is the name of the device registry that hosts the devices, you want to broadcast the command to. For example, if you want to broadcast command to all devices in registry ' my_home ', the topic to send your command would be /my_home //broadcast. This feature is particularly useful in scenarios where you need to update multiple devices at once, such as turning off all the lights in a room or setting the temperature in multiple rooms. Instead of sending the same command to each device individually, you can simply broadcast the command to the registry, and all the devices in that registry will receive the message and execute the command simultaneously.

Last updated