Skip to content

Commit

Permalink
Fix unsubscribe()'s permanent KeyError (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmagyar committed Jun 17, 2024
1 parent 081e88b commit 5f6e326
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hass_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ async def subscribe(
def remove_listener():
self._subscriptions.pop(message_id)
# try to unsubscribe
if "subscribe" not in message_base["type"]:
if "subscribe" not in message_base["command"]:
return
unsub_command = message_base["type"].replace("subscribe", "unsubscribe")
unsub_command = message_base["command"].replace("subscribe", "unsubscribe")
asyncio.create_task(self.send_command_no_wait(unsub_command, subscription=message_id))

return remove_listener
Expand Down

0 comments on commit 5f6e326

Please sign in to comment.