Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quirk not working #1

Open
Sonusss opened this issue Sep 26, 2021 · 6 comments
Open

Quirk not working #1

Sonusss opened this issue Sep 26, 2021 · 6 comments

Comments

@Sonusss
Copy link

Sonusss commented Sep 26, 2021

Hi,

I'm trying to duplicate exactly your setup as a base for my own development but no success.
ptvo.switch is only recognized as basic switch.

image

I placed the ptvo.py file at right place: /usr/local/lib/python3.9/site-packages/zhaquirks/
deleted pycache
restarted
No error in logs

Can you help ?

@glcos
Copy link
Owner

glcos commented Sep 26, 2021

Custom quirks have to go into a specific folder.
Try to create a folder such as /home/homeassistant/custom_zha_quirks/ptvo and put the file ptvo.py there.
Then you need to declare this path in configuration.yaml

zha:
  custom_quirks_path: /home/homeassistant/custom_zha_quirks/

Restart Home Assistant, remove your device and redo the pairing.
You should see in the log that HA is using the custom quirk for the PTVO device.

You might want to enable debug log by inserting these statements in configuration.yaml

logger:
  default: warning
  logs:
    homeassistant.components.zha: debug
    bellows.zigbee.application: debug
    zigpy.zcl: debug
    zhaquirks: debug
    ptvo: debug

You should then see something like this as a confirmation that HA is actually using the new quirk:

2021-06-30 13:35:05 DEBUG (MainThread) [zhaquirks] Loading custom quirks from /home/homeassistant/custom_zha_quirks
2021-06-30 13:35:05 DEBUG (MainThread) [zhaquirks] Loading custom quirks module ptvo

@Sonusss
Copy link
Author

Sonusss commented Sep 27, 2021

Hi,

Thank you for your help.
I did what you explained and I see that the quirk is well loaded.

2021-09-27 12:48:23 DEBUG (MainThread) [zhaquirks] Loading custom quirks from /config/custom_zha_quirks
2021-09-27 12:48:23 DEBUG (MainThread) [zhaquirks] Loading custom quirks module ptvo

But still the same situation...

I have found this in the logs:
2021-09-27 12:55:13 DEBUG (MainThread) [zigpy.quirks.registry] Checking quirks for ptvo.info ptvo.switch (00:12:4b:00:21:15:33:60)
2021-09-27 12:55:13 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class 'ptvo.ptvoTemperature'>
2021-09-27 12:55:13 DEBUG (MainThread) [zigpy.quirks.registry] Fail because device_type mismatch on at least one endpoint

I'm using HA 2021.9.6

@Sonusss
Copy link
Author

Sonusss commented Sep 28, 2021

Maybe I found something weird in logs:
[zigpy.endpoint] [0x6603:1] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=65534, device_version=0, input_clusters=[0, 2821, 6], output_clusters=[0, 6, 18])
[zigpy.endpoint] [0x6603:2] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=2, profile=260, device_type=65534, device_version=0, input_clusters=[12], output_clusters=[])

As far as I understand I think there should be only one endpoint.
(I'm sure the have flashed the MCU as Endpoint without routing)

@glcos
Copy link
Owner

glcos commented Sep 28, 2021

Having two endpoints it's ok and does not relate to your device being an endpoint or a router.
It looks like your device is sending an extra object on endpoint 1 output_clusters, that's why the quirk signature is not being recognized by Home Assistant and you are getting this error in the log:

2021-09-27 12:55:13 DEBUG (MainThread) [zigpy.quirks.registry] Fail because device_type mismatch on at least one endpoint

your device is sending output_clusters=[0, 6, 18]) on endpoint 1
my device is sending output_clusters=[0, 6]) on endpoint 1

If you look at the quirk code you will see that it expects only two objects on endpont 1 output_clusters.

There might be at least two reasons for that:

  1. the configuration that you specified in the PTVO firmware GUI is not exactly the same as mine
  2. you have a newer version of the PTVO firmware that is sending an extra object

I suggest you to have a look at this
https://github.com/zigpy/zha-device-handlers
and try to modify the quirk code yourself to match what your device is sending.
Unfortunately I don't have extra hardware available to test myself.

To confirm that your device is actually sending temperature and humidity values check your log for these lines:

[zigpy.zcl] [0x959f:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=3 command_id=Command.Report_Attributes>
[zigpy.zcl] [0x959f:1:0x0006] ZCL request 0x000a: [[Attribute(attrid=0, value=<TypeValue type=Bool, value=Bool.false>)]]
[zigpy.zcl] [0x959f:1:0x0006] Attribute report received: on_off=0
[zigpy.zcl] [0x959f:2:0x000c] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=4 command_id=Command.Report_Attributes>
[zigpy.zcl] [0x959f:2:0x000c] ZCL request 0x000a: [[Attribute(attrid=85, value=<TypeValue type=Single, value=28.200000762939453>), Attribute(attrid=111, value=<TypeValue type=bitmap8, value=bitmap8.16|8|4|2>), Attribute(attrid=28, value=<TypeValue type=CharacterString, value=C>)]]
[zigpy.zcl] [0x959f:2:0x000c] Attribute report received: present_value=28.200000762939453, status_flags=30, description=C
[zigpy.zcl] [0x959f:2:0x000c] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=5 command_id=Command.Report_Attributes>
[zigpy.zcl] [0x959f:2:0x000c] ZCL request 0x000a: [[Attribute(attrid=85, value=<TypeValue type=Single, value=58.20000076293945>), Attribute(attrid=111, value=<TypeValue type=bitmap8, value=bitmap8.16|8|4|2>), Attribute(attrid=28, value=<TypeValue type=CharacterString, value=%>)]]
[zigpy.zcl] [0x959f:2:0x000c] Attribute report received: present_value=58.20000076293945, status_flags=30, description=%

@Sonusss
Copy link
Author

Sonusss commented Oct 4, 2021

Hi,
Finally I found an older version of PTVO (1.4.7.0) and it is working.
How can I handle this extra output_cluster sent by the new firmware ?

@glcos
Copy link
Owner

glcos commented Oct 4, 2021

Hi @Sonusss,
I'm glad that you eventually managed to make it working.
In the coming days I see if I can update the quirk to include the extra cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants