I have a ventialtion system in my house which is shut off quite often automatically as it is connected to a low pressure warning device which cuts the power at the socket. I have installed a Shelly plug s to it to get notified once the power is off and the shelly becomes unavailable. Now I would like to have a sensor that counts how often the sensor becomes unavailable (i.e. the system is shut down) per day, week, month etc.
You create an input helper (counter) via devices > helpers
Then you create an automation that triggers on the sensor state, and if state ‘unavailable’ … updating the helper via service ‘increment …’