I have an infrared sun shower, which consumes somewhere between 1445 watts and 1460 watts of power. Since the sun shower isn’t smart, and I don’t want to open the wiring I’m looking for a way to only trigger the automation if the total power consumption of our energy meter increases between 1445 and 1460 watts. It should trigger the lights in the shower cell and should turn the lights off if the total power consumption drops again with the range of 1445 and 1460 watts.
I have tried creating a template, but I’m a bit stuck at the moment…
But if the total change actually takes a few state changes to happen, you will need to use a statistics-based sensor like Trend or Derivative integrations.
That’s going to kill the reliability of the simple trigger on the Template sensor. You could still try it, but you would need one or more additional triggers. For example you could set up an automation with a similar trigger as that post above, but with a value range for the first step, then a Wait for trigger action for the change from the first value to the second. If that passes have an action to raise an event to trigger the template sensor…
But I think you will probably be better off using one of the statistical sensors.
In any case, Edwin’s suggestion to consider adding alternative sources of data is a good one.
Any time you don’t have a direct source of truth, it’s worth considering setting up a Bayesian binary sensor to incorporate multiple indirect sources using probability to get a reliable trigger.
No, what I posted is a trigger-based template binary sensor not an automation. It must be set up in your configuration.yaml file (or any properly merged file for the template integration). The binary sensor then becomes the trigger for your “light turn on/off” automation.
I you want to test the trigger in an automation it would be more like: