Compare current entity value with value - which was some period ago

Hi!
Last week my sewage pump went down for few days and created chaos in house, so i installed Shelly 1PM to monitor (consumption kwh) - if sewage pump has worked at least once a day. But - it will not work in long term - because nobody will be watching the consumption manually…
So i thought it would be great to add automation in node-red to check consumption difference in time period, for example in 24h period. But i cant figure out - what node should i use, or install… Which can check - if consumption in today is higher then it was 24h ago.
Or maybe You have some other advice how to monitor such a thing?
Thank You!

Send a notification to yourself if it does not operate once a day.

I have a similar automation monitoring my fridge compressor:

- id: b19d9b07-9290-468f-8404-10a192487b32
  alias: 'Kitchen Fridge Compressor Alert'
  trigger:
    platform: numeric_state
    entity_id: sensor.fridge_power
    below: 50
    for:
      hours: 2
  action:
  - service: notify.telegram_system
    data:
      title: '⚠️ *Kitchen Fridge fault*'
      message: "The kitchen fridge compressor has not turned on in the last 2 hours."
1 Like

Thanks tom_l for reply! Your solution looks solid!
But i got also working version with influxdb node.

  1. With influxdb node i`m collecting minimal value in 24h for - sewage pump and also current value of sewage pump.
  2. In function node i just compare both values.
  • If there is no values or current value is equal with minimal value in last 24h - then i can send notification to all involved users!

Once a day this automation is executed.