if data:
msg_type, msg_id, msg_len = struct.unpack(HDR_FMT, data)
if msg_id == 0:
self._close('invalid msg id %d' % msg_id)
break
if msg_type == MSG_RSP:
if msg_id == self._last_hb_id:
self._last_hb_id = 0
elif msg_type == MSG_PING:
self._send(struct.pack(HDR_FMT, MSG_RSP, msg_id, STA_SUCCESS), True)
elif msg_type == MSG_HW or msg_type == MSG_BRIDGE:
data = self._recv(msg_len, MIN_SOCK_TO)
if data:
self._handle_hw(data)
else:
self._close('unknown message type %d' % msg_type)
break
You can see that if the msg_type is different from MSG_RSP, MSG_PING, MSG_HW , MSG_BRIDGE it will fail. So probably you were receiving a MSG_HW_INFO with id 17 and it closed.
The blynk server is sending a message with ID 17 to the python application and the application is reading it via socket but it cannot parse it correctly (probably a bug in the library). Why that message is sent is unknown to me
“”"
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
This example shows how to display custom data on the widget.
In your Blynk App project:
Add a Value Display widget,
bind it to Virtual Pin V2,
set the read frequency to 1 second.
Run the App (green triangle in the upper right corner).
It will automagically call v2_read_handler.
Calling virtual_write updates widget value.
“”"
import BlynkLib
import time
BLYNK_AUTH = ‘’
Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
Register virtual pin handler
@blynk.VIRTUAL_READ(2)
def v2_read_handler():
# This widget will show some time in seconds…
blynk.virtual_write(2, time.ticks_ms() // 1000)