Hi,
With quite a bit of fiddling around I have implemented the waveshare_ups_hat integration to monitor the battery on my Pi, like a UPS. It mostly works fine, but the automation that sends a notification when the power goes off is set to only trigger if the power is off for 30 seconds, as I find minor power fluctuations trigger it otherwise. The problem is the automation to notify when the power comes back on, happens for the minor fluctuations, because it triggers whenever the power comes on after being off, even if it was off for just a second.
I tried adding a value to the sensor template of the UPS in the configuration.yaml to store a flag that I could set to 1 when I send the power-off notification and add a condition to the power-on notification to need the value to be 1 (and then setting it back to 0). The theory being that it would only then send the power-on notification if a power-off notification had previously been sent. But I can’t seem to set the value, it logs “Referenced entities sensor.ups_warning_sent are missing or not currently available” when I try and set the value to 1 in the power-off action.
How can I create an extra entity on the UPS to store an arbitrary value?
Or is there a better way of achieving this that I just haven’t thought of?