Skip to content

Commit

Permalink
Improved logging printing
Browse files Browse the repository at this point in the history
  • Loading branch information
albertogeniola committed Jun 27, 2020
1 parent b9c6b83 commit 3f7e450
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions meross_iot/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ async def async_device_discovery(self, update_subdevice_status: bool = True,
:return:
"""
_LOGGER.info(f"\n\n------- Triggering HTTP discovery, filter_device: {meross_device_uuid} -------")
# List http devices
http_devices = await self._http_client.async_list_devices()

Expand Down Expand Up @@ -251,8 +252,7 @@ async def async_device_discovery(self, update_subdevice_status: bool = True,
if update_subdevice_status:
for h in hubs:
await h.async_update()
# TODO add result logging
_LOGGER.debug("HTTP async completed.")
_LOGGER.info(f"\n------- HTTP discovery ended -------\n")

async def _async_enroll_new_http_subdev(self,
subdevice_info: HttpSubdeviceInfo,
Expand Down Expand Up @@ -435,8 +435,10 @@ async def _async_dispatch_push_notification(self, push_notification: GenericPush

if len(target_devs) < 1:
_LOGGER.warning(
f"Received a push notification ({push_notification.namespace}) for device(s) ({target_devs}) that "
f"are not available in the local registry. Trigger a discovery to intercept thos events.")
f"Received a push notification ({push_notification.namespace}, "
f"raw_data: {json.dumps(push_notification.raw_data)}) for device(s) "
f"({push_notification.originating_device_uuid}) that "
f"are not available in the local registry. Trigger a discovery to intercept those events.")

if len(target_devs) > 0:
# Pass the control to the specific device implementation
Expand Down Expand Up @@ -490,7 +492,8 @@ async def _handle_and_dispatch_push_notification(self, push_notification: Generi
handled_post = await self._async_handle_push_notification_post_dispatching(push_notification=push_notification)

if not (handled_device or handled_post):
_LOGGER.warning(f"Uncaught push notification {push_notification.namespace}")
_LOGGER.warning(f"Uncaught push notification {push_notification.namespace}. "
f"Raw data: {json.dumps(push_notification.raw_data)}")

async def async_execute_cmd(self,
destination_device_uuid: str,
Expand Down

0 comments on commit 3f7e450

Please sign in to comment.