Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0141f7d01a | ||
|
|
dc58b19a46 | ||
|
|
bd6a315b00 | ||
|
|
0cf3afef85 | ||
|
|
fa06157fe2 |
17
CHANGELOG.md
17
CHANGELOG.md
@@ -1,12 +1,25 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
<!--next-version-placeholder-->
|
<!--next-version-placeholder-->
|
||||||
## 2023-05-2 (2023-05-16)
|
## 2023.05.5 (2023-05-19)
|
||||||
|
#### Fix
|
||||||
|
* Owlet refresh token becomes invalid after 24 hours. Meant that after 1 day the integration would stop working. Moved to pyowletapi v2023.5.28 which uses different refresh token, should no longer need reconfiguring after 24 hours
|
||||||
|
|
||||||
|
## 2023.05.4 (2023-05-17)
|
||||||
|
#### Fix
|
||||||
|
* Bumping to pyowletapi 2023.5.25
|
||||||
|
|
||||||
|
## 2023.05.3 (2023-05-17)
|
||||||
|
#### Fix
|
||||||
|
* Bumping to pyowletapi 2023.5.24
|
||||||
|
* Reauthing now no longer re adds users' password to config entry
|
||||||
|
|
||||||
|
## 2023.05.2 (2023-05-16)
|
||||||
#### Feature
|
#### Feature
|
||||||
* Integration now makes use of refresh token from pyowletapi to reauthenticate, user password in no longer stored by integration ([`dc710a1`](https://github.com/ryanbdclark/owlet/commit/dc710a1783a4cad9d6cf355240fe12ac779a87ef))
|
* Integration now makes use of refresh token from pyowletapi to reauthenticate, user password in no longer stored by integration ([`dc710a1`](https://github.com/ryanbdclark/owlet/commit/dc710a1783a4cad9d6cf355240fe12ac779a87ef))
|
||||||
* New sensors create for baby sleep state ([`9b3392b`](https://github.com/ryanbdclark/owlet/commit/9b3392bdbcd82015ed31d3a50a517e4e22905684))
|
* New sensors create for baby sleep state ([`9b3392b`](https://github.com/ryanbdclark/owlet/commit/9b3392bdbcd82015ed31d3a50a517e4e22905684))
|
||||||
|
|
||||||
## 2023-05-1 (2023-05-15)
|
## 2023.05.1 (2023-05-15)
|
||||||
#### Feature
|
#### Feature
|
||||||
* Changed versioning to date based
|
* Changed versioning to date based
|
||||||
### Fix
|
### Fix
|
||||||
|
|||||||
@@ -49,9 +49,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
if token:
|
if token:
|
||||||
hass.config_entries.async_update_entry(entry, data={**entry.data, **token})
|
hass.config_entries.async_update_entry(entry, data={**entry.data, **token})
|
||||||
|
|
||||||
|
devices = await owlet_api.get_devices(SUPPORTED_VERSIONS)
|
||||||
|
|
||||||
|
if devices["tokens"]:
|
||||||
|
hass.config_entries.async_update_entry(
|
||||||
|
entry, data={**entry.data, **devices["tokens"]}
|
||||||
|
)
|
||||||
|
|
||||||
socks = {
|
socks = {
|
||||||
device["device"]["dsn"]: Sock(owlet_api, device["device"])
|
device["device"]["dsn"]: Sock(owlet_api, device["device"])
|
||||||
for device in await owlet_api.get_devices(SUPPORTED_VERSIONS)
|
for device in devices["response"]
|
||||||
}
|
}
|
||||||
|
|
||||||
except OwletAuthenticationError as err:
|
except OwletAuthenticationError as err:
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ from .const import (
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
CONF_OWLET_EXPIRY,
|
CONF_OWLET_EXPIRY,
|
||||||
POLLING_INTERVAL,
|
POLLING_INTERVAL,
|
||||||
SUPPORTED_VERSIONS,
|
|
||||||
CONF_OWLET_REFRESH,
|
CONF_OWLET_REFRESH,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -70,9 +69,9 @@ class OwletConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
self._password = user_input[CONF_PASSWORD]
|
self._password = user_input[CONF_PASSWORD]
|
||||||
|
|
||||||
owlet_api = OwletAPI(
|
owlet_api = OwletAPI(
|
||||||
self._region,
|
region=self._region,
|
||||||
self._username,
|
user=self._username,
|
||||||
self._password,
|
password=self._password,
|
||||||
session=async_get_clientsession(self.hass),
|
session=async_get_clientsession(self.hass),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -82,7 +81,7 @@ class OwletConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
try:
|
try:
|
||||||
token = await owlet_api.authenticate()
|
token = await owlet_api.authenticate()
|
||||||
try:
|
try:
|
||||||
await owlet_api.get_devices(SUPPORTED_VERSIONS)
|
await owlet_api.validate_authentication()
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=self._username,
|
title=self._username,
|
||||||
data={
|
data={
|
||||||
@@ -138,11 +137,8 @@ class OwletConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
try:
|
try:
|
||||||
token = await owlet_api.authenticate()
|
token = await owlet_api.authenticate()
|
||||||
if token:
|
if token:
|
||||||
user_input[CONF_API_TOKEN] = token[CONF_API_TOKEN]
|
|
||||||
user_input[CONF_OWLET_EXPIRY] = token[CONF_OWLET_EXPIRY]
|
|
||||||
user_input[CONF_OWLET_REFRESH] = token[CONF_OWLET_REFRESH]
|
|
||||||
self.hass.config_entries.async_update_entry(
|
self.hass.config_entries.async_update_entry(
|
||||||
self.reauth_entry, data={**entry_data, **user_input}
|
self.reauth_entry, data={**entry_data, **token}
|
||||||
)
|
)
|
||||||
|
|
||||||
await self.hass.config_entries.async_reload(self.reauth_entry.entry_id)
|
await self.hass.config_entries.async_reload(self.reauth_entry.entry_id)
|
||||||
|
|||||||
@@ -8,4 +8,4 @@ CONF_OWLET_REFRESH = "refresh"
|
|||||||
SUPPORTED_VERSIONS = [3]
|
SUPPORTED_VERSIONS = [3]
|
||||||
POLLING_INTERVAL = 5
|
POLLING_INTERVAL = 5
|
||||||
MANUFACTURER = "Owlet Baby Care"
|
MANUFACTURER = "Owlet Baby Care"
|
||||||
SLEEP_STATES = {1, "Awake", 8, "Light Sleep", 15, "Deep Sleep"}
|
SLEEP_STATES = {0: "Unknown", 1: "Awake", 8: "Light Sleep", 15: "Deep Sleep"}
|
||||||
|
|||||||
@@ -14,9 +14,8 @@ from pyowletapi.exceptions import (
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
from homeassistant.const import CONF_API_TOKEN
|
|
||||||
|
|
||||||
from .const import DOMAIN, MANUFACTURER, CONF_OWLET_EXPIRY, CONF_OWLET_REFRESH
|
from .const import DOMAIN, MANUFACTURER
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -50,17 +49,11 @@ class OwletCoordinator(DataUpdateCoordinator):
|
|||||||
async def _async_update_data(self) -> None:
|
async def _async_update_data(self) -> None:
|
||||||
"""Fetch the data from the device."""
|
"""Fetch the data from the device."""
|
||||||
try:
|
try:
|
||||||
await self.sock.update_properties()
|
properties = await self.sock.update_properties()
|
||||||
tokens = await self.sock.api.tokens_changed(
|
if properties["tokens"]:
|
||||||
{
|
|
||||||
CONF_API_TOKEN: self.config_entry.data[CONF_API_TOKEN],
|
|
||||||
CONF_OWLET_EXPIRY: self.config_entry.data[CONF_OWLET_EXPIRY],
|
|
||||||
CONF_OWLET_REFRESH: self.config_entry.data[CONF_OWLET_REFRESH],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
if tokens:
|
|
||||||
self.hass.config_entries.async_update_entry(
|
self.hass.config_entries.async_update_entry(
|
||||||
self.config_entry, data={**self.config_entry.data, **tokens}
|
self.config_entry,
|
||||||
|
data={**self.config_entry.data, **properties["tokens"]},
|
||||||
)
|
)
|
||||||
except (OwletError, OwletConnectionError, OwletAuthenticationError) as err:
|
except (OwletError, OwletConnectionError, OwletAuthenticationError) as err:
|
||||||
raise UpdateFailed(err) from err
|
raise UpdateFailed(err) from err
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"homekit": {},
|
"homekit": {},
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"pyowletapi==2023.5.23"
|
"pyowletapi==2023.5.28"
|
||||||
],
|
],
|
||||||
"version":"2023.5.2"
|
"version":"2023.5.5"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,4 +170,4 @@ class OwletSleepStateSensor(OwletBaseEntity, SensorEntity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def options(self) -> list[str]:
|
def options(self) -> list[str]:
|
||||||
return ["Awake", "Light Sleep", "Deep Sleep"]
|
return list(SLEEP_STATES.values())
|
||||||
|
|||||||
Reference in New Issue
Block a user