Stop automation when raining

trying to add this to my Driveway automation as I get lots of false activation’s when raining,
I’m unsure where to add this any help is much appreciated.


  **condition: template**
**  value_template: "{{ not is_state('weather.home', 'rainy') }}"**
- alias: Driveway Linecrossing MP3
  trigger:
    platform: state
    entity_id: 
      - binary_sensor.driveway_line_crossing
      - binary_sensor.driveway_field_detection
    to: 'on'
  action:
    - service: media_player.volume_set
      data_template:
        entity_id: 
          - media_player.home_group_2
        volume_level: 1  
    - service: media_player.play_media
      data_template:
        entity_id: media_player.home_group_2
        media_content_type: 'music'
        media_content_id: >
          {% if is_state("input_select.mp3_driveway_alarm_list", "Yoda-BLR-Hmm-Ha") %}
            http://192.168.1.100:8123/local/Yoda-BLR-Hmm-Ha.mp3
          {%-elif is_state("input_select.mp3_driveway_alarm_list", "PulpFictionRemix") %}
            http://192.168.1.100:8123/local/PulpFictionRemix_1.mp3
          {%-elif is_state("input_select.mp3_driveway_alarm_list", "MessageAlert") %}
            http://192.168.1.100:8123/local/MessageAlert.mp3             
          {%-elif is_state("input_select.mp3_driveway_alarm_list", "carlpoppa2") %}
            http://192.168.1.100:8123/local/carlpoppa2.mp3 
          {% else %}
            http://192.168.1.100:8123/local/carlpoppa2.mp3 
          {% endif %}        

Like this


- alias: Driveway Linecrossing MP3
  trigger:
    platform: state
    entity_id: 
      - binary_sensor.driveway_line_crossing
      - binary_sensor.driveway_field_detection
    to: 'on'
  condition:
    - condition: not
      conditions:
        - condition: state
          entity_id: weather.home
          state: rainy
1 Like

Hey thanks Mate so would i go something like this below Thanks again


- alias: Driveway Linecrossing MP3
  trigger:
    platform: state
    entity_id: 
      - binary_sensor.driveway_line_crossing
      - binary_sensor.driveway_field_detection
    to: 'on'
    condition:
    - condition: not
      conditions:
        - condition: state
          entity_id: weather.home
          state: rainy
  action:
    - service: media_player.volume_set
      data_template:
        entity_id: 
          - media_player.home_group_2
        volume_level: 1  
    - service: media_player.play_media
      data_template:
        entity_id: media_player.home_group_2
        media_content_type: 'music'
        media_content_id: >
          {% if is_state("input_select.mp3_driveway_alarm_list", "Yoda-BLR-Hmm-Ha") %}
            http://192.168.1.100:8123/local/Yoda-BLR-Hmm-Ha.mp3
          {%-elif is_state("input_select.mp3_driveway_alarm_list", "PulpFictionRemix") %}
            http://192.168.1.100:8123/local/PulpFictionRemix_1.mp3
          {%-elif is_state("input_select.mp3_driveway_alarm_list", "MessageAlert") %}
            http://192.168.1.100:8123/local/MessageAlert.mp3             
          {%-elif is_state("input_select.mp3_driveway_alarm_list", "carlpoppa2") %}
            http://192.168.1.100:8123/local/carlpoppa2.mp3 
          {% else %}
            http://192.168.1.100:8123/local/carlpoppa2.mp3 
          {% endif %}        

i get this error below

2021-08-20 16:09:58 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [condition] is an invalid option for [automation]. Check: automation->condition. (See /config/configuration.yaml, line 77)

No. See how mine lines condition up with trigger?

Yours is indented too far.

yes just seen it thanks, OMG copy n past mistake again

funny even when i run with weather sate changed to rainy via development tools the automation still runs I guess ill keep playing hopefully i can get it to work

Yes lol reboot solved Thank you very much mate much appreciated final code bellow just in case it could help anyone

- alias: Driveway Linecrossing MP3
  trigger:
    platform: state
    entity_id: 
      - binary_sensor.driveway_line_crossing
      - binary_sensor.driveway_field_detection
    to: 'on'
  condition:
    - condition: not
      conditions:
        - condition: state
          entity_id: weather.home
          state: rainy
  action:
    - service: media_player.volume_set
      data_template:
        entity_id: 
          - media_player.home_group_2
        volume_level: 1
    - service: media_player.play_media
      data_template:
        entity_id: media_player.home_group_2
        media_content_type: 'music'
        media_content_id: >
          {% if is_state("input_select.mp3_driveway_alarm_list", "Yoda-BLR-Hmm-Ha") %}
            http://192.168.1.100:8123/local/Yoda-BLR-Hmm-Ha.mp3
          {%-elif is_state("input_select.mp3_driveway_alarm_list", "PulpFictionRemix") %}
            http://192.168.1.100:8123/local/PulpFictionRemix_1.mp3
          {%-elif is_state("input_select.mp3_driveway_alarm_list", "MessageAlert") %}
            http://192.168.1.100:8123/local/MessageAlert.mp3             
          {%-elif is_state("input_select.mp3_driveway_alarm_list", "carlpoppa2") %}
            http://192.168.1.100:8123/local/carlpoppa2.mp3 
          {% else %}
            http://192.168.1.100:8123/local/carlpoppa2.mp3 
          {% endif %}        
    - service: camera.snapshot
      data:
        entity_id: camera.driveway
        filename: /config/www/images/driveway.jpg
    - delay:
        seconds: 2
    - service: homeassistant.turn_on
      entity_id: script.driveway_notify_alarm