goToMain / libosdp

Implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol); provides a C library with support for C++, Rust and Python3
https://libosdp.sidcha.dev
Apache License 2.0
134 stars 71 forks source link

Confusing `temporary` flag in Python LED commands #79

Closed Tomcat-Engineering closed 2 years ago

Tomcat-Engineering commented 2 years ago

Describe the bug

Here is how you set the state of the LEDs temporarily:

control_panel.send_command(0, {"command": osdp.CMD_LED, ... "temporary": True})

However, this command also sets the state of the LEDs temporarily:

control_panel.send_command(0, {"command": osdp.CMD_LED, ... "temporary": False})

This is because the code is just looking for the existence of the temporary flag, not its value. Not sure whether this is intentional but it definitely caught me out and took me a couple of hours to figure out!

Expected behavior

Setting "temporary": False in an LED command updates the permanent state of the LEDs, not the temporary state.

Observed behavior

Setting "temporary": False in an LED command updates the temporary state of the LEDs, not the permanent state.

sidcha commented 2 years ago

Sorry about that. That is indeed wrong behaviour. Let me take a quick look.

sidcha commented 2 years ago

@Tomcat-Engineering, this issue should be resolved now. Please check and let me know.

Tomcat-Engineering commented 2 years ago

Thanks for the super-quick fix. Unfortunately I don't have any OSDP devices here right now so I'm unable to test it, but it looks like it should work! Many thanks.