Skip to content

Commit

Permalink
Improve WebSocket logging and error handling (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffSteinbok authored Jun 29, 2023
1 parent 63447f9 commit c9d5b6d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions custom_components/dreo/pydreo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,14 @@ async def _ws_ping_handler(self, ws) :

def _ws_consume_message(self, message) :
messageDeviceSn = message["devicesn"]
device : PyDreoBaseDevice = self._deviceListBySn[messageDeviceSn]
device.handle_server_update_base(message)

if (messageDeviceSn in self._deviceListBySn):
device = self._deviceListBySn[messageDeviceSn]
device.handle_server_update_base(message)
else:
# Message is to an unknown device, log it out just in case...
_LOGGER.debug("Received message for unknown or unsupported device. SN: {0}".format(messageDeviceSn))
_LOGGER.debug("Message: {0}".format(message))

def send_command(self, device : PyDreoBaseDevice, params):
fullParams = {
Expand Down

0 comments on commit c9d5b6d

Please sign in to comment.