本帖最后由 z741554038 于 2020-1-2 19:14 编辑
2020年前来考古 改了一下8楼大兄弟的代码,因为官方的提示
因此可得
- platform: template
sensors:
sun_state:
friendly_name: 'sun_state'
value_template: >-
{% if is_state('sun.sun', 'above_horizon') %}
上山了
{% else %}
下山了
{% endif %}
所以由此我可以判断M1的甲醛浓度是否在正常值里,我就能作为一个实体添加在tileboard里
- platform: template
sensors:
hcho_state:
friendly_name: 'hcho_state'
value_template: >
{% if states('sensor.m1_hcho') | float > 0.1 %}
差
{% else %}
好
{% endif %}
|