Automation only running when State of Entity is negative

How do I create an Automation that only runs when a specific Entity State is negative ?

Any guidance will be greatly appreciated.

Have a look at state condition:

Thanks !!! But unfortunately I am not sure to understand.
In that example I understand that the State “Not Home” is text and not a logical condition that HA will understand.

What I am trying to do is that to cast a music stream when a specific condition is OFF

I know how to create an automation to cast a music stream, but what I want to do is for thar music stream to only cast when a specific condition is OFF.

In Condition, I am confused by the State, Condition Type etc. I can select the desired condition in “Entity” but what escapes me is the “when OFF”

Thanks Taras

The Trigger that I want to use is either ON or OFF. If I use your suggestion, then “below: 0” will be understood as OFF ? And if want the condition to be ON, what would I use ?

I think your use of the word negative (below zero) is not what you meant. I see from the response you mean not something? (not home, not active).

The must used way is with a state trigger and from:

When the state changes from “home” to anything else you are no longer home.

In conditions, there is also a “not” condition. The thing you do not want is placed below it.

I see that I have to be much more specific.,

I created several automations to cast music streams (radio stations) at specific times to my Chromecast devices (*).
I added the Jewish Calendar integration and it has a condition " Jewish Calendar Issur Melacha " which is either ON or OFF.
I want one music stream to play when that condition is ON and another music stream when the condition is OFF.

Since this morning I know how to create these automations. It is only the On or OFF condition that I don’t understand.

Just use state changes to on or to off.

trigger:
  - platform: state
    entity_id: calendar.jewish_calendar
    to: 'on'

I get the impression that " Jewish Calendar Issur Melacha " might be an attribute rather than it’s own entity so you’ll need to provide more detail if that is the case

1 Like

Thanks so much. I really am a novice… I noted that you used ‘…’ for to: ‘on’ but not for calendar.jewish_calendar.
(The latter is in fact an entity : binary_sensor.jewish_calendar_issur_melacha_in_effect)
Is the ’ ’ needed, important ?

The entity that I want to be (in different automations) either ON or OFF is binary_sensor.jewish_calendar_issur_melacha_in_effect

What do I use for either the ON or OFF status ?

  • trigger:
    • platform: numeric_state
      entity_id: binary_sensor.jewish_calendar_issur_melacha_in_effect
      state: off
      or
  • trigger:
    • platform: state
      entity_id: binary_sensor.jewish_calendar_issur_melacha_in_effect
      condition: off
      or
  • trigger:
    • platform: state
      entity_id: binary_sensor.jewish_calendar_issur_melacha_in_effect
      to: ‘off’

I really am a novice at this (as you can see). Your help is much appreciated

The third one.

Numeric state would require a number, but you are dealing with a string.
The second one is not valid.

The quotes are not required for the entity id or on/off values but won’t break it either.

THANKS

Is " to: off " correct or should I use something else than " to " ? Maybe " state: off " ???

to is correct.

You can use to, from, not_to and not_from for that type of trigger.

If you play with automations in the UI editor it might be clearer.

Thanks !!!