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

Revert "🎨 Improve quiet mode descriptions" #217

Merged
merged 1 commit into from
Jun 18, 2024
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
25 changes: 12 additions & 13 deletions custom_components/aquarea/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,17 +354,14 @@ def read_demandcontrol(value: str) -> Optional[int]:
def write_demandcontrol(value: int) -> str:
return str(value / 100 * (234 - 43) + 43)

QUIET_MODES = {
"4": "Scheduled",
"3": "Least power",
"2": "Even less power",
"1": "Less power",
"0": "Off"
}

def read_quiet_mode(value: str) -> str:
# values range from 0 to 4
return QUIET_MODES.get(value, value)
if value == "4":
return "Scheduled"
elif value == "0":
return "Off"
return value


def read_heatpump_model(value: str) -> str:
Expand All @@ -378,10 +375,12 @@ def read_solar_mode(value: str) -> str:


def write_quiet_mode(selected_value: str):
res = lookup_by_value(QUIET_MODES, selected_value)
if res is not None:
return int(res)
return int(selected_value)
if selected_value == "Off":
return 0
elif selected_value == "Scheduled":
return 4
else:
return int(selected_value)


def guess_shift_or_direct_and_clamp_min_max_values(
Expand Down Expand Up @@ -713,7 +712,7 @@ def build_selects(mqtt_prefix: str) -> list[HeishaMonSelectEntityDescription]:
entity_category=EntityCategory.CONFIG,
state=read_quiet_mode,
state_to_mqtt=write_quiet_mode,
options=list(QUIET_MODES.values()),
options=["Off", "1", "2", "3", "Scheduled"],
),
HeishaMonSelectEntityDescription(
heishamon_topic_id="SET4", # also corresponds to TOP17
Expand Down
Loading