zha-device-handlers: [BUG] Smart plug metering information only updated on HA restart
Describe the bug I got some Aubess EU power plugs with the capability of measuring electricity usage. They all work fine, except for one thing. Information for the sensor “smartenergy_metering_summation_delivered” is only updated on every restart of HA. All other sensors electrical_measurement, electrical_measurement_rms_voltage and electrical_measurement_rms_current are updated in real time as expected.
To Reproduce Add the device in HA and have a device plugged in to this socket use some energy. The sensor will not update. Restart HA and wait a couple of minutes then then the sensor does update once, until the next restart of HA
Expected behavior I expect the sensor to update in (near) real-time
Additional context Zigbee device signature:
{
"node_descriptor": "NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress|RxOnWhenIdle|MainsPowered|FullFunctionDevice: 142>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)",
"endpoints": {
"1": {
"profile_id": 260,
"device_type": "0x010a",
"in_clusters": [
"0x0000",
"0x0003",
"0x0004",
"0x0005",
"0x0006",
"0x0702",
"0x0b04",
"0xe000",
"0xe001"
],
"out_clusters": [
"0x000a",
"0x0019"
]
}
},
"manufacturer": "_TZ3000_gjnozsaz",
"model": "TS011F",
"class": "zhaquirks.tuya.ts011f_plug.Plug"
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 32
Hi,
Ok, I’d love to try it with the firmware upgrade, but I’m afraid I’m unable to do that. ZHA currently does not support this and if you want Tuya to take care of it, you need a Tuya zigbee hub, which I don’t have.
Having said that, the frustrating thing is that I found that a fix for this issue actually exists since December 2021: Add support for Polled clusters and use it for ts011f plug Metering
Unfortunately this pull request still isn’t merged, so we’re stuck with the non working TS011F plugs. (Well for power metering that is). I wouldn’t mind manually updateing the zigpy code but I can’t seem to find where it resides.
Then again, in this threade someone actually provided a workaround that works for me. This workaround makes use of the “ZHA Toolkit” so you need to install that first. (It’s in HACS). Having done that you can create automations to just do the pulling for you. Below is what I have for my 5 plugs:
Just change the name of your sensors and you’re good to go. Also, pulling every minute like I do in this examle may be a bit overkill, so maybe I’ll change it to every 5 minutes or so. But for now It doesn’t seem to have a negative impact on the network.
I will give it a try 👍 Update: @lpwevers yes this works for my Innr plus 🙏
Thank you @kokobadu for your valuable reply ! I spent the Last two days migrating to Z2M, I was hesitating to let down ZHA as for me, ZHA was the future and i was waiting waiting for this issue to be fixed. Let me tell you that i have repaired 50+ devices in Z2M without any issue and it was fun … i have ikea, philips, xiaomi, tuya, sonoff devices. I like how devices are shown with images in Z2M dashboard. I had also to recreate the automations again and update my existing node-red flows and download new blueprints for the remotes and switchs…
Once all done, i noticed that some power plugs were identified as TS011F_plug_3 and others TS011F_plug_1 .Checked the ota and it suggested to update firmware of the all TS011F_plug_3 plugs. After update all the plugs, they became as TS011F_plug_1. They report correct values regularly.
OTA also updated my philips and ikea devices. I was not aware that i could do this. I ve read you can do OTA with ZHA, but i have not seen this option in my ZHA config.
I also like how zigbe2mqtt allows to configure each device without going to clusters which is not user friendly. For example, i have tuya covers and configuring the travel time was not easy, with z2m, all major configurations for each device are present in the use interface, i discovered interesting parameters for my devices, i found out also that my xiaomi flood sensors have also temperature sensors which were not reported as i remember when using ZHA.
@lpwevers , go ahead with Z2M, it is worth it, i think it is still as of now more mature.
Now that the plugs are working fine and reporting precise values, i will add more of the
Thank you for your help,
Hi, have the same issue with
_TZ3000_gjnozsazand_TZ3000_u5u4cakc! After a restart, all values are updated as intended.