@Teddythanh wrote:
Hi,
I would like to create an automation to alert me through Google TTS and Telegram when there is/are windows open when it is raining.
I have 3 windows so at, the first time, I created 3 automations for 3 windows to do the alerting but the Google TTS only play 1 message at 1 one and all 3 automations could be triggerred at the same time if dark_sky_icon turn to ‘rain’ and 3 windows are open.
So I am thinking about some “IF … THEN” clause inside the YAML code as below. I know it is not correct codes but I would like to know is there any similar solution like this for my automation? Thank you.
- alias: 'Alert for open windows when raining' trigger: - platform: state entity_id: sensor.dark_sky_icon to: 'rain' condition: - condition: time after: '6:00' before: '23:00' action: {% if is_state('binary_sensor.door_window_sensor_158d00042455e0', 'on') %} - service: tts.google_translate_say entity_id: media_player.loa_home_mini, media_player.loa_mini_phong_khach data: message: 'It is raining and the master room window is opened.' - service: notify.galaxynote data: message: It is raining and the master room window is opened. {% endif %} {% if is_state('binary_sensor.door_window_sensor_158d00045dc863', 'on') %} - service: tts.google_translate_say entity_id: media_player.loa_home_mini, media_player.loa_mini_phong_khach data: message: 'It is raining and the kid room window is opened.' - service: notify.galaxynote data: message: It is raining and the kid room window is opened. {% endif %} {% if is_state('binary_sensor.door_window_sensor_158d0004508d1e', 'on') %} - service: tts.google_translate_say entity_id: media_player.loa_home_mini, media_player.loa_mini_phong_khach data: message: 'It is raining and the living room window is opened.' - service: notify.galaxynote data: message: It is raining and the living room window is opened. {% endif %}
Posts: 1
Participants: 1