Koenkk / zigbee-herdsman

A Node.js Zigbee library
MIT License
456 stars 277 forks source link

EZSP cleanup & fixes #906

Closed Nerivec closed 3 months ago

Nerivec commented 3 months ago

I was waiting for the new release to put out this one. It's mostly cleanup, but a few changes in behavior & fixes (below at the top).

I think I covered all the changes...

@kirovilya Let me know if you catch anything.

PS: After this is merged & available in dev branch, please report your observations in the EZSP Testing discussion.

Koenkk commented 3 months ago

Great progress!

@kirovilya let me know if this is OK for you

kirovilya commented 3 months ago

Very good! I like. But I won’t be able to check its functionality in the next few days...

Nerivec commented 3 months ago

@Koenkk Is the logger passed to the Adapter class viable to log to the tab/file instead of limiting everything to debug mode (off 99.9% of the time)? I couldn't find it being used much throughout herdsman, except in z-stack manager, I was wondering if it was actually hooked up upstream and could replace a plain console.log? Could use something a bit more flexible though, I think; to be able to use it in utility classes & such without passing that logger around like crazy.

Nerivec commented 3 months ago

Some more...

PS: I'm by no means a Jest expert, I'm sure the tests can be improved, but at least for now it's checking a few critical things. We'll definitely need some more... πŸ˜‰

Koenkk commented 3 months ago

@Nerivec for the logger we can do the same as in https://github.com/Koenkk/zigbee-herdsman-converters/commit/6c4475c4fd13fd4b6b069c90ecf1cfef071d5f96 + https://github.com/Koenkk/zigbee2mqtt/commit/f83709d96c4a98b2c5f34a2e06fe2ea26f9cb9d5

Nerivec commented 3 months ago

Sounds good. I'll let you do the base changes the way you see fit, and I'll update the EZSP part once it's done. Let's do that after this is merged though, if you end up removing the logger passed around in controller/adapter in favor of the new system, it will conflict with this. I'd prefer avoiding dealing with conflicts with such a large commit πŸ˜„

corporategoth commented 3 months ago

@Nerivec is this PR going to address https://github.com/Koenkk/zigbee-herdsman/issues/856 ?

Nerivec commented 3 months ago

Changes are all EZSP/UART-level (protocols handling), the rest is general cleanup. It doesn't change the Z2M-level logic. I'll post a reply in the original thread.

Koenkk commented 3 months ago

Since this PR might be a bit risky, I will wait until https://github.com/Koenkk/zigbee2mqtt/issues/21162 is fixed so that I can publish a new hotfix release.

Nerivec commented 3 months ago

If a hotfix is planned for release, then for sure, wait. I fully expect a couple of hotfixes to have to be done after this is merged in dev. So many setups to support...

Nerivec commented 3 months ago

@Koenkk I'm going to table this PR for now. I've been made aware of a couple of bugs affecting the current release version (EZSP only), that need fixing (this update doesn't solve them either... just my luck). I've identified one, a race condition (I guess it's running too fast now... πŸ˜„), but the second one remains a mystery at the moment, I don't want this pushed on top (or pushing on top of this) since it doesn't fix it and it's massive. Couldn't reproduce either in my limited test env, but definitely in the affected machine, so...

I'll come back to this if that's alright with you. I'll also walk it in smaller PRs, should be safer.

EDIT: Forgot to mention. Do you mind adding @serialport/binding-mock as a dev dep in herdsman in your next commit? I've been using it as mock serial to test EZSP locally, it avoids a lot of grunt work mocking everything by hand.

Koenkk commented 3 months ago

Do you mind adding @serialport/binding-mock as a dev dep in herdsman in your next commit?

No problem, would you like me to add it or will you add it in the next pr?

Nerivec commented 3 months ago

You can go ahead and do it. I'm still trying to fix that damn bug. πŸ˜…

Koenkk commented 3 months ago

Done!