Using above/below and edge conditions

Hi All,

I have a simple automation that has me scratching my head and hoping that someone else more experienced can help. I have the following automation:

>  ## Outside temperature indicator  ##
>   - alias: 'Hot Outside'
>     trigger:
>       platform: state
>       entity_id: sensor.weather_apparent_temperature
>     condition:
>       condition: numeric_state
>       entity_id: sensor.weather_apparent_temperature
>       above: 85.0
>     action:
>       service: scene.turn_on
>       entity_id: scene.hot_out

>   - alias: 'Nice Outside'
>     trigger:
>       platform: state
>       entity_id: sensor.weather_apparent_temperature
>     condition:
>       - condition: numeric_state
>         entity_id: sensor.weather_apparent_temperature
>         above: 72.0
>       - condition: numeric_state
>         entity_id: sensor.weather_apparent_temperature
>         below: 86.0
>     action:
>       service: scene.turn_on
>       entity_id: scene.nice_out

>   - alias: 'Cool Outside'
>     trigger:
>       platform: state
>       entity_id: sensor.weather_apparent_temperature
>     condition:
>       condition: numeric_state
>       entity_id: sensor.weather_apparent_temperature
>       below: 73.0
>     action:
>       service: scene.turn_on
>       entity_id: scene.cool_out

It basically sets some lights using based on temperature. Each temperature range lights a different light: Blue < 73.0, Green > 72.0 and <86.0, Red > 85.0

I’ve noticed that when the temperature is 72.0F, no lights are set when, according to the logic, the blue light should be on. The temperature sensor I am using is forecast.io which appears to report temperature in single decimal places. I’m new to Python and I’m guessing this must be some sort of integer/float thing in Python that I don’t understand? What is the proper way to fix this?

Thanks.

Your above / belows look off to me.

cold < 73
nice >72
there is an overlap 72.5 would be true for both. maybe try
cold < 72.0
nice > 71.9

and also

hot > 85
nice < 86
there is an overlap

1 Like

mrmichaelh,

Thanks for your feedback. I will do some more experimentation. Aside from above/below, is there above/below or equal to comparison operator? I guess I could add more conditions, but it seems a long way around. I guess another way to go is for me to figure out who to write the scripts (is that th right term?) that I see some folks use.