Help Building Automation

Hi Friends,

I have 4 temperatures sensor (sensor.temp1, sensor.temp2, sensor.temp3, sensor.temp4) and, if i restart the service, for example, they start with state ‘unknown’. I want to build an automation that check this states and if they’re with state = unknown, run a script (that I already have and works fine) script.update_sensors.

I’ve been struggling for a few hours trying to come up with an automation but nothing worked.

Can someone help me?

Thanks in advance!

Why not checking the state, like if state== unknown run script
You can make it an automation, as this runs all the time.

Use here the 1st example:

something like this:

  - condition: state
    entity_id: sensor.temp1
    state: 'unknown

cheers

Hi TheCrey

I considered an Automation because I need something that will keep checking for the state and, if it goes to unknown, then it will do an action. If I build a script, it will only work when I manually trigger it… right?

An Automation is normally triggered as soon the conditions is true.
So it is kind of checking all the time.

It can be manually triggered if wanted, then you just have to turn off automation.

cheers

Yeah, that’s what I want: something that check for a condition all the time and, if is true (in this case, sensor state = ‘unknown’) it runs a script (script.update_sensors).