Page 1 of 1

Znet lite v2 @433MHz: transmit buffer

Posted: Fri Mar 17, 2023 9:45 am
by juhoroine
TL;DR: is there a way to flush or control the 433MHz command transmission buffer?


For example, let's say we have a 433MHz switch, that triggers a LUA script that switches on three lights (with separate 433MHZ commands).
This is what happens:

1. Switch event is received
2. LUA script fires and calls turnOn() for each light
3. Delay
4. First light signal gets transmitted
5. Delay
6. Second light signal gets transmitted
7. Delay
8. Third light signal gets transmitted

Because of the delays between the 433MHz events, it takes some time before all the signals are transmitted.

Now, consider that we pushed the ON button accidentially and press it again for OFF to cancel

1. Switch event (ON) is received
2. LUA script fires and calls turnOn() for each light
3. Switch event (OFF) is received
4. LUA script fires and calls turnOff() for each light
5. Delay
6. First light signal gets transmitted (ON)
7. Delay
8. Second light signal gets transmitted (ON)
9. Delay
10. Third light signal gets transmitted (ON)
11. Delay
12. First light signal gets transmitted (OFF)
13. Delay
14. Second light signal gets transmitted (OFF)
15. Delay
16. Third light signal gets transmitted (OFF)

Now, we already know that desired state for all the lights are OFF at step 6, when the first signal gets out, but the commands are already in the buffer waiting for transmission and lights get turned on unneccessarily. So, there should be a way to control the transmission buffer or some kind of "transmit-latest-state-only" -mechanism.
It is possible to build such a mechanism to the LUA-built "light program" layer, but would be better if it was already on the lower level.

Re: Znet lite v2 @433MHz: transmit buffer

Posted: Fri Mar 17, 2023 9:45 am
by micke.prag
Currently no such functionality. Feel free to look through the code and send us a patch (or preferably a merge request).