Non standard Zigbee deivce handlers

Gday all,

i have recently acquired a few zigbee energy meters (240Vac/40A CT) that use non standard end points within the metering cluster (eg, 0xe123, 0xe124, etc). The meters were originally designed to work with a master/controller from the same company.
I have a copy of the integration documentation with a complete list of endpoints for the meters.
The meters will bind and show basic information within ZHA and display at least 1 other endpoint in a non metering cluster (inbuilt switch), Only the metering endpoints are non standard.

Looking over everything i can serch for, I’ve been trying to make a device handler, which is going alright, I am just confused as to what i need to do with the device handler once i have finished.

Do i need to add “ZHA device handlers” or another repo to HA, or can i just drop the file into HA somewhere, or do i need to compile my own version of HA to get this to work?

I went though as many questions/search’s and documentation as i can, But either i am asking/thinking the wrong question, or its just so obvious i am not seeing it.

Running 0.102.1, ZHA, Ubuntu VM (using the generic Linux instructions), Elelabs zigbee stick.
Energy meter is a “saturn south” single phase logger.

Any help or direction to look in will be greatly appreciated.

1 Like

As I suspected, I had a fatal misunderstanding of how everything worked.

Turns out I didn’t realise that zha-device-handlers and zigpy quirks are python library’s installed within python on Hass.io rather home assistant add-ons.

So trying to add to or modify zha within HA is the wrong thing to do in this instance.

Will post back with results now I know what I was doing wrong.

Hi @l34rn3d , I’m actually starting on this path as well and it would be really helpful if you could share what you learned so far. In my case I want to add support to a Salus SP600 smart plug with metering features.
Also, if you have any links that might help me in the meantime it would be greatly appreciated.

Not a problem, I’ll collect my thoughts and post a bit more/clearer as soon as I have more time,

But as I have the endpoints listed in a official document from the manufacturer it may be different to other situation’s.

From my work so far I read through the zigpy and zha Dev handler (both on GitHub) code and have started to modify existing “Quirks” to suit my device. I’ll probably get around to testing this weekend,

My hurdle at the moment is trying to understand how the quick will handle the non standard addresses, and match up the data field’s, as well as why there are different profile’s within the file. Are they different device versions? Or something else? I will have to look into the values that are in the zha config within HA and match up what goes where.

I believe that a zha device handler file can simply be dropped into the zigpy quirks python library, and referenced, and then it should “just work”.

That’s my understanding so far, I could be giving you bad information, and happy to be corrected

Hopefully someone can clear this up for me.

My devices have non standard address in a few clusters. From memory, in the 702 cluster i have 0xe11a, 0xe11d, etc. In the device specific cluster it’s a few more in the 0xe*** range rather then 0xf*** range.
I have all the clusters and addresses in a tech doc.

I had a look in the zigpy-homeassistant files and as expected nothing is set for the addresses I need.

My question,
Is making the device handler enough, or do I need add the addresses to zigpy as well?

You should be able to do everything you need with a device handler in zha quirks. You should extend the CustomCluster to handle any metering logic and replace the existing metering cluster Id with the standard metering cluster (0x0702). From there, as long as your logic updates the correct attribute, the usage will show in ha. I’d browse through the quirks in the github repo and see if anything is close.

One note, if you are like me and don’t have a separate dev environment, you will need to watch out for ha replacing your code, when it starts it installs any required python packages and if you have installed a custom version of zha quirks, it will be replaced unless you use the skip-pip flag.

hi i am trying to edit / test a quirk but the add-ons will pull from git and override my edits…how do you use the ski-pip flag ?

I use a custom quirk, installed using Portainer. It is only replaced on HA update, not restarts. So I just re-install it after an update.

Exactly, any changes/additions should first be implemented in upstream zha-device-handlers and zigpy.

https://www.home-assistant.io/integrations/zha/#zha-exception-and-deviation-handling

https://github.com/zigpy/zha-device-handlers

https://github.com/zigpy/zigpy

Once support already exist in upstreams libraries then then it can be added to downstream ZHA in HA.

Best to post any new questions as an issue zha-device-handlers

https://github.com/zigpy/zha-device-handlers/issues

If it can not be answered there then the zigpy developers can transfer that issue to zigpy

https://github.com/zigpy/zigpy/issues/

If you are still unsure then could post related development querstions to zigpy discussions here:

https://github.com/zigpy/zigpy/discussions