Skip to content

Commit

Permalink
Bumping pyowlet, reauth config entry fix
Browse files Browse the repository at this point in the history
#### Fix
* Bumping to pyowletapi 2023.5.24
* Reauthing now no longer re adds users' password to config entry
  • Loading branch information
ryanbdclark committed May 17, 2023
1 parent fa06157 commit 0cf3afe
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog

<!--next-version-placeholder-->
## 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
* 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))
Expand Down
9 changes: 3 additions & 6 deletions custom_components/owlet/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,9 @@ async def async_step_reauth_confirm(self, user_input=None):
try:
token = await owlet_api.authenticate()
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.reauth_entry, data={**entry_data, **user_input}
)
self.hass.config_entries.async_update_entry(
self.reauth_entry, data={**entry_data, **token}
)

await self.hass.config_entries.async_reload(self.reauth_entry.entry_id)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/owlet/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
SUPPORTED_VERSIONS = [3]
POLLING_INTERVAL = 5
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"}
4 changes: 2 additions & 2 deletions custom_components/owlet/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"homekit": {},
"iot_class": "cloud_polling",
"requirements": [
"pyowletapi==2023.5.23"
"pyowletapi==2023.5.24"
],
"version":"2023.5.2"
"version":"2023.5.3"
}
2 changes: 1 addition & 1 deletion custom_components/owlet/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,4 @@ def native_value(self):

@property
def options(self) -> list[str]:
return ["Awake", "Light Sleep", "Deep Sleep"]
return SLEEP_STATES.values()

0 comments on commit 0cf3afe

Please sign in to comment.