Skip to content

Commit

Permalink
Fix issue with tracking multiple accounts (#51)
Browse files Browse the repository at this point in the history
* Fix issue with tracking multiple accounts

* Re-add debug statement

* Revert key name change

* Another revert
  • Loading branch information
raman325 authored Jan 3, 2022
1 parent 001edd1 commit b2c1dfb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions custom_components/zoom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ def ensure_multiple_have_names(value: List[Dict[str, str]]) -> List[Dict[str, st

async def async_setup(hass: HomeAssistant, config: ConfigType):
"""Set up the Zoom component."""
hass.data.setdefault(DOMAIN, {}).setdefault(VERIFICATION_TOKENS, set())

if DOMAIN not in config:
return True

Expand All @@ -82,6 +80,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType):

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Zoom from a config entry."""
hass.data.setdefault(DOMAIN, {}).setdefault(VERIFICATION_TOKENS, set())
hass.data[DOMAIN].setdefault(entry.entry_id, {})
try:
implementation = (
Expand Down
3 changes: 1 addition & 2 deletions custom_components/zoom/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,8 @@ class ZoomAuthenticatedUserBinarySensor(ZoomBaseBinarySensor):
async def async_event_received(self, event: Event) -> None:
"""Update status if event received for this entity."""
status = event.data
token = status.pop("token", None)
if (
token == self._config_entry.data[CONF_VERIFICATION_TOKEN]
status["token"] == self._config_entry.data[CONF_VERIFICATION_TOKEN]
and status[ATTR_EVENT] == CONNECTIVITY_EVENT
and get_data_from_path(status, CONNECTIVITY_ID).lower() == self.id.lower()
):
Expand Down

0 comments on commit b2c1dfb

Please sign in to comment.