core: ZHA: Innr smart plug SP 120 reports wrong values for active power

Home Assistant release with the issue:

0.103.0

Last working Home Assistant release (if known): n/a

Operating environment (Hass.io/Docker/Windows/etc.):

  • Hass.io (32bit)
  • Raspberry PI 4 (4 GB version)
  • Dresden Elektonik Conbee II Zigbee adapter (USB with latest available firmware)

Integration:

https://www.home-assistant.io/integrations/zha/

Description of problem: Since recently I was using the Conbee adapter throught deCONZ containter add-on and everthing was working as expected. I decided to migrate to native ZHA integration (zigpy-deconz) to take advantage of the capability using light switch buttons (remotes) directly within automations, than using the somewhat awkward usage of deconz_events.

I have several Innr SP 120 smart plugs which measure current power, total power, current voltage and current. However since moving them to native ZHA integration the values for i.e. power are divided by 10 so 34 Watts become 3.4 Watts in HA.

Looking at ElectricalMeasurement (Endpoint id: 1, Id: 0x0b04, Type: in) and there at active_power (id: 0x050b) the value is correct. I checked on ac_power_divisor (id: 0x0605) and ac_power_multiplier (id: 0x0604) which both return “None”.

Trying to set above mentioned attributes doesn’t work or at least not change anything.

This might be related to #15958

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

Using ZHA through integration. (Not sure what part would be required here) This is from core.config_entries

            {
                "connection_class": "local_push",
                "data": {
                    "radio_type": "deconz",
                    "usb_path": "/dev/ttyACM0"
                },
                "domain": "zha",
                "entry_id": "ad57da9229804ee688ade46e301a18cd",
                "options": {},
                "source": "user",
                "system_options": {
                    "disable_new_entities": false
                },
                "title": "/dev/ttyACM0",
                "version": 1
            }

Traceback (if applicable):


Additional information:

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (14 by maintainers)

Most upvoted comments

Actually I’m looking for consumption, kWh. After adding device three items showed up and I hoped smartenergy_metering is kWh. screen

@Adminiuga I can confirm it works as expected. Active power shows now with correct values. Total consumption still not working, but that is something for another issue/day.

Thanks!

So #30130 should take care of the active_power and for other attributes I need to try a few ideas around ZHA device initialization.

@dmulcahey here’s PoC https://github.com/Adminiuga/home-assistant/commits/ac/zha-entity-registry

Just need to fix the device tracker battery formatter. I also think that with a slight modification this could be adapted for “device discovery” Just need to write tests to capture the results of current discovery process to ensure I don’t break anything.

The way metering is implemented handles this exact case cleanly. What benefits do we get from a separate sensor class?

This part is a bit “not clean” perhaps. https://github.com/home-assistant/home-assistant/blob/d6f317c0a988a6fdc492fbcec55c59b479533ecc/homeassistant/components/zha/sensor.py#L224-L231

But maybe to fix that all channels (or the base class) should have a formatter_function.