Calculate cumulative on-time on for a switch

Create a Template Sensor plus History Stats sensor. Add Utility Meter sensors for long-term fata (daily/weekly/monthly/yearly).