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

Fix errors thrown by PTM 216Z GP commands without payload #7127

Merged
merged 3 commits into from
Feb 29, 2024

Conversation

Nerivec
Copy link
Contributor

@Nerivec Nerivec commented Feb 27, 2024

debug 2024-02-27 08:51:01: Received Zigbee message from '0x000000000155f47a', type 'commandNotification', cluster 'greenPower', data '{"commandFrame":{},"commandID":104,"frameCounter":971,"options":0,"payloadSize":0,"srcID":22410362}' from endpoint 242 with groupID 2948
info  2024-02-27 08:51:01: MQTT publish: topic 'zigbee2mqtt/0x000000000155f47a', payload '{"action":"internal_104","device":{"friendlyName":"0x000000000155f47a","ieeeAddr":"0x000000000155f47a","manufacturerID":null,"model":"PTM 216Z","networkAddress":62586,"type":"GreenPower"},"elapsed":104886,"linkquality":216}'
info  2024-02-27 08:51:01: MQTT publish: topic 'zigbee2mqtt/0x000000000155f47a', payload '{"action":"","device":{"friendlyName":"0x000000000155f47a","ieeeAddr":"0x000000000155f47a","manufacturerID":null,"model":"PTM 216Z","networkAddress":62586,"type":"GreenPower"},"linkquality":216}'
info  2024-02-27 08:51:01: MQTT publish: topic 'zigbee2mqtt/0x000000000155f47a/action', payload 'internal_104'

Credits to @dduransseau & @chris-1243 😉
Koenkk/zigbee2mqtt#21462 (comment)

@@ -3173,6 +3173,10 @@ const converters1 = {
if (hasAlreadyProcessedMessage(msg, model, msg.data.frameCounter, `${msg.device.ieeeAddr}_${commandID}`)) return;
if (commandID === 224) return;

if (!msg.data.commandFrame.raw) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this, can we change:

const ID = `${commandID}_${msg.data.commandFrame?.raw.slice(0, 1).join('_')}`; // added a ? here

And add it to the lookup?

'104_undefined': 'short_press_2_of_2'

Or alternatively, we change if (commandID === 224) return; to if (commandID === 224 || commandID == 104) return;, which is my preference as this only seems to be send once during pairing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know these GP devices enough to assume only 104 would create this error (the list of GP "non-specific" commands is long, "Short Press 1 of 2", "Short Press 1 of 1"...). That's why I went with a "global" solution; any command that doesn't have a payload would throw otherwise. Adding them all to the lookup when most devices probably only output two or three of these seems "overkill"...

Page 11-12 https://www.silabs.com/documents/public/user-guides/ug392-using-sl-green-power-with-ezp.pdf

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's just this giving the error I propose to add it, it's much more user friendly.

Copy link
Contributor Author

@Nerivec Nerivec Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add them all to the lookup you mean?

Would have to match with https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/src/devices/enocean.ts to be exposed to the user.

I'm just guessing, but I figure some manufacturers might have implemented the pairing procedure differently based on hardware, so, the device chris tested sends 104, but another one might send 102 - probably the whole 0x60-0x68 range is involved?).

0x60 Press 1 of 1 N/A
0x61 Release 1 of 1 N/A
0x62 Press 1 of 2 N/A
0x63 Release 1 of 2 N/A
0x64 Press 2 of 2 N/A
0x65 Release 2 of 2 N/A
0x66 Short Press 1 of 1 N/A
0x67 Short Press 1 of 2 N/A
0x68 Short Press 2 of 2 N/A

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code applies to just the PTM 216Z, so not sure what actions are send.

I've updated the PR

  • It will not give the error anymore, but log a PTM 216Z: missing command when there is no such command
  • Added short_press_2_of_2

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. This way users can report commands that log errors, and support can be added as needed.
Those 3 GP converters (215-216) cover lots of actual devices from what I've seen.

@Koenkk Koenkk merged commit bc0506c into Koenkk:master Feb 29, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Feb 29, 2024

Thanks!

@Nerivec Nerivec deleted the ptm216z branch February 29, 2024 17:40
lucasteligioridis added a commit to lucasteligioridis/zigbee-herdsman-converters that referenced this pull request Feb 29, 2024
…-converters

* 'master' of github.com:lucasteligioridis/zigbee-herdsman-converters:
  fix(detect): Detect `_TZE204_aagrxlbd` as TuYa TS0601_switch_4_gang_1 Koenkk#7133
  fix: Fix battery percentage doubled for ROBB ROB_200-025-0 Koenkk/zigbee2mqtt#21607
  feat: Enable LED indicator functionality for 41E10PBSWMZ-VW (Koenkk#7131)
  fix(detect): Detect `_TZ3000_4ugnzsli` as Luminea ZX-5232 (Koenkk#7136)
  fix: Fixes issue of passing function to TuYa lookup value converter (Koenkk#7135)
  feat: Add `short_press_2_of_2` action to EnOcean PTM 216Z (Koenkk#7127)
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

Successfully merging this pull request may close these issues.

2 participants