Change variable/entity in automation to track when an automation happens

Hey guys, since a water leak in my basement I have powerful dehumidifier and a big fan in my basement to dry the floor and the walls.

Actually the fan and the dehumidifier have a sum power consumption of about 800W. I have an automation which notifies me when the tank of the dehumidifier is full (the device turns off when the tank is full so I only have to monitor the powerconsumption to decide if its full):

alias: Entlüfter leeren
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.lumi_lumi_plug_maeu01_electricalmeasurement
    below: 400
condition: []
action:
  - service: notify.mobile_app_iphone
    data:
      message: Kellerentlüfter entleeren!
      title: Entlüfter ist voll
  - service: notify.my_lametric
    data:
      data:
        icon: 24120
        priority: critical
        sound: water1
      message: Entlüfter ist voll
mode: single

But now I would like to see additionally how long the time span is between two emptying of the container and how long the time span was between container is full and the emptying was.

Sense behind it:
I would like to see how the time span changes between two emptying in order to be able to estimate whether the drying is effective (not only visually).

What is the best way to implement this as an automation?

I am still quite new to HomeAssistant and the automations, so forgive the perhaps stupid question :slight_smile:

It’s not a stupid question at all. I’d use input helpers for this:

I assume the emptying is manual, and you don’t have a sensor for that? My approach would be:

  • Create a datetime helper (input_datetime.last_emptied);
  • Add a button on the dashboard that resets that helper to the current time;
  • Add a step to the automation action above that calculates the difference between the last emptied time and the current time (triggered when full);
  • Add a reminder to the notification to prompt you to press the dashboard button when you empty the tank.

Let us know if you need help with any of that.

The emptying is manual, but I could derive from the peak power consumption that the dehumidifier is running again, so I guess I don’t need any manual buttons for that.

The idea with date helpers seems pretty straightforward and could be a possible solution. I will try that and report back if it works or fails :slight_smile:

Thank you for that neat hint!

1 Like