-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
#21072 Match endpoint name in the mqtt topic based on endpoints listed in the converter #21214
#21072 Match endpoint name in the mqtt topic based on endpoints listed in the converter #21214
Conversation
Looks good! Could we also get rid of Line 33 in fdc9f7d
|
I think this is possible. But do you think it worth doing that in a single PR? I did a quick look, and this list is used in 4-5 places across the code. Some are easy to fix, other will require some work, and probably additional changes accross the codebase. |
I'm fine with doing it in a separate pr. I will release a hotfix z2m release soon and will merge this PR after that. |
Thanks. FYI: another PR on getting rid of endpointNames. It is independent of this PR, and can be merged in any order. |
Since this PR is waiting to be merged anyway, I did a small additional change on the same topic. It was reasonable to make it based on this PR change, rather than separately. Please take a look before merging. |
Thanks! |
I discovered that the logic for working with endpoints has changed here. For example, like here https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/src/devices/tuya.ts#L1745 Reason - the corresponding endpoint names were not found in the list https://github.com/Koenkk/zigbee2mqtt/blob/dev/lib/extension/publish.ts#L199 - for such Tuya-devices, there is one last endpoint ['l4']. |
Thanks for reporting, I think I understand the issue. |
Original issue report: #21072
Problem: Zigbee2mqtt uses predefined endpoint names list when matching mqtt topic name or mqtt message payload. If a device is using a non-standard endpoint name, mqtt messages sent to this endpoint are not recognized properly.
Fix: This change enables matching of mqtt topics and payload without using the predefined endpoints list. Instead it gets a list of endpoint names from the device definition's (converter).
The are 2 changes to make this happen:
device/name/with/slashes
anddevice/endpoint
.attribute_endpoint
-like payload involves collecting the list of device endpoint and matching the endpoint name according to that list.In addition to make tests happy, the following 3 changes were done:
state_center
from the device that does not havecenter
endpoint. Previous implementation treatedcenter
as endpoint name and displayedDevice 'wall_switch_double' has no endpoint 'center'
. As soon ascenter
endpoint is not stated on the endpoint list, the new code treatsstate_center
as an attribute name, and therefore the error message changes toNo converter available for 'state_center'
.if(localTarget == null)
block was removed - endpoint name shall be matched by the regexp above (which now matches only defined endpoint names), so getting endpoint by name shall always suceed.