Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Restore previous COP behavior at rest #122

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions custom_components/aquarea/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def async_setup_entry(
description = MultiMQTTSensorEntityDescription(
unique_id=f"{config_entry.entry_id}-heishamon_cop",
key=f"{discovery_prefix}/cop",
name=f"COP",
name=f"Aquarea COP",
native_unit_of_measurement="x",
state_class=SensorStateClass.MEASUREMENT,
topics=[
Expand All @@ -124,12 +124,12 @@ def compute_cop(values) -> Optional[float]:
production = sum([el for el in values[0:3] if el is not None])
consumption = sum([el for el in values[3:6] if el is not None])
if consumption == 0:
return None
return 0
cop = production / consumption
if (
cop > 10
): # this value is obviously incorrect. We probably don't have all consumption
return None
): # this value is obviously incorrect. We probably don't have all consumption yet
return 0
return round(cop, 2)


Expand Down
Loading