mqtt:sensor: - name: "温度" state_topic: "homeassistant/sensor/esp8266/state" device_class: "temperature" unit_of_measurement: "°C" value_template: "{{ value_json.temperature}}" unique_id: "temp01ae" device: name: "ESP8266" suggested_area: "客厅" manufacturer: "PY学习笔记" model: ...
homeassistant/binary_sensor/garden/config 复制代码 Json: { "name":null, "device_class":"motion", "state_topic":"homeassistant/binary_sensor/garden/state", "unique_id":"motion01ad", "device":{ "identifiers":[ "01ad" , "name":"Garden" 使用MQTTx 客户端测试一下: 可以看到,确实按照上面...
sensor: - platform: mqtt name: "Living Room Temperature" state_topic: "home/temperature" value_template: "{{ value_json.temperature }}" device_class: temperature unit_of_measurement: "°C" 4. 配置传感器实体的MQTT主题 确保你在MQTT服务器上发布的消息主题与你在Home Assistant中配置的state_topic...
HomeAssistant配置项中payload_XXXX代表对信息内容的配置。 # 这是一个MQTT设备,名字是"MQTT Sensor 1",在MQTT中发布信息的位置在"home/bedroom/temperature" # 此配置添加系统内实体sensor.mqtt_sensor_1 light: #设备类型 MQTT - platform: mqtt # 设备名字 name: "LED light over MQTT" # HASS标准格式 状态...
client.publish('homeassistant/sensor/office_pc/state', '{ "temperature": 33.30, "humidity": 22.40 }') 数据就显示到了homeassistant 第二个例子代码: #diy-sensorimportpaho.mqtt.clientasmqttimporttimeimportrandom#随机库#HOST = "test.mosquitto.org"HOST="127.0.0.1"PORT=1883defon_message_callback(cl...
HomeAssistant 平台才能识别到,并显示在MQTT集成里面。如下图所示: HomeAssistant 官方也给出了关于实体登录的文档:https://www.home-assistant.io/integrations/mqtt 对接例子如下: 上面的意思是:连接服务器之后,给某个Topic 发送固定的示例上的json 数据。Topic: homeassistant/binary_sensor/garden/config Json: {...
HomeAssistant 官方也给出了关于实体登录的文档:https://www.home-assistant.io/integrations/mqtt 对接例子如下: 上面的意思是:连接服务器之后,给某个Topic 发送固定的示例上的json 数据。 Topic: homeassistant/binary_sensor/garden/config Json: { "name":null, ...
安装home assistant参考文章 增加MQTT支持方法一: 添加MQTT集成 依次点击:配置——>集成——>点击右下角加号——>搜索MQTT 增加MQTT支持方法二:修改配置 修改home assistant的configuration.yaml则更加MQTT定义 vim ~/.homeassistant/configuration.yaml 增加内容如下: ...
<component>:设备所在的域,例如light、switch、binary_sensor等 <node_id>:可选,节点ID :设备ID 配置信息采用JSON格式。 例如,MQTT设备在主题: 1 homeassistant/switch/irrigation/config 发布信息: 1 {"name":"garden","command_topic":"hachina/switch/irrigation/set","state_topic":"hachina/switch/irrigati...
HomeAssistant 官方也给出了关于实体登录的文档:https://www.home-assistant.io/integrations/mqtt 对接例子如下: 上面的意思是:连接服务器之后,给某个Topic 发送固定的示例上的json 数据。 Topic: homeassistant/binary_sensor/garden/config Json: { "name":null, ...