diff --git a/pyproject.toml b/pyproject.toml index 7879d70..cbbd604 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "flipr-api" -version = "1.4.3" +version = "1.4.4" description = "Python client for flipr API." authors = ["cnico"] license = "MIT" diff --git a/src/flipr_api/client.py b/src/flipr_api/client.py index 6fe0b53..4158f6f 100644 --- a/src/flipr_api/client.py +++ b/src/flipr_api/client.py @@ -119,7 +119,7 @@ def get_pool_measure_latest(self, flipr_id: str) -> Dict[str, Any]: "date_time": parse(json_resp["DateTime"]), "ph_status": json_resp["PH"]["DeviationSector"], "chlorine_status": json_resp["Desinfectant"]["DeviationSector"], - "battery": float(json_resp["Battery"]["Deviation"]), + "battery": float(json_resp["Battery"]["Deviation"] * 100), } def get_hub_state(self, hub_id: str) -> Dict[str, Any]: diff --git a/tests/test_client.py b/tests/test_client.py index 0e9d405..47f2015 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -190,7 +190,7 @@ def test_integration_simple(requests_mock) -> None: # type: ignore battery = data["battery"] print( - "Valeurs de la piscine : le {:s} temperature = {:.2f}, redox = {:.2f}, chlorine = {:.5f}, ph = {:.2f}, battery= {:.2f}".format( + "Valeurs de la piscine : le {:s} temperature = {:.2f}, redox = {:.2f}, chlorine = {:.5f}, ph = {:.2f}, battery = {:.2f}".format( date_time.strftime("%Y-%m-%d %H:%M:%S"), temperature, red_ox, @@ -205,7 +205,7 @@ def test_integration_simple(requests_mock) -> None: # type: ignore assert chlorine == 0.31986785186370315 assert ph == 7.01 assert date_time.strftime("%Y-%m-%d %H:%M:%S") == "2021-02-01 07:40:21" - assert battery == 0.75 + assert battery == 75 # Test hub id search list_hub = client.search_hub_ids() diff --git a/tests/test_integrations.py b/tests/test_integrations.py index d89d289..3bc9335 100644 --- a/tests/test_integrations.py +++ b/tests/test_integrations.py @@ -24,7 +24,7 @@ def test_integration_simple() -> None: data = client.get_pool_measure_latest(FLIPR_ID) print( - "Valeurs de la piscine : le {:s} temperature = {:.2f}, redox = {:.2f}, chlorine = {:.5f}, ph = {:.2f}, Alerte PH = {:s}, Alerte chlore = {:s}, Battery ={:.2f}".format( + "Valeurs de la piscine : le {:s} temperature = {:.2f}, redox = {:.2f}, chlorine = {:.5f}, ph = {:.2f}, Alerte PH = {:s}, Alerte chlore = {:s}, Battery = {:.2f}".format( data["date_time"].strftime("%Y-%m-%d %H:%M:%S"), data["temperature"], data["red_ox"],