Skip to content

Commit

Permalink
✍️ improve for logging (#1493)
Browse files Browse the repository at this point in the history
  • Loading branch information
codyc1515 authored Feb 22, 2024
1 parent 139be19 commit 3a2ff42
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion custom_components/xiaomi_miot/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,12 @@ async def fetch_latest_message(self):
break
if not mls:
if not self._has_none_message:
_LOGGER.warning('Get xiaomi message for %s failed: %s', self.cloud.user_id, res)
# Only raise a warning if there was a failure obtaining the xiaomi message
# Otherwise, a warning will show anytime that there are simply no messages waiting
if res['code'] == 0 and res['message'] == 'ok':
_LOGGER.debug('Get xiaomi message for %s failed: %s', self.cloud.user_id, res)
else:
_LOGGER.warning('Get xiaomi message for %s failed: %s', self.cloud.user_id, res)
self._has_none_message = True
if msg:
await self.async_set_message(msg)
Expand Down

0 comments on commit 3a2ff42

Please sign in to comment.