I am trying to store the timestamp which I get from a rest sensor in a number helper so I can suppress activity until the sensor is updated (I am trying to determine available charging amps and this are wrong immediately after a change until the sensor refreshes).
but the two are never equal (as one is stored as a float?). even when I force both to int.
So what is the best way to do this please?
I have
- name: "selectronic update timestamp"
state_class: measurement
state: "{{(state_attr('sensor.selectronic', 'timestamp')|int(0))}}"
unit_of_measurement: "ts"
unique_id: sensor.selectronic.timestamp
and the test
{% if states('sensor.selectronic_timestamp') |int(default=0) == states('input_number.ezri_change_amps_selectronic_change_timestamp') |int(default=0) %}
is never equal immediately after setting the helper to the sensor.
it seems odd to store a timestamp as a datetime if it is to be compared to a timestamp again - what would you suggest?