Skip to content

Commit

Permalink
Use async_get in favor of deprecated async_get_registry (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
natekspencer authored Jun 8, 2022
1 parent 09b11f0 commit 517dacc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion custom_components/vivint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
except (VivintSkyApiError, ClientResponseError, ClientConnectorError) as ex:
raise ConfigEntryNotReady(ex) from ex

dev_reg = await device_registry.async_get_registry(hass)
dev_reg = device_registry.async_get(hass)

@callback
def async_on_device_discovered(device: VivintDevice) -> None:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/vivint/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ async def async_alarm_arm_home(self, code: str | None = None) -> None:
"""Send arm home command."""
await self.device.arm_stay()

async def async_alarm_arm_away(self, cod: str | None = None) -> None:
async def async_alarm_arm_away(self, code: str | None = None) -> None:
"""Send arm away command."""
await self.device.arm_away()
4 changes: 1 addition & 3 deletions custom_components/vivint/device_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ async def async_get_vivint_device(
hass: HomeAssistant, device_id: str
) -> VivintDevice | None:
"""Get a Vivint device for the given device registry id."""
device_registry: DeviceRegistry = (
await hass.helpers.device_registry.async_get_registry()
)
device_registry: DeviceRegistry = hass.helpers.device_registry.async_get()
registry_device = device_registry.async_get(device_id)
identifier = list(list(registry_device.identifiers)[0])[1]
[panel_id, vivint_device_id] = [int(item) for item in identifier.split("-")]
Expand Down

0 comments on commit 517dacc

Please sign in to comment.