Closed hnez closed 4 months ago
I've checked the other endpoints and think they are not affected by this.
I've also found the change in 9236c1d that removed the string to integer type conversion, which is a bit hidden in the diff: https://github.com/linux-automation/lxa-iobus/commit/9236c1d58edccb0a54e3911b52026c73fc5989db#r140859939, because the control flow changed.
The form encoded parameter
value
sent via POST request is parsed by aiohttp so it can be used in set_pin(). It is however passed in as string ("0", "1" or "toggle") so it will always be considered true-ish, resulting in the current implementation always turning the output on, even if "0" was requested.Treat the value as integer instead (as long as it is not "toggle") and check that for true-ish-ness.
Fixes: 9236c1d introduced in #38.
TODO before merging:
server.py
is sound.It is unclear why this worked previously, because there was no type conversion in the code that 9236c1d replaced.There was a type conversion. I just overlooked it in the diff.