Fix connection issues with withings API by switching to a maintained codebase (#27310)

* Fixing connection issues with withings API by switching to a maintained client codebase.

* Updating requirements files.

* Adding withings api to requirements script.
This commit is contained in:
Robert Van Gorkom 2019-10-08 11:14:52 -07:00 committed by Bram Kragten
parent d97943575a
commit a57642833b
10 changed files with 131 additions and 118 deletions

View file

@ -1,7 +1,7 @@
"""Common data for for the withings component tests."""
import time
import nokia
import withings_api as withings
import homeassistant.components.withings.const as const
@ -92,7 +92,7 @@ def new_measure(type_str, value, unit):
}
def nokia_sleep_response(states):
def withings_sleep_response(states):
"""Create a sleep response based on states."""
data = []
for state in states:
@ -104,10 +104,10 @@ def nokia_sleep_response(states):
)
)
return nokia.NokiaSleep(new_sleep_data("aa", data))
return withings.WithingsSleep(new_sleep_data("aa", data))
NOKIA_MEASURES_RESPONSE = nokia.NokiaMeasures(
WITHINGS_MEASURES_RESPONSE = withings.WithingsMeasures(
{
"updatetime": "",
"timezone": "",
@ -174,7 +174,7 @@ NOKIA_MEASURES_RESPONSE = nokia.NokiaMeasures(
)
NOKIA_SLEEP_RESPONSE = nokia_sleep_response(
WITHINGS_SLEEP_RESPONSE = withings_sleep_response(
[
const.MEASURE_TYPE_SLEEP_STATE_AWAKE,
const.MEASURE_TYPE_SLEEP_STATE_LIGHT,
@ -183,7 +183,7 @@ NOKIA_SLEEP_RESPONSE = nokia_sleep_response(
]
)
NOKIA_SLEEP_SUMMARY_RESPONSE = nokia.NokiaSleepSummary(
WITHINGS_SLEEP_SUMMARY_RESPONSE = withings.WithingsSleepSummary(
{
"series": [
new_sleep_summary(