This article will cover an overview of the data both sent and recieved between a zencontrol application controller and an MQTT broker.
For the purposes of this article, the following phrases will mean as such:
- sent: data heading from an MQTT broker to a zencontrol application controller (control)
- recieve: data heading from a zencontrol application to the MQTT broker (status)
This article makes the assumption that the reader has an understanding of MQTT and its included terminology
When a zencontrol application controller connects to an MQTT broker, the broker will recieve the following topic structure:
zencontrol/{schema_version}/{GTIN_in_hex}_{serial_number}
Example: zencontrol/v1/065716265624_00000000000FE23A
Details on the GTIN and serial numbers of the application controllers can be found within Grid View under Control System -> Network.
Note: GTIN within the topic name is represented in hexadecimal format. 6971103532580 decimal = 065716265624 hex.
Any traffic that happens on the DALI line is reported under its connected application controller and broken into the following categories:
- Controller - details information about the controller directly. Example: Profile status
Topic structure: {base_topic}/{message_type}
Example structure: zencontrol/v1/065716265624_00000000000FE23A/profile
- ECD - details information about the status of ECDs connected to the application controller. Example: Lux level
Topic structure: {base_topic}/ecd/{GTIN_in_hex}_{serial_number}_00/{message_type}/{endpoint}
Example structure: zencontrol/v1/065716265624_00000000000FE23A/ecd/087DD0834933_00000000000CFAD0_00/lux/value
- ECG - details information about the status of ECGs connected to the application controller. Example: Arc level.
Topic structure: {base_topic}/ecg/{GTIN_in_hex}_{serial_number}_00/{message_type}/{endpoint}
Example structure: zencontrol/v1/065716265624_00000000000FE23A/ecg/087DD08326D1_00000000000F44BA_00/level/value
- Group - details information about the status of the DALI groups used on the application controller: Example Arc level.
Topic structure: {base_topic}/group/{group_number}/{message_type}/{endpoint}
Example structure: zencontrol/v1/065716265624_00000000000FE23A/group/1/level/value
Additional topics such as Emergency are available, but are not covered in this article.
To send a message to an application controller via MQTT, a single endpoint topic is made available:
Topic structure: {base_topic}/messages/devicebound
Example structure: zencontrol/v1/065716265624_00000000000FE23A/messages/devicebound
This topic requires a JSON message to be written to it, which in turn instructs the application controller to execute the command. Required as apart of this message is 3 components:
- id - refers to the DALI address (group or short address)
- rid - request ID, is a random value used to identify the message sent
- target - determines the type of message to be sent (control of short address, group address etc)
target has the following action when set to the corresponding value:
- 0 - Control Module
- 1 - Emergency
- 2 - ECG
- 3 - ECG Group
- 4 - ECD
- 5 - ECD Group
- 6 - Beacon
For control of a short address or a DALI group address, value 2 (ECG) or 3 (ECG Group) will be used.
In the following example, short address 4 will be set to level 127 over 5 seconds:
{
"id": 4,
"rid": 1,
"target": 2,
"level": {
"arc": 127,
"fade_time": 5000
}
}
In the next example, DALI group address 14 will be set to level 254 using the existing configured fade time:
{
"id": 14,
"rid": 1,
"target": 3,
"level": {
"arc": 254
}
}