Skip to content

Commit

Permalink
Minor naming fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
klejejs committed Oct 13, 2024
1 parent 7b0de93 commit ca0589d
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions ThermiaOnlineAPI/model/HeatPump.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def __get_all_operational_statuses_from_operational_status(
if data is None:
return ChainMap()

operation_modes_map = map(
operation_statuses_map = map(
lambda values: {
values.get("value"): {
"name": values.get("name").split(
Expand All @@ -455,8 +455,8 @@ def __get_all_operational_statuses_from_operational_status(
data,
)

operation_modes_list = list(operation_modes_map)
return ChainMap(*operation_modes_list)
operation_statuses_list = list(operation_statuses_map)
return ChainMap(*operation_statuses_list)

def __get_all_visible_operational_statuses_from_operational_status(
self,
Expand All @@ -466,15 +466,17 @@ def __get_all_visible_operational_statuses_from_operational_status(
if data is None:
return ChainMap()

operation_modes_map = map(
operation_statuses_map = map(
lambda item: (
{item[0]: item[1].get("name")} if item[1].get("visible") else {}
),
data.items(),
)

operation_modes_list = list(filter(lambda x: x != {}, operation_modes_map))
return ChainMap(*operation_modes_list)
operation_statuses_list = list(
filter(lambda x: x != {}, operation_statuses_map)
)
return ChainMap(*operation_statuses_list)

def __get_running_operational_statuses(
self,
Expand Down Expand Up @@ -514,7 +516,7 @@ def __get_running_operational_statuses(
):
# Attempt to get multiple statuses by binary sum of the values
data_items_list.sort(key=lambda x: x[0], reverse=True)
list_of_current_operation_modes = []
list_of_current_operation_statuses = []

if self.__device_config["operational_status_minRegisterValue"] is not None:
current_register_value -= int(
Expand All @@ -525,10 +527,10 @@ def __get_running_operational_statuses(
if key <= current_register_value:
current_register_value -= key
if value.get("visible"):
list_of_current_operation_modes.append(value.get("name"))
list_of_current_operation_statuses.append(value.get("name"))

if current_register_value == 0:
return list_of_current_operation_modes
return list_of_current_operation_statuses

return []

Expand All @@ -548,7 +550,7 @@ def __get_all_power_statuses_from_power_status(
if data is None:
return ChainMap()

power_modes_map = map(
power_statuses_map = map(
lambda values: {
values.get("value"): {
"name": values.get("name").split("COMP_VALUE_STEP_")[1],
Expand All @@ -558,8 +560,8 @@ def __get_all_power_statuses_from_power_status(
data,
)

power_modes_list = list(power_modes_map)
return ChainMap(*power_modes_list)
power_statuses_list = list(power_statuses_map)
return ChainMap(*power_statuses_list)

def __get_all_visible_power_statuses_from_power_status(
self,
Expand All @@ -569,15 +571,15 @@ def __get_all_visible_power_statuses_from_power_status(
if data is None:
return ChainMap()

power_modes_map = map(
power_statuses_map = map(
lambda item: (
{item[0]: item[1].get("name")} if item[1].get("visible") else {}
),
data.items(),
)

power_modes_list = list(filter(lambda x: x != {}, power_modes_map))
return ChainMap(*power_modes_list)
power_statuses_list = list(filter(lambda x: x != {}, power_statuses_map))
return ChainMap(*power_statuses_list)

def __get_running_power_statuses(
self,
Expand Down

0 comments on commit ca0589d

Please sign in to comment.