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 crash with Aqara S2 lock Koenkk/zigbee2mqtt#349 #2

Merged
merged 1 commit into from
Jul 3, 2019
Merged

Fix crash with Aqara S2 lock Koenkk/zigbee2mqtt#349 #2

merged 1 commit into from
Jul 3, 2019

Conversation

dzungpv
Copy link
Contributor

@dzungpv dzungpv commented Jul 3, 2019

Fix issue: Koenkk/zigbee2mqtt#349 (comment)
This code need for the pull Koenkk/zigbee-herdsman-converters#497
@Koenkk I make less change to zcl-packet, i also test it not affect exist device support in zigbee-shepherd-converters, it only crash with Aqara S2 doorlock and struct-string data of Xiaomi, atribute id: 65281 so i whitelist only Xiaomi lock from this code.

@Koenkk
Copy link
Owner

Koenkk commented Jul 3, 2019

Thanks!

@Koenkk Koenkk merged commit b2fa80f into Koenkk:master Jul 3, 2019
@Koenkk
Copy link
Owner

Koenkk commented Jul 10, 2019

Unfortunately I have to revert this as it's causing issues (Koenkk/zigbee2mqtt#1710).

I've checked the code again but it doesn't make sense to me,

var deviceId = zclId.device(260, 10).key; always evaluates to doorLock, therefore the if (attrId === 65281&&deviceId!=='doorLock') { will always evaluate to false. Can you check how to fix this?

@dzungpv
Copy link
Contributor Author

dzungpv commented Jul 10, 2019

@Koenkk i will check this, but with xiaomi struct decode it will crash with some devices, i remember the author of those code said that we must let the decode without xiaomi struct and then apply it with specific device later, because it again the standard. Example we can apply those code for devices in zigbee seppherd conveter only, after convert ascii string back to hex, so it will never crash

@dzungpv
Copy link
Contributor Author

dzungpv commented Jul 11, 2019

@Koenkk We can replace function ru.clause('xiaoMiStruct', function (name) with those code in the zigbee-shepherd-converters: https://github.com/TedTolboom/com.xiaomi-mi-zigbee/blob/e7a7ac0e9ec4129cefabc5d2fba82e939f09529e/drivers/sensor_magnet.aq2/device.js#L65

@Koenkk
Copy link
Owner

Koenkk commented Jul 11, 2019

Can you make a pr and test?

@dzungpv
Copy link
Contributor Author

dzungpv commented Jul 11, 2019

@Koenkk Yes, i will test it with some Xiaomi devices.
Koenkk/zigbee-herdsman-converters#514
#8

@dzungpv
Copy link
Contributor Author

dzungpv commented Jul 11, 2019

@Koenkk i tested the code but for some data it not decode like original "xiaoMiStruct" (example voltage, power usage of xiaomi plug not decode) function here:

ru.clause('xiaoMiStruct', function (name) {

I am not very good at nodejs or Javascript, you can convert it to normal function and add it to zigbee-shepherd-converters parseData function? I wrote here https://github.com/dzungpv/zigbee-shepherd-converters/blob/6c3ab10f2e1fa022f6f94452b222a23f0dffda5c/converters/fromZigbee.js#L7

If we can move it here, it will fix the bug with Aqara S2 Lock and other undecode data, because those data is original string in Zigbee standard Xiaomi use to encode their data

Koenkk pushed a commit that referenced this pull request Apr 27, 2023
* Refactor: PendingRequest to class, make ZclFrame accessible from Endpoint

* make pendingRequests a set; add sendPolicies with defaults

* Remove unused "Mutable" type

* move Request to helpers/request.ts
nathanfiscus pushed a commit to nathanfiscus/zigbee-herdsman that referenced this pull request Oct 15, 2023
Update parameters for VZM31-SN to camelCase
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