Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hass_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@ async def subscribe(
await self.send_command(**message_base, message_id=message_id)
self._subscriptions[message_id] = sub

def remove_listener():
async def remove_listener():
self._subscriptions.pop(message_id)
# try to unsubscribe
if "subscribe" not in message_base["type"]:
return
unsub_command = message_base["type"].replace("subscribe", "unsubscribe")
asyncio.create_task(self.send_command_no_wait(unsub_command, subscription=message_id))
await self.send_command(unsub_command, subscription=message_id)

return remove_listener

Expand Down