I have these NOUS A1T Tasmota flashed switches for which I have an Automation set up on the Current Power to send my phone a notification whenever it gets below a certain threshold.
Now this is working as intended but somehow the switch always restart once a day between 19:00 and 20:00 and this somehow gives a false positive for the Automation to trigger. That is because the Current Power gets set to undefined.
I’ve tried a numeric state and a Device trigger, but both keep getting a false positive when the device restart. Is there a way to only trigger the automation if the given value get below said threshold while ignoring the device restart?
Until now I have only used the frontend automation editor and haven’t dabbled in yaml configuration.
I followed this video to set up the switches and HA if that helps.
If I understand correctly the “for” clause will help the temporary switch from 0 to undefined to be ignored? I will definitely give this a go when I get home.
So that didn’t work and found this piece of code and integration to find the former value. The previous state was Unavailable. So I will give that a go tomorrow.
Yeah I triggered it manually. I wish there would be an easier way to test this, the false positive happens somewhere between 19.00 and 20.00.
Im also trying to get a helper template to return the previous state but it’s not working right now.
state_attr('sensor.garage_droger_energy_power')
One thing I noticed from the SQL is that the dashboard widget returns Unavailable while clicking through to the attributes reveals unavailable so now I included both in the array.
I also read in the state docs I could check on is not none, so I should add that to the mix as well.
In the end the solution was to create an input_boolean helper and set it to true when power gets above threshold. Then use the input_boolean as the condition for the notification automation and set the input_boolean back to false when triggered.