Skip to content

Commit

Permalink
Fix key error upon missing node (#14460)
Browse files Browse the repository at this point in the history
* This is needed after gateway ready message generates an update while
  persistence is off, or while the gateway node hasn't been presented
  yet.
  • Loading branch information
MartinHjelmare authored and pvizeli committed May 14, 2018
1 parent cf44b77 commit 7562b41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions homeassistant/components/mysensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,9 @@ def mysensors_callback(msg):
_LOGGER.debug(
"Node update: node %s child %s", msg.node_id, msg.child_id)

child = msg.gateway.sensors[msg.node_id].children.get(msg.child_id)
if child is None:
try:
child = msg.gateway.sensors[msg.node_id].children[msg.child_id]
except KeyError:
_LOGGER.debug("Not a child update for node %s", msg.node_id)
return

Expand Down

0 comments on commit 7562b41

Please sign in to comment.