Fix withings InvalidParamsException (#47975)
* Bump withings_api to 2.3.1 (fixes #47329) * Fix NotifyAppli calls to be compatible with withings_api 2.3.1 * Fix errors with withings_api 2.2+ using pydantic * Bump withings_api to 2.3.2
This commit is contained in:
parent
0097169dd3
commit
bbd98e196b
5 changed files with 8 additions and 10 deletions
|
@ -4,12 +4,12 @@ Support for the Withings API.
|
||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
"""
|
"""
|
||||||
import asyncio
|
import asyncio
|
||||||
from typing import Optional, cast
|
from typing import Optional
|
||||||
|
|
||||||
from aiohttp.web import Request, Response
|
from aiohttp.web import Request, Response
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from withings_api import WithingsAuth
|
from withings_api import WithingsAuth
|
||||||
from withings_api.common import NotifyAppli, enum_or_raise
|
from withings_api.common import NotifyAppli
|
||||||
|
|
||||||
from homeassistant.components import webhook
|
from homeassistant.components import webhook
|
||||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||||
|
@ -195,9 +195,7 @@ async def async_webhook_handler(
|
||||||
return json_message_response("Parameter appli not provided", message_code=20)
|
return json_message_response("Parameter appli not provided", message_code=20)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
appli = cast(
|
appli = NotifyAppli(int(params.getone("appli")))
|
||||||
NotifyAppli, enum_or_raise(int(params.getone("appli")), NotifyAppli)
|
|
||||||
)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return json_message_response("Invalid appli provided", message_code=21)
|
return json_message_response("Invalid appli provided", message_code=21)
|
||||||
|
|
||||||
|
|
|
@ -681,7 +681,7 @@ class DataManager:
|
||||||
)
|
)
|
||||||
|
|
||||||
# Determine what subscriptions need to be created.
|
# Determine what subscriptions need to be created.
|
||||||
ignored_applis = frozenset({NotifyAppli.USER})
|
ignored_applis = frozenset({NotifyAppli.USER, NotifyAppli.UNKNOWN})
|
||||||
to_add_applis = frozenset(
|
to_add_applis = frozenset(
|
||||||
[
|
[
|
||||||
appli
|
appli
|
||||||
|
@ -846,7 +846,7 @@ class DataManager:
|
||||||
data = serie.data
|
data = serie.data
|
||||||
|
|
||||||
for field in GetSleepSummaryField:
|
for field in GetSleepSummaryField:
|
||||||
raw_values[field].append(data._asdict()[field.value])
|
raw_values[field].append(dict(data)[field.value])
|
||||||
|
|
||||||
values: Dict[GetSleepSummaryField, float] = {}
|
values: Dict[GetSleepSummaryField, float] = {}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "Withings",
|
"name": "Withings",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/withings",
|
"documentation": "https://www.home-assistant.io/integrations/withings",
|
||||||
"requirements": ["withings-api==2.1.6"],
|
"requirements": ["withings-api==2.3.2"],
|
||||||
"dependencies": ["http", "webhook"],
|
"dependencies": ["http", "webhook"],
|
||||||
"codeowners": ["@vangorra"]
|
"codeowners": ["@vangorra"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -2311,7 +2311,7 @@ wiffi==1.0.1
|
||||||
wirelesstagpy==0.4.1
|
wirelesstagpy==0.4.1
|
||||||
|
|
||||||
# homeassistant.components.withings
|
# homeassistant.components.withings
|
||||||
withings-api==2.1.6
|
withings-api==2.3.2
|
||||||
|
|
||||||
# homeassistant.components.wled
|
# homeassistant.components.wled
|
||||||
wled==0.4.4
|
wled==0.4.4
|
||||||
|
|
|
@ -1187,7 +1187,7 @@ watchdog==1.0.2
|
||||||
wiffi==1.0.1
|
wiffi==1.0.1
|
||||||
|
|
||||||
# homeassistant.components.withings
|
# homeassistant.components.withings
|
||||||
withings-api==2.1.6
|
withings-api==2.3.2
|
||||||
|
|
||||||
# homeassistant.components.wled
|
# homeassistant.components.wled
|
||||||
wled==0.4.4
|
wled==0.4.4
|
||||||
|
|
Loading…
Add table
Reference in a new issue