(how to) Computing uptime from on/off events

Hi @usky73

This type of question has come up a lot of over the months / years, and I think sometimes each use case is a bit different. Do any of these solutions help?

Count how long a value is 1 or 0 (on or off)
Calculating total ON or OFF time for a period (day, month, etc.).
Computing duration of a state using events.duration function