因为想把户外温湿度信息打包成text发送给家里的KNX面板(单行要么只能显示2字节数值,要么能接收显示14字节文本)。就想通过esp8266采集数据,通过homeassistant发送给它。
但是对于我这个不懂程序员语法的菜鸟太难了,参考了esphome官网对于text_sensor的介绍,还装了Node-Red,想收到转换,结果弄了一周也没送出除了固定文字,任何带数值的信息,蛮沮丧的,看来机器和我鸡同鸭讲,估计机也累了。付程序,希望人间机器人看到,帮俺改改。
sensor: - platform: uptime #上电时间计数器 name: Uptime Sensor update_interval: 720s
- platform: pmsx003 #空气质量传感器 type: PMSX003 pm_1_0: name: "articulate Matter <1.0µm Concentration" pm_2_5: name: "articulate Matter <2.5µm Concentration" pm_10_0: name: "articulate Matter <10.0µm Concentration" update_interval: 720s
- platform: sht3xd #温湿度 temperature: id: "text_temp" name: "TestTemperature" humidity: id: "text_humi" name: "TestHumidity"
address: 0x44 update_interval: 5s
# Text:”O:27.1°C 63%RH” text_sensor: - platform: template name: "Test_Text_Sensor" id: template_text # in some trigger on_...: - text_sensor.template.publish: id: template_text state: "Hello World"
- text_sensor.template.publish: id: template_text state: !lambda: {"O",id(text_temp).value),"°C ",id(text_humi).value),"%RH"}; update_interval: 60s
#°C
|