Last change in value since

I’ve got a sensor that goes offline from time to time. It gets MQTT data from a cloud server, and that server is being fed by a local windows machine. The issue is caused by sharing USB over IP, by 2 hypervisors, but I can’t find a solution. Another story.

Now, the value sometimes stays the same, and the last update value is nicely updated. Since the cloud is responding.

Is there a way to check if the value changed during the last x-hours?
So I could send a small warning if it was unchanged.

Some info to illustrate it:

Thanks for your feedback!

Use a State trigger with a duration.

trigger:
  - platform: state
    entity_id: sensor.example
    to: null
    for: "01:00:00"
1 Like

Thanks, I’ll give it a try.

alias: Check Sensor Values
description: ""
trigger:
  - platform: state
    entity_id: sensor.vijver_ph
    to: null
    for: "04:00:00"
action:
  - service: notify.email
    data:
      title: Check Sensor Values
      message: Check Sensor Values
      target:
        - [email protected]
      data:
        html: >
          Check Sensor values<br>
mode: single

For my understading: The value of the sensor still comes in as a numeric value (eg each 5 minutes 7.45). With the ‘to: null’, this is covered?

This means trigger if there’s a change in the value of the sensor’s state or its attributes.

  - platform: state
    entity_id: sensor.vijver_ph

This means trigger if there’s a change in the value of the sensor’s state.

  - platform: state
    entity_id: sensor.vijver_ph
    to: null

This means trigger if there’s a change in the value of the sensor’s state and that value remains unchanged for at least 4 minutes.

  - platform: state
    entity_id: sensor.vijver_ph
    to: null
    for: "04:00:00"
1 Like