MQTT KNX Bridge

Материал из Wiren Board
Это утверждённая версия страницы. Она же — наиболее свежая версия.
Другие языки:


Devices using the KNX Protocol.

Package: wb-mqtt-knx Source code:https://github.com/contactless/wb-mqtt-knx

wb-mqtt-knx sends KNX telegrams from the specialized MQTT topic to the KNX network and back. To work with KNX, KNXD is used- https://github.com/knxd/knxd

Installation

wb-mqtt-knx in Wiren Board controllers is installed via apt-get:

$ apt-get install wb-mqtt-knx

Setting

At the moment, wb-mqtt-knx does not have a configuration file.

Information on setting up knxd can be found in the configuration file /etc/knxd.conf - https://github.com/knxd/knxd/blob/master/systemd/knxd.conf and in

$ knxd --help

Адреса в MQTT

Default MQTT topics are:

/devices/knx/meta/name wb-knx
/devices/knx/controls/data/meta/type data

Input data:

/devices/knx/controls/data

Outgoing data:

/devices/knx/controls/data/on

Example:

$ mosquitto_sub -t '/devices/knx/#' -v
/devices/knx/controls/data/meta/type data
/devices/knx/meta/name wb-knx

$ mosquitto_pub -t '/devices/knx/controls/data/on' -m "i:0/0/1:9/7/55 GroupValueWrite 0b110111 0xcf 14 0xff"

/devices/knx/controls/data/on i:0/0/1:9/7/55 GroupValueWrite 0b110111 0xcf 14 0xff
/devices/knx/controls/data i:0/0/1 i:9/7/55 GroupValueWrite 0x37 0xcf 0x0e 0xff

$ mosquitto_pub -t '/devices/knx/controls/data/on' -m "g:9/7/55 GroupValueRead"

/devices/knx/controls/data/on g:9/7/55 GroupValueRead
/devices/knx/controls/data i:0/0/0 g:9/7/55 GroupValueRead 0x00

Format MQTT messages

To send a group telegram to KNX, you must send the prepared message to the MQTT topic:

mosquitto_pub -t '/devices/knx/controls/data/on' -m "g:${DstAddr} ${APCI} ${Data}"

To send an individual telegram to KNX, you must send:

mosquitto_pub -t '/devices/knx/controls/data/on' -m "i:${SrcAddr}:${DstAddr} ${APCI} ${Data}"

All messages from the KNX bus will be delivered to the MQTT topic /devices/knx/controls/data in the form:

i:${SrcAddr} [i,g]:${DstAddr} ${APCI} ${Data}
  • SrcAddr, DstAddr - Addresses of KNX devices in the format "n/n/n" or "n/n".
  • APCI - message Type: string or 4-bit number.
  • Data - a Message in the form of bytes separated by spaces. The first byte of the message must be no longer than 6 bits.

Supported message types(APCI):

  • GroupValueRead
  • GroupValueResponse
  • GroupValueWrite
  • IndividualAddrWrite
  • IndividualAddrRequest
  • IndividualAddrResponse
  • AdcRead
  • AdcResponse
  • MemoryRead
  • MemoryRead
  • MemoryWrite
  • UserMessage
  • MaskVersionRead
  • MaskVersionResponse
  • Restart
  • Escape
  • Any 4-bit numeric value