Ministry of Living

Home Automation, HomeLab and things.

Home Assistant: Auto-generate Energy Usage Sensors (kWh) from Power Sensors (W)

If you have many smart plugs and are tired of defining energy usage sensors (kWh) from power sensors (W), this article is for you. This is just one solution that works for me. I hope this helps someone else too. Prerequisite: pyscript pyscript allows you to write python scripts for Home Assistant. For example, we can write actions (previously “services”) in python rather than with UI or yaml, and pyscript can do much more. This is very powerful in many situations. ...

March 12, 2025