Skip to content

Commit

Permalink
Merge pull request #136 from fliphess/patch-1
Browse files Browse the repository at this point in the history
Fix KeyError in z2m integration
  • Loading branch information
xaviml committed Sep 19, 2020
2 parents 0bd4a53 + a6f45cd commit b9cc917
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/controllerx/cx_core/integration/z2m.py
Expand Up @@ -41,7 +41,7 @@ async def event_callback(self, event_name: str, data: dict, kwargs: dict) -> Non
if "payload" not in data:
return
payload = json.loads(data["payload"])
if action_key not in data["payload"]:
if action_key not in payload:
self.controller.log(
f"⚠️ There is no `{action_key}` in the MQTT topic payload",
level="WARNING",
Expand Down
1 change: 1 addition & 0 deletions tests/cx_core/integration/z2m_test.py
Expand Up @@ -11,6 +11,7 @@
({}, None, False, Any),
({"payload": '{"action": "action_1"}'}, None, True, "action_1"),
({"payload": '{"event_1": "action_1"}'}, "event_2", False, Any),
({"payload": '{"action_rate": 195}'}, "action", False, Any),
],
)
@pytest.mark.asyncio
Expand Down

0 comments on commit b9cc917

Please sign in to comment.