Skip to content

Commit

Permalink
fix: ignore undefined piid and keep processing following arguments (#377
Browse files Browse the repository at this point in the history
)
  • Loading branch information
RangerCD authored Dec 24, 2024
1 parent 0f5da18 commit 7654e5e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/xiaomi_home/miot/miot_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1198,8 +1198,8 @@ def on_event_occurred(
def __on_event_occurred(self, params: dict, ctx: Any) -> None:
_LOGGER.debug('event occurred, %s', params)
trans_arg = {}
try:
for item in params['arguments']:
for item in params['arguments']:
try:
if 'value' not in item:
continue
if 'piid' in item:
Expand All @@ -1215,10 +1215,10 @@ def __on_event_occurred(self, params: dict, ctx: Any) -> None:
for index, prop in enumerate(self.spec.argument)
}
break
except KeyError as error:
_LOGGER.error(
'on event msg, invalid args, %s, %s, %s',
self.entity_id, params, error)
except KeyError as error:
_LOGGER.debug(
'on event msg, invalid args, %s, %s, %s',
self.entity_id, params, error)
self.on_event_occurred(
name=self.spec.description_trans, arguments=trans_arg)
self.async_write_ha_state()
Expand Down

0 comments on commit 7654e5e

Please sign in to comment.