
My home monitoring and control system is complicated, mainly because I’ve converted almost everything to electric, but I don’t have quite enough capacity to run everything (car charger, washer, dryer, hot tub, three water heaters, induction cooktop, electric oven, microwave…) all at once. It’s essential that I have some kind of load management and the sysadmin in me also insists that I keep close track of all of it. Hence, the monitor panel above which tracks it all and can be viewed from the $60 Android tablet mounted on the kitchen wall as well as viewed (and controlled) from my laptop or phone. Note that tapping almost any of the controls will change to a live, expanded view (cameras) or a history graph (numeric widgets).
The design of a display like this always involves tension between having it readable at-a-glance, while still giving all the information one might need. I settled on large gauges for the total charge, rate of charge/discharge, the electrical load, and the car charge. Most of the time, when I glance over at the wall, I can see what I need to see: how charged is the house and car batteries, and where are they headed. Often, though, the readouts will give me pause: why are we discharging? How much are the panels generating? So I added a panel of fine print showing the sources (solar, generator), the current states (hot tub temperature, rainfall, temperature) and the loads (bathroom hot water heater, kitchen hot water, studio hot water, car charging, and now washing machine (so I can tell when a load of wash is done), computer stack (curiosity), dehumidifiers (so I can shed those loads if necessary), and landscape lighting). Ugh! Now, I have a long list of things all usually showing zero watts and hard to read. In addition, Tesla sometimes returns “unavailable” instead of the car’s charging current, which makes things look really ugly.
I had initially coded the list as a simple text block written with Markdown (the same formatting language that powers twoprops.net). Home Assistant — the platform that handles all the home automation here — is configured using YAML, which might have been a good choice for simple configuration files but seems to me to be far out of its depth for modern Home Assistant configurations, which inevitably call for much more complex configurations than simple text. The solution is to use YAML “templates,” which are programming statements enclosed in {braces} embedded in YAML text. It’s difficult (for me, at least) to format things clearly and get appropriate comments in the right place, especially now that I have YAML templates embedded in Markdown text embedded in YAML configurations. It’s ugly. Still, it enables me to do a useful thing: I can code in conditionals so that the long (and growing) list of “loads” can now show only those loads that are significantly contributing to energy use.
Here’s the Markdown code (with YAML templates) used to display the sources, states, and loads block:
### sources
solar {{states('sensor.deye_sunsynk_sol_ark_pv_power_1')|int+
states('sensor.deye_sunsynk_sol_ark_pv_power_2')|int+
states('sensor.deye_sunsynk_sol_ark_pv_power_3')|int }}W
gen {{states('sensor.deye_sunsynk_sol_ark_grid_power')}}W
rate {{(states('sensor.deye_sunsynk_sol_ark_battery_power')|int/200)|int}}%/hr
### states
tub {{states('sensor.gw1100b_temperature_1')}}°
rain {{states('sensor.hihome_daily_rain')}}"
temp {{states('sensor.hihome_temperature')}}°
### loads
{% if states('sensor.kauf_plug_d670b1_kauf_plug_power')|int != 0 %}baHW {{states('sensor.kauf_plug_d670b1_kauf_plug_power')|int}}W{% endif %}
{% if states('sensor.kauf_plug_d67348_kauf_plug_power')|int != 0 %}kiHW {{states('sensor.kauf_plug_d67348_kauf_plug_power')|int}}W{% endif %}
{% if states('sensor.kauf_plug_power_2')|int >= 10 %}stHW {{states('sensor.kauf_plug_power_2')|int}}W{% endif %}
{% if states('sensor.kauf_plug_power')|int >= 10 %}tub {{states('sensor.kauf_plug_power')|int}}W{% endif %}
{% if not is_state('sensor.charger_power', 'unavailable') and states('sensor.charger_power')|int != 0 %}car {{states('sensor.charger_power')}}000W{% endif %}
If you don’t go cross-eyed trying to read that, you can see that some loads show up if there power draw is over zero. Others have a small lower limit (the hot tub, for example, draws 6 watts when it’s “off,” but I don’t care about that). The car has a special case to hide when it’s ‘unavailable’ as well.
I’m sure a YAML hotshot could code this a bit more elegantly, but this works well enough.
—2p