How to get "Last update" dates right ("Last update" is not updated in HA if the value does not change)

As a workaround, I apply a small change to the sensor value once it updates.
As the automation (blueprint) is running in single mode, the update itself will not trigger the automation again.
It works essentially like this:

blueprint:
  domain: automation
  name: Update sensor value to get next update trigger.
  input:
    sensor_id:
      name: Sensor
      description: Sensor to apply fake update to in order to ensure future update event if the value is identical.
      selector:
        entity:
variables:
  sensor_id: !input sensor_id
trigger:
  - platform: state
    entity_id:
      - !input sensor_id
action:
  - alias: Fake small change so that the next sensor update triggers an update/change event
    service: zha_toolkit.ha_set_state
    data:
      state_id: '{{ sensor_id }}'
      attr_val: '{{ (states(sensor_id)|round(2)) + 0.001 }}'
mode: single
1 Like