vshymanskyy / blynk-library-python

Blynk library for Python. Works with Python 2, Python 3, MicroPython.
https://blynk.io/
MIT License
281 stars 97 forks source link

Triplicates messages for Text input widgets/ #45

Open kindmartin opened 4 years ago

kindmartin commented 4 years ago

Hi all here in this uPy Blynk community. I was doing a lot of debugging for one home automation project and finally, the conclusion is I found something estrange in this lib BlinkLib v0.2.1 running in ESP32 board. I found that if I use a text input widget, (i.e to enter a secret code to open a door in my project) this widget create 3 updates, when all other widget not. even using same virtual port for other widget, text input triplicates whereas let say button not.

running the script with log=print I get this when I just use a button

0 32 | 200 0 33 | 200 0 34 | 200 20 16892 | vw,63,1 Event: V63 -> ['1'] Event: V -> 63 ['1'] 20 16893 | vw,63,0 Event: V63 -> ['0'] Event: V -> 63 ['0']

that is ok as I press the button (v63 ->1) and then realease it (v63 -> 0) but entering a value in text input widget same virtual, I got this>

20 16895 | vw,63,1 Event: V63 -> ['1'] Event: V -> 63 ['1'] 20 16896 | vw,63,1 Event: V63 -> ['1'] Event: V -> 63 ['1'] 20 16897 | vw,63,1 Event: V63 -> ['1'] Event: V* -> 63 ['1']

< 6 35 | 0 35 | 200 < 6 36 | 0 36 | 200

in my code understanding this I had to block subsequent updates /messages after first. as a workaround. any hints to clean up?

thanks, greeting from an in-quarentine home.

<M

kindmartin commented 4 years ago

doing some lib protocol / connect debug I saw one normal message when button at v63 and a triplicate long message from server when the updates comes not from a button widget but from a text input widget also on v63

button: self.bin -->>> b'\x14\x13\xb7\x00\x07vw\x0063\x001'

20 5047 | vw,63,1 Event Emit: V63 -> ['1']

text input:

self.bin -->>> b'\x14\x13\xc8\x00\x07vw\x0063\x001\x14\x13\xc9\x00\x07vw\x0063\x001\x14\x13\xca\x00\x07vw\x0063\x001'

20 5064 | vw,63,1 Event Emit: V63 -> ['1'] 20 5064 | vw,63,1 Event Emit: V63 -> ['1'] 20 5064 | vw,63,1 Event Emit: V63 -> ['1']