Values from hlw8012 changed after upgrade to 2021.11.1

Today I updated my SP111 metering plug (from Gosund) from ESPhome 1.15.x to 2021.11.1, the latest stable one, because I wanted to introduce “device_class” and “state_class” to integrate it with the Energy panel in Home assistant.

I also had to update from python 3.6 to 3.8 to be able to run esphome 2021.11.1.

I added the class specifications and now I have:

      name: "${plug_name} - Ampere"
      id: "${plug_name}_Current"
      unit_of_measurement: A
      accuracy_decimals: 3
      icon: mdi:flash-outline
# new
      device_class: "current"
      state_class: "measurement"
      name: "${plug_name} - Volt"
      id: "${plug_name}_Voltage"
      unit_of_measurement: V
      accuracy_decimals: 1
      icon: mdi:flash-outline
# new
      device_class: "voltage"
      state_class: "measurement"
      name: "${plug_name} - Watt"
      unit_of_measurement: W
      id: "${plug_name}_Wattage"
      icon: mdi:flash-outline
# new
      device_class: "power"
      state_class: "measurement"

    change_mode_every: 4
    update_interval: 10s

The interesting part is: now current and power readings changed. Any other sensor to which I added the class specifications (voltage, uptime, wifi signal strength, …) stayed the same.

See these history graphs:

The calibration values DID NOT change, but the values for current and therefore power are now significantly lower. Check especially the baseline, which is laptop idle and external monitor off, therefore are very repeatable. But in general also active usage brings lower values.

In addition, not only the values are lower, they are also super smooth, all the short term fluctuations are gone. I checked the last three weeks and they have never been that smooth.

  1. is this normal? has anything changed between the two releases?
  2. ignoring the scaling factor, which are the correct readings? the jagged ones or the smooth ones?


It turns out, after reconnecting the power the laptop, powered by the monitor via USB-C, somehow did not notice power was back, so it was running on battery.
Disconnected everything and reconnected, rebooted, the values are back to normal.