I needed to read and record 4 temperature sensors on my central heating system and I wanted to use Zigbee as a reliable protocol. Here is how I did it, no rocket science but a lot of interesting details.
Hardware: DS18B20 sensors & CC2530 Zigbee module
Schematic:
Real life:
Software:
The CC2530 module is flashed with the great PTVO configurable firmware (https://ptvo.info/zigbee-switch-configurable-firmware-v2-210/). Flashing is done with the CC debugger and the free software from TI (https://www.ti.com/tool/FLASH-PROGRAMMER) not V2.
Obtain the DS18b20 device ID:
There are many ways, but I have chosen to do it with PTVO.
Flash the CC2530 with the following configuration (no Device ID):
Connect the CC2530 to the 4 sensors and power up. In HA switch on âallow devices to joinâ for zigbee2mqtt.
The new device will appear in HA. Now install the MQTT explorer (http://mqtt-explorer.com/) and connect to HA and look for the newly added device.
In the History box of the device you will see that at the l1 position 4 different IDâs appear over time. Note them down.
Flash CC2530 again:
Now amend the PTVO configuration with the obtained Device IDâs:
and load the new firmware to the CC2530. You can check the configuration file, PTVO creates a HEX file and a text file (handy to correct typing and copy paste errors).
Power up the CC2530 with the 4 sensors and the unit will submit data to l1, l2, l3 and l4.
Get the temperature sensors in HA:
We are going to create 4 MQTT sensors:
#########################################################
# #
# ZONNEBOILER TEMP PVTO #
# #
#########################################################
- platform: mqtt
name: "T1"
state_topic: "zigbee2mqtt/0x00124b000bc244a9"
unit_of_measurement: "°C"
value_template: "{{ value_json.l1 | round(1) }}"
availability_topic: "zigbee2mqtt/bridge/state"
payload_available: "online"
payload_not_available: "offline"
json_attributes_topic: "zigbee2mqtt/0x00124b000bc244a9/attributes"
icon: mdi:coolant-temperature
- platform: mqtt
name: "T2"
state_topic: "zigbee2mqtt/0x00124b000bc244a9"
unit_of_measurement: "°C"
value_template: "{{ value_json.l2 | round(1) }}"
availability_topic: "zigbee2mqtt/bridge/state"
payload_available: "online"
payload_not_available: "offline"
json_attributes_topic: "zigbee2mqtt/0x00124b000bc244a9/attributes"
icon: mdi:coolant-temperature
- platform: mqtt
name: "T3"
state_topic: "zigbee2mqtt/0x00124b000bc244a9"
unit_of_measurement: "°C"
value_template: "{{ value_json.l3 | round(1) }}"
availability_topic: "zigbee2mqtt/bridge/state"
payload_available: "online"
payload_not_available: "offline"
json_attributes_topic: "zigbee2mqtt/0x00124b000bc244a9/attributes"
icon: mdi:coolant-temperature
- platform: mqtt
name: "T4"
state_topic: "zigbee2mqtt/0x00124b000bc244a9"
unit_of_measurement: "°C"
value_template: "{{ value_json.l4 | round(1) }}"
availability_topic: "zigbee2mqtt/bridge/state"
payload_available: "online"
payload_not_available: "offline"
json_attributes_topic: "zigbee2mqtt/0x00124b000bc244a9/attributes"
icon: mdi:coolant-temperature
#########################################################
# #
# END OF CONFIGURATION FILE #
# #
#########################################################
Done