Trigger numeric_state on any change (not above or below fixed threshold)

Hello, first time posting in here.

I am wanting to create an automation that triggers on any state change of a temperature sensor.
This is currently set as a numeric_state platform.
Setting the above and below threasholds to the same sensor does not seem to let this happen, and not setting above/below value returns an error.


How would I get this automation to trigger on any change?

Thank you.

don’t use a numeric_state trigger.

just use a regular state trigger:

  - platform: state
    entity_id: senor.whatever

if you leave out the “to:” then it will trigger on any change to the state or attributes. leaving it in only triggers on any state change only and ignores changes to the attributes.

Also it’s better to not post screenshots of code. Paste text and use code formatting (``` on line before and after the code).

1 Like

My bad, Force of habit using snipping tool.

This change looks to be working flawlessly.

I’ve taken out the ‘to:’ and it triggers on change :smiley: .

  - platform: state
    entity_id: sensor.***_temperature
  - platform: state
    entity_id: sensor.***_humidity
 <append to spreadsheet>

I will certainly be using this with an escooter I have while it’s charging.
For now I’m using a temperature sensor to test this automation logging to Google sheets.

1 Like

again be aware that by removing “to:” it will trigger not only on state changes but also on attribute changes as well.

Sometimes it’s not a big deal. Sometimes it might be.

1 Like

Working without the ‘to:’ seems to be fine.
Here is the sensor in question being logged into Google sheets:

This does trigger occasionally with attribute changes as you mentioned.
I changed the automation to have a condition for the charger to be power on, multiple readings of the same value constantly is fine.
The screenshot shows it logging every minute even if the wattage is still the same.

I am happy this works.
Thankyou :smiley: .

1 Like