Commands
Telemetry also works only with the following type of devices:
- Enapter Electrolyser
- Enapter Dryer
- Enapter AI-4
- Enapter RL-6
To send command to the device, you should publish message to topic commands/v1/<UCM_ID>/requests
. To see execution result you should be subscribed to another topic. commands/v1/<UCM_ID>/responses
. Every execution have a unique id to identify request-response pair.
For example, we want to enable a load on channel r5
. We can do it via Cloud UI, but now we try to do it via MQTT API.
At first, subscribe to command responses:
mosquitto_sub -v -p 9883 -h <GATEWAY_IP_ADDRESS> -u public -P public -t "commands/v1/<UCM_ID>/responses"
In another terminal send command:
mosquitto_pub -p 9883 -h <GATEWAY_IP_ADDRESS> -u public -P public -t "commands/v1/<UCM_ID>/requests" -m '{"id":"<EXECUTION_ID>", "name":"enable_load", "arguments": {"load":"r5"}}'
In the terminal with responses subscription, you should see, that command executed successfully:
commands/v1/<UCM_ID>/responses {"id":"<EXECUTION_ID>","state":"completed","payload":{"message":null}}
Also you can check telemetry on Dashboard or via MQTT API to see, that r5
changed from false
to true
.