elad-bar / ha-shinobi

Shinobi Video custom component for HA
53 stars 5 forks source link

TypeError: startswith first arg must be bytes or a tuple of bytes, not str #17

Closed meks007 closed 3 years ago

meks007 commented 3 years ago

Hi,

I have installed the shinobi integration and everything is working normally. I can see all preview images and watch all live feeds from HA.

There's one error though thats being logged every minute I think:

2021-09-27 16:05:20 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/shinobi/api/shinobi_websocket.py", line 163, in parse_message
    if message.startswith(SHINOBI_WS_CONNECTION_ESTABLISHED_MESSAGE):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

I have then disabled the call to parse_message() in shinobi_websocket.py / handle_next_message() and the error stopped. I do not see any negative result as all cameras are working normally:

if msg.data == "close":
    result = False
else:
    """self.hass.async_create_task(self.parse_message(msg.data))"""      <--- DISABLED
    result = True
elad-bar commented 3 years ago

Thanks for raising that issue, didn't encounter it too many times but it seems that one of the messages is being received with invalid string format that prevents is from being loaded, will look more into that later

elad-bar commented 3 years ago

fix available in v1.1.13