Closed formatcla closed 5 years ago
Hi! During investigation I have found that server needs closing forced reading after each virtual_sync operation. Will try to inform server developers about such strange behavior. Cause you see for example now it is impossible to use virtual pin sync call for multiple pins at once (
But we can jump over the issue by adding forcing reading into connect_handler And using single pin sync request Please see new example how to do it: https://github.com/blynkkk/lib-python/blob/master/examples/09_sync_virtual_pin.py
Also pay attention that now you may use direct blynk.disconnect() call within KeyboardInterrupt Just place all needed logic into registered disconnect handler before
Thanks a lot for all these findings made by you.
Just let me know please if fix has solved the issue you have faced with.
The fix has solved the issue, thank you.
Can be closed
I designed an app with 4 "push" button (virtual pin assigned starting from V0 to V3) and 4 value display (V10 ... V13). I use virtual pins V10 ... V13 for storing "status" (color) of each button (V10 for button V0, V11 for button V1, ...) and I used value display just for debug. When I press a button (release event are ignored), the script changes the color of button I pressed and stores a value (depending on color) on the corresponding pin used for "status". I'd like to use virtual_sync with pins V10...V13 to restore "status" of buttons when starting the app (during connection event). I tried the script attached below, but virtual_sync fires only the first two times.
This is the version of software and hardware I used, I don't know if the strange behavior depends on it: Blynk App version: 2.27.5 Blynk server: Blynk Cloud Hardware: Raspberry Pi B rev2 S.O.: Linux raspberrypi 4.9.35 Python: ver. 2.7.9 and 3.4.2
Some logs:
script.py