Comparing entity value before and after an action


I would like to create a condition in an automation that compares energy usage before and after an action.

My scenario is that I’ve 433mhz plugs outside that I use to control the car heating in the winter times. It works 95% of the times, but sometimes the plugs just haven’t received the signal. It is extremely frustrating when you realize that the car didn’t get preheated when you plan to drive.

So to validate if the signal has gone through, I would like to create below logic by comparing my houses real-time energy usage. One aspect of the challenge is that I’m not recording the energy usage, as it would create a lot of entries. MQTT publishes energy usage every second.

  1. Set/store current energy usage to a variable
  2. Turn outside plug on
  3. Wait 2 seconds
  4. If energy usage more than 800 watts than few seconds ago (compare to step 1) then OK else notify “car heating not on”

The issue is which I don’t know how to solve or even if it is possible, is to store a value in a variable inside a flow and use it later in the flow to compare.

Thanks for the ideas for helping me to solve this.

Not that your method won’t work but there might be easier solutions?
You could have a light connected to the same remote controlled plug. That way if the light is on then the heating is also on.
Easy to visually confirm that it works and doesn’t get fooled by some other appliance that might start at the same time.

Input_text/number is probably the easiest

Thanks. The plug is not directly in line of sight. So I ended up creating input_number as you proposed for variable, an input_boolean for the switch and then an automation to run the flow that check when the switch is turned on.