本帖最后由 lidicn 于 2017-9-8 13:11 编辑
该自动化原创 dodiu的利用虫子神的和风天气预警未来一小时下雨概率https://bbs.hassbian.com/thread-42-1-1.html
增加了判断雨量大小
- alias: 1hour_pop
trigger:
- platform: state
entity_id: sensor.caiyun_minutely_probability_1
condition:
condition: and
conditions:
- condition: time
after: '07:00:00'
before: '21:00:00'
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.caiyun_minutely_probability_1
above: 90
action:
- service: tts.baidu_say
data_template:
entity_id: media_player.mpd
message: >
"{{states('sensor.caiyun_minutely_description')}},
一小时内百分之{{states('sensor.caiyun_minutely_probability_1')}}的可能会下
{% if states.sensor.caiyun_minutely_precipitation.state | float < 0.9 %}
小雨
{% elif states.sensor.caiyun_minutely_precipitation.state | float < 2.87 %}
中雨
{% elif states.sensor.caiyun_minutely_precipitation.state | float > 2.87 %}
大雨
{% endif %}"
cache: false
- service: notify.wechatnotify
data_template:
message: >
"{{states('sensor.caiyun_minutely_description')}},
一小时内百分之{{states('sensor.caiyun_minutely_probability_1')}}的可能会下
{% if states.sensor.caiyun_minutely_precipitation.state | float < 0.9 %}
小雨
{% elif states.sensor.caiyun_minutely_precipitation.state | float < 2.87 %}
中雨
{% elif states.sensor.caiyun_minutely_precipitation.state | float > 2.87 %}
大雨
{% endif %}"
target: !secret wechat_user1
|