Fix for errors after refactoring of api

### Fix
* Changes to stop errors after refactoring pyowletapi
This commit is contained in:
RyanClark123
2025-04-11 13:50:59 +01:00
parent 268365ccd4
commit 6b343a76ca
5 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -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"]}
)
+1 -2
View File
@@ -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}
)
+1 -1
View File
@@ -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"]},
+1 -1
View File
@@ -11,5 +11,5 @@
"requirements": [
"pyowletapi==2025.4.0"
],
"version": "2025.4.0"
"version": "2025.4.1"
}