小米门窗传感器接入Home Assistant 无需小米网关 (CC2531方案)
首先你得装好Zigbee2mqtt这个软件,并且cc2531参考前面的教程正常识别并且启动。
自制ZigBee网关教程参考下面链接:
树莓派刷cc2531固件传送门:https://sumju.net/?p=1862 NodeMCU刷cc2531固件传送门:https://sumju.net/?p=1818
Home Assistant 配置方法如下:
增加一个MQTT二进制传感器,类型为门。
binary_sensor:
- platform: mqtt
name: 大门
state_topic: "zigbee2mqtt/0x00158d000460188a" #替换你自己设备ID,并删掉这句注释。
value_template: "{{ value_json.contact }}"
payload_on: false
payload_off: true
availability_topic: "zigbee2mqtt/bridge/state"
payload_available: "online"
payload_not_available: "offline"
qos: 0
device_class: door
增加两个MQTT普通传感器,类型分别位电量和信号强度。
sensor:
- platform: mqtt
name: 门磁电量
state_topic: "zigbee2mqtt/0x00158d000460188a" #替换你自己设备ID,并删掉这句注释。
value_template: "{{ value_json.battery }}"
unit_of_measurement: "%"
availability_topic: "zigbee2mqtt/bridge/state"
payload_available: "online"
payload_not_available: "offline"
qos: 0
device_class: battery
- platform: mqtt
name: 门磁信号强度
state_topic: "zigbee2mqtt/0x00158d000460188a" #替换你自己设备ID,并删掉这句注释。
value_template: "{{ value_json.linkquality }}"
availability_topic: "zigbee2mqtt/bridge/state"
payload_available: "online"
payload_not_available: "offline"
qos: 0
device_class: signal_strength