Automations triggered by changes in the integer part of a value

Hi all,

I’m having trouble figuring out how I trigger an automation based on the integer value of a device. For example, I have a device that reports temperature with 2 decimal places, 12.76 for example. I want to trigger an action if it changes from 12 to 11 or 12 to 13 but not if it changes from 12.76 to 12.77 which is all I’ve been able to achieve so far.

I’ve played with trigger.from_state and trigger.to_state but what it seems I need is a “fake” state that holds the integer value of the state but I can’t see a way to do that.

Thanks

Steve

look at a numeric_state trigger or a template trigger. combine that with type casting the value or rounding by using | int or | round.

EDIT: here it gives examples of casting a value to a type.

Did you manage to resolve this?

All the information to do a numeric template trigger is available in the links I posted.

1 Like

No - it became more trouble than it was worth so I gave up!

Steve