Skip to content

Commit

Permalink
refactor: reintroduced manual state fetching
Browse files Browse the repository at this point in the history
refactor: changed update coordinator to reference accounts not devices

refactor: replaced translations with references to core

refactor: removed more unnecessary imports

fix: added missing translation for ssl verification

fix: extrapolate utc offset to update timestamps not sent in state updates

fix: fixed failed commands not resetting entity attributes

chore: bump version number (v2023.6.2 -> v2023.6.3)
  • Loading branch information
alryaz committed Jun 26, 2023
1 parent 5cf1d5e commit 2ba224a
Show file tree
Hide file tree
Showing 11 changed files with 305 additions and 233 deletions.
25 changes: 11 additions & 14 deletions custom_components/pandora_cas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,27 +287,24 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
_LOGGER.error(f"Error updating vehicles: {error}", exc_info=error)
raise ConfigEntryNotReady(str(error)) from error

hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinators = {
device.device_id: PandoraCASUpdateCoordinator(hass, device=device)
for device in account.devices
}
hass.data.setdefault(DOMAIN, {})[
entry.entry_id
] = coordinator = PandoraCASUpdateCoordinator(hass, account=account)

# create account updater
async def _state_changes_listener(
device: PandoraOnlineDevice,
_: CurrentState,
new_state_values: Mapping[str, Any],
):
try:
coordinator: PandoraCASUpdateCoordinator = coordinators[
device.device_id
]
except KeyError:
_LOGGER.warning(
f"Received update for an unknown device {device.device_id}"
)
else:
coordinator.async_set_updated_data(new_state_values)
_LOGGER.debug(
f"Received WebSockets state update for "
f"device {device.device_id}: {new_state_values}"
)

coordinator.async_set_updated_data(
{device.device_id: new_state_values}
)

async def _command_execution_listener(
device: PandoraOnlineDevice,
Expand Down
Loading

0 comments on commit 2ba224a

Please sign in to comment.