Hi Fellow Blynk’ers
I am busy working on a temperature management device and appear to have hit a snag, so firstly let me add what has already been actioned:
Overview
Hardware: ESP32-WROOM-32 (Eval Kit for now)
uPython Version: esp32-20210902-v1.17
Blynk Library: 1.2 (see notes for link to Volodymyr Shymanskyy Library which is Ver 1.0)
Platform: Blynk Server
- Started the project on the old Blynk version and was close to commercialising the product when the new version was released.
- I started with the basics offered by Volodymyr Shymanskyy ( https://github.com/vshymanskyy/blynk-library-python/blob/master/BlynkLib.py )
- I worked through the docs and examples and have amended and adjusted this base code to a more robust solution and added a few features to assist with commercialisation. One of the features I added was the “ACK” check option from the server.
- The ACK function - Push data to the platform (virtual write for now) and then check the response from the platform (usually “200”) so that confirmation is received to ensure data is transferred.
I have reviewed the uPython version (and upgraded) on the ESP32 as well as have tested on 5. different devices (hardware) and am receiving the same issue. - This issue appears to be more recent (last 2-3 weeks) as I keep getting disconnects.
- I did review the “Post Rule” of no more than 20 messages per second (or along those lines), so have eliminated this option.
- The main application has completed +/- 80 000 cycles with 5-9 disconnects (this is bad as the old version was 1 in 800 000 cycles), so the platform and mobile apps appear to be ok regarding the “virtual pin” set up.
- Also tried the various server locations and this did not help either.
- Looked around over the last 2-3 weeks to see any online docs ( and various forums) covering the server side responses, but with no luck
So here I am
Blynk User Interfacing:
- Blynk Platform for management usage.
- Mobile phones: Samsung (android) and Apple
- All 3 these are working well.
Routine basics (for understanding):
- data is compiled to the binary string and correct format.
- Data pack is pushed to the Blynk server
- The “process” routine can have data passed to it or if no data passed it will read from the receive buffer. This read is managed in a loop with maximum 2 second delay before it exits.
- if data is found during the loop it will jump out an then process accordingly through a series of “if” statements
The Issue (Debug Log below):
- When the device connects and authenticates I get the “200” response.
- When I update (Input 1 in this case) 2 parameters are updated
a. The colour property
b. The input state (ON/OFF) - When I update the property (colour) I get the “200” reply
- When I update the Input status I don’t get the “200” reply
DEBUG Trace:
Login
(Note: “xxxxx” is where the actual token is)
Push to platform
—> Blynk Log: Connect: Last Received: 16609 :: Last Send: 0 :: Last Ping: 0
—> Blynk Log: Login: Token: xxxxxxxxxxxxxxxxxxxx
—> Blynk Log: > Sending CMD: 29
—> Blynk Log: > Sending ARGS: xxxxxxxxxxxxxxxxxxxx
—> Blynk Log: > Sending KWARGS:
—> Blynk Log: > Sending ID: 1
—> Blynk Log: > Outbound Data Packet CMD: 29, ID: 1, Data: xxxxxxxxxxxxxxxxxxxx
—> Blynk Log: > Outbound Data Packet: b’\x1d\x00\x01\x00 xxxxxxxxxxxxxxxxxxxx’
—> Blynk Log: > Outbound Data b’\x1d\x00\x01\x00 xxxxxxxxxxxxxxxxxxxx’
*Data packet sent and now enter the “process” routine, looking for ID and SUCCESS (200) *
—> Blynk Log: < Check For Data From Server
—> Blynk Log: < Server Data: b’\x00\x00\x01\x00\xc8’
This trace looks for the ID (matches send and receive ID’s) and the SUCCESS (200), if both are valid then data is transferred successfully.
—> Blynk Log: < Inbound Data Packet: CMD: 0, ID: 1,STA: 200
—> Blynk Log: < BIN Data: b’\x00\x00\x01\x00\xc8’
—> Blynk Log: < Server Acknowledge: CMD: 0 ID: 1
—> Blynk Log: Version Info: [‘ver’, ‘1.2.0’, ‘h-beat’, 50, ‘buff-in’, 1024, ‘dev’, ‘esp32 uPython’]
—> Blynk Log: > Sending CMD: 17
—> Blynk Log: > Sending ARGS: ver 1.2.0 h-beat 50 buff-in 1024 dev esp32 uPython
—> Blynk Log: > Sending KWARGS:
—> Blynk Log: > Sending ID: 2
—> Blynk Log: > Outbound Data Packet CMD: 17, ID: 2, Data: ver 1.2.0 h-beat 50 buff-in 1024 dev esp32 uPython
—> Blynk Log: > Outbound Data Packet: b’\x11\x00\x02\x002ver\x001.2.0\x00h-beat\x0050\x00buff-in\x001024\x00dev\x00esp32 uPython’
—> Blynk Log: > Outbound Data b’\x11\x00\x02\x002ver\x001.2.0\x00h-beat\x0050\x00buff-in\x001024\x00dev\x00esp32 uPython’
—> Blynk Log: < Check For Data From Server
—> Blynk Log: < Server Data: b’\x00\x00\x02\x00\xc8’
—> Blynk Log: < Inbound Data Packet: CMD: 0, ID: 2,STA: 200
—> Blynk Log: < BIN Data: b’\x00\x00\x02\x00\xc8’
—> Blynk Log: < Server Acknowledge: CMD: 0 ID: 2
This trace looks for the ID (matches send and receive ID’s) and the “200”, if both are valid then data is transferred successfully.
—> Blynk Log: < Server Upload Successful
Send Ping ( this works as required)
—> Blynk Log: > Sending CMD: 6
—> Blynk Log: > Sending ARGS:
—> Blynk Log: > Sending KWARGS:
—> Blynk Log: > Sending ID: 4
—> Blynk Log: > Outbound Data Packet CMD: 6, ID: 4, Data:
—> Blynk Log: > Outbound Data Packet: b’\x06\x00\x04\x00\x00’
—> Blynk Log: > Outbound Data b’\x06\x00\x04\x00\x00’
—> Blynk Log: < Check For Data From Server
—> Blynk Log: < Server Data: b’\x00\x00\x04\x00\xc8’
—> Blynk Log: < Inbound Data Packet: CMD: 0, ID: 4,STA: 200
—> Blynk Log: < BIN Data: b’\x00\x00\x04\x00\xc8’
—> Blynk Log: < Server Acknowledge: CMD: 0 ID: 4
—> Blynk Log: < Server Upload Successful
Issue starts from here
Update Terminal (App and Platform)
1 Second elapsed, sending data to the server
—> Blynk Log: > Sending CMD: 20
—> Blynk Log: > Sending ARGS: vw 0 —> Loop: 0 RST: 0
—> Blynk Log: > Sending KWARGS:
—> Blynk Log: > Sending ID: 6
—> Blynk Log: > Outbound Data Packet CMD: 20, ID: 6, Data: vw 0 —> Loop: 0 RST: 0
—> Blynk Log: > Outbound Data Packet: b’\x14\x00\x06\x00\x19vw\x000\x00—> Loop: 0 RST: 0\n’
—> Blynk Log: > Outbound Data b’\x14\x00\x06\x00\x19vw\x000\x00—> Loop: 0 RST: 0\n’
This waits a full 2 seconds and no “ACK” is received
—> Blynk Log: < Check For Data From Server
Switch IN 1 ON
—> Blynk Log: > Sending CMD: 20
—> Blynk Log: > Sending ARGS: vw 1 1
—> Blynk Log: > Sending KWARGS:
—> Blynk Log: > Sending ID: 11
—> Blynk Log: > Outbound Data Packet CMD: 20, ID: 11, Data: vw 1 1
—> Blynk Log: > Outbound Data Packet: b’\x14\x00\x0b\x00\x06vw\x001\x001’
—> Blynk Log: > Outbound Data b’\x14\x00\x0b\x00\x06vw\x001\x001’
—> Blynk Log: < Check For Data From Server
No data is received here when the “virtual write” is done
Update the colour property
—> Blynk Log: > Sending CMD: 19
—> Blynk Log: > Sending ARGS: 1 color #00FF00
—> Blynk Log: > Sending KWARGS:
—> Blynk Log: > Sending ID: 12
—> Blynk Log: > Outbound Data Packet CMD: 19, ID: 12, Data: 1 color #00FF00
—> Blynk Log: > Outbound Data Packet: b’\x13\x00\x0c\x00\x0f1\x00color\x00#00FF00’
—> Blynk Log: > Outbound Data b’\x13\x00\x0c\x00\x0f1\x00color\x00#00FF00’
—> Blynk Log: < Check For Data From Server
—> Blynk Log: < Server Data: b’\x00\x00\x0c\x00\xc8’
—> Blynk Log: < Inbound Data Packet: CMD: 0, ID: 12,STA: 200
—> Blynk Log: < BIN Data: b’\x00\x00\x0c\x00\xc8’
—> Blynk Log: < Server Acknowledge: CMD: 0 ID: 12
But here we have a successful payload transaction (this is executed immediately after the previous command
—> Blynk Log: < Server Upload Successful
Switch IN 1 OFF
Here I chanced the “loop” timer to 10 seconds and still nothing.
—> Blynk Log: > Sending CMD: 20
—> Blynk Log: > Sending ARGS: vw 1 0
—> Blynk Log: > Sending KWARGS:
—> Blynk Log: > Sending ID: 20
—> Blynk Log: > Outbound Data Packet CMD: 20, ID: 20, Data: vw 1 0
—> Blynk Log: > Outbound Data Packet: b’\x14\x00\x14\x00\x06vw\x001\x000’
—> Blynk Log: > Outbound Data b’\x14\x00\x14\x00\x06vw\x001\x000’
—> Blynk Log: < Check For Data From Server
So, I must be doing something wrong, if anyone can assist it would be great.