Roba1993 / rzw

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

SWITCH_MULTILEVEL report maybe expecting too many bytes? #13

Closed youngmit closed 4 years ago

youngmit commented 4 years ago

I am getting issues trying to poll the status of a multi-level switch. I am getting: Some(Err(Error { kind: UnknownZWave, description: "Message is to short: [0, 4, 3, 32, 3, 50]" })) (message contents added to the error value by me).

I am just getting started with the z-wave protocol, so maybe I don't fully understand, but my interpretation of that message is: [not really sure what the 0 is, but everything seems to have one] [nodeID] [length of rest of message] [command class] [command] [data]. The length seems to agree with the rest of the data, and 50 is indeed the level that the switch should be at. What is the 7th bit that rzw is expecting circa https://github.com/Roba1993/rzw/blob/a0b08c56aed0c10ce6c068f8b060e52b97d05681/src/cmds/switch_multilevel.rs#L49

Am I missing something? Should it only be expecting 6 bytes?

Thanks for any guidance!

Roba1993 commented 4 years ago

Hi @youngmit

this looks like a bug coming from one of the last commits. Previously it was like that

// the message need to be exact 6 digits long
if msg.len() != 6 {
    return Err(Error::new(ErrorKind::UnknownZWave, "Message is to short"));
}

now it's like: https://github.com/Roba1993/rzw/blob/a0b08c56aed0c10ce6c068f8b060e52b97d05681/src/cmds/switch_multilevel.rs#L49

So try to change it back that only 6 bytes are needed and it should work.

Thanks, Robert

youngmit commented 4 years ago

Okay, thanks. I'll submit a PR tonight.

youngmit commented 4 years ago

See #14

Roba1993 commented 4 years ago

Closed with #14 - Thank you very much!