Turn Off autimation if raining and back on everything other help

please help I not-sure why this is not working but need automation switch to turn off when raining and on if any-other weather type using the weather.home in hassio.
as i have a autimation that triggers from a cameras line crossing that notify’s phones but when raining i get false activation’s that can be annoying
it would be useful to be able to manually disable this as-wel.
i am very stuck any help will be much appreciated thanks

- id: 'Turn Off Driveway Noify'
  alias: Weather-Not Rainy
  trigger:
  - platform: template
    value_template: '"{{ states(''weather.home'') != rainy }}"'
  action:
  - service: homeassistant.turn_off
    entity_id: automation.driveway_alarm_notify
  

Lots of quotes…
And I understand you want to turn off when raining.

Try

- id: 'Turn Off Driveway Noify'
  alias: Weather-Not Rainy
  trigger:
  - platform: template
    value_template: "{{ is_state('weather.home', 'rainy') }}"
  action:
  - service: homeassistant.turn_off
    entity_id: automation.driveway_alarm_notify
 

To clarify, you don’t want to be notified in case weather.home is rainy? In that case, you can add a NOT Condition in your automation.driveway_alarm_notify.

condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: weather.home
        state:
          - rainy
          - pouring
          - lightning-rainy
          - snowy-rainy
1 Like

The practice of disabling/enabling automations to control when it should/shouldn’t execute is a lousy one.

The chief drawback is that in the event you must truly disable the automation (due to some extenuating circumstances) you have lost that ability because you have logic that re-enables it.

A better approach is to simply allow the automation to decide when it should/shouldn’t execute. For example, simply add:

{{ not is_state('weather.home', 'rainy') }}

as a Template Condition to automation.driveway_alarm_notify. If you do that, it will execute its action only if the weather is not rainy.

1 Like