Fix for errors after refactoring of api
### Fix * Changes to stop errors after refactoring pyowletapi
This commit is contained in:
@@ -68,7 +68,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
_LOGGER.error("No owlet devices found to set up")
|
||||
return False
|
||||
|
||||
if devices["tokens"]:
|
||||
if "tokens" in devices:
|
||||
hass.config_entries.async_update_entry(
|
||||
entry, data={**entry.data, **devices["tokens"]}
|
||||
)
|
||||
|
||||
@@ -125,8 +125,7 @@ class OwletConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
session=async_get_clientsession(self.hass),
|
||||
)
|
||||
try:
|
||||
token = await owlet_api.authenticate()
|
||||
if token:
|
||||
if token := await owlet_api.authenticate():
|
||||
self.hass.config_entries.async_update_entry(
|
||||
self.reauth_entry, data={**entry_data, **token}
|
||||
)
|
||||
|
||||
@@ -42,7 +42,7 @@ class OwletCoordinator(DataUpdateCoordinator):
|
||||
"""Fetch the data from the device."""
|
||||
try:
|
||||
properties = await self.sock.update_properties()
|
||||
if properties["tokens"]:
|
||||
if "tokens" in properties:
|
||||
self.hass.config_entries.async_update_entry(
|
||||
self.config_entry,
|
||||
data={**self.config_entry.data, **properties["tokens"]},
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
"requirements": [
|
||||
"pyowletapi==2025.4.0"
|
||||
],
|
||||
"version": "2025.4.0"
|
||||
"version": "2025.4.1"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user