I’m using a Shelly Plus Plug S smart plug to measure the power usage of my homelab. I added it as a device in Home Assistant — and the power readings began! Kind of…
Within a few days; I noticed something strange with the graph history — there were long periods of time where the graph was completely flat. Logging into the Shelly web interface, I could see the watt reading changing — without this being reflected in Home Assistant.
So; instead of relying on the power value through the Home Assistant integration, I enabled MQTT in the Shelly settings.
Then defined an MQTT sensor in the Home Assistant configuration:
mqtt:
sensor:
- state_topic: 'shellyplusplugs-d4d4dae86c34/status/switch:0'
name: Homelab apower
unit_of_measurement: 'W'
device_class: power
value_template: "{{ value_json.apower }}"
force_update: true
state_class: measurement
With this sensor; the power value is updated every 60 seconds, and the graph history is looking much better 🙂
Below you can compare the power reading from the Home Assistant integration, and from the MQTT sensor 👇
The accuracy and resolution on the MQTT sensor is vastly better. When used for power readings, with a fluctuating load, I’d say the value from the integration is pretty much useless.
I’m not sure why the Home Assistant integration has so low update frequency, maybe there is some hysteresis involved — only updating when the change is above a certain threshold level 🤷