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 template 计算 Home Assistant是一款智能家居平台,其提供了模板计算功能。在 Configuration.yaml文件中,可以使用value_template选项配置传感器的模板,从而实现对传感器数据的计算。 例如,创建一个名为“TemperatureSensor”的温度传感器,并订阅“my/mqtt/topic”主题以获取其状态,可以添加以下内容: ```yaml ...
然后需要新增一个value_template字段,在mqtt测试界面无法传输,可以用ssh登录,发送以下消息 mosquitto_pub -h ha_ip -p 1883 -t "homeassistant/binary_sensor/garden/config" -m '{"name": "garden", "device_class": "motion", "state_topic": "homeassistant/binary_sensor/garden/state"}' 参考mqtt disc...
homeassistant/sensor/computer/cpu/config { "unique_id": "computer_cpu_usage", "name": "电脑 CPU 占用", "state_topic": "home/computer/status/cpu", "unit_of_measurement": "%", "device_class": "power", "value_template": "{{ value }}", ...
编辑/config/configuration.yaml 文件,怎么找到这个文件请查看 Home Assistant 篇二:群晖Docker安装Home Assistant_NAS存储_什么值得买 (smzdm.com) ,添加以下代码,用来显示电费和月初1号0点清空总电量。 sensor: #本月电费 - platform: template sensors: zong_dianfei: value_template: > {% set dianlian=sta...
首先使用mqtt注册设备: 温度传感器配置(包括设备信息){"unique_id":"esp32_temperature_sensor1","name":"温度传感器1","state_topic":"home/esp32/temperature1","unit_of_measurement":"°C","device_class":"temperature","value_template":"{{value_json.temperature}}","device":{"identifiers":["esp...
"value_template"不一样 mosquitto_pub -h (你的ip) -p 1883 -t "homeassistant/sensor/room2-temp/config" -u (你的用户名) -P (你的密码) -i "pub100" -m '{"device_class": "temperature", "name": "BPM", "unique_id":"room2-temp", "state_topic": "homeassistant/sensor/room2/stat...
先看看视频使用方法,下面直接写python代码了 12:28 HA自动发现mqtt设备sensor(传感器篇) 2484观看 0弹幕 看看官网说明: 第一个例子代码: 运行后,在homeassistant会发现到这两个传感器 然后就执行下面这行代码模拟发送传感器数据: 数据就显示到了homeassistant ...
mqtt: - binary_sensor: name: "Window Contact Sensor" state_topic: "home-assistant/window/contact" payload_on: "ON" availability: - topic: "home-assistant/window/availability" payload_available: "online" payload_not_available: "offline"
Fixes #4247 More gracefully handles teslamate/cars/1/active_route topic JSON when the car is not routing, the json_attributes_template would cause a Home Assistant warning since we're trying to acc...