Roba1993 / rzw

Rusty Z-Wave - A native Z-Wave library in Rust
MIT License
38 stars 12 forks source link

Incorrect number of bytes for basic report command? #15

Closed youngmit closed 4 years ago

youngmit commented 4 years ago

Looking at the specs, it seems that the basic report should be either 3 bytes (command class, command, value) or 5 bytes (command class, command, current value, target value, duration), depending on the version implemented.

In the code it expects 6. https://github.com/Roba1993/rzw/blob/a0b08c56aed0c10ce6c068f8b060e52b97d05681/src/cmds/basic.rs#L29

Is this a bug, or do I misunderstand?

Thanks!

Roba1993 commented 4 years ago

Hi @youngmit

yes it was also a bug - I fixed it with the last commit. I just deep dived into the code and I must say, in the last three years I learned a lot more about Rust... Some parts of the code have a really bad style.

Because I anyway redevelop my Home automation right now, I will spent some time now, to update this crate to a Rust 2018 edition and fix some flaws in the design.

youngmit commented 4 years ago

Yeah, I noticed that there were some peculiar parts of the crate. Let me know if there's anything I can do to help out.

Roba1993 commented 4 years ago

Yeah it's a mixture of 3-4 people committed code and tried to adopt it to their use-cases.

I'm analyzing right now the crate from the bottom to top. You can help here, to identify the critical sections if you want - 4 eyes are better then 2. Maybe we can also have a video session, to review it together.