hass 自动发现mqtt设备 原理
https://www.home-assistant.io/docs/mqtt/discovery/
HomeAssistant中MQTT设备的自动发现逻辑
http://iotts.com.cn/course/homeassistant/%E8%87%AA%E5%8A%A8%E5%8F%91%E7%8E%B0Mqtt%E8%AE%BE%E5%A4%87/
需要被发现设备严格按照要求发出mqtt消息才能被发现,详细可参考官方文档:
1.The discovery of MQTT devices will enable one to use MQTT devices with only minimal configuration effort on the side of Home Assistant. The configuration is done on the device itself and the topic used by the device.
https://www.home-assistant.io/docs/mqtt/discovery/
2.设备将自己的配置信息发布在主题位置:
配置信息采用JSON格式。
https://bbs.hassbian.com/thread-4707-1-1.html
https://www.home-assistant.io/docs/mqtt/discovery/
HomeAssistant中MQTT设备的自动发现逻辑
http://iotts.com.cn/course/homeassistant/%E8%87%AA%E5%8A%A8%E5%8F%91%E7%8E%B0Mqtt%E8%AE%BE%E5%A4%87/
HomeAssistant中MQTT设备的自动发现逻辑是:
MQTT设备将自身的配置信息发布在事前定义的主题位置上
HomeAssistant从这个主题位置读取信息,生成对应的系统内实体设备
需要被发现设备严格按照要求发出mqtt消息才能被发现,详细可参考官方文档:
1.The discovery of MQTT devices will enable one to use MQTT devices with only minimal configuration effort on the side of Home Assistant. The configuration is done on the device itself and the topic used by the device.
https://www.home-assistant.io/docs/mqtt/discovery/
2.设备将自己的配置信息发布在主题位置:
<discovery_prefix>/<component>/[<node_id>/]<object_id>/config
<discovery_prefix>:配置文件中的discovery_prefix,缺省为homeassistant
<component>:设备所在的域,例如light、switch、binary_sensor等
<node_id>:可选,节点ID
<object_id>:设备ID
配置信息采用JSON格式。
https://bbs.hassbian.com/thread-4707-1-1.html
0