Skip to content

Commit

Permalink
Correction pourcentage pour affichage correct dans homeassistant.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnico committed Nov 1, 2022
1 parent 868ab45 commit cbcd577
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/flipr_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit cbcd577

Please sign in to comment.