Skip to content

Commit d4d37cd

Browse files
committed
type:ignore, fix as bool
1 parent 3b53442 commit d4d37cd

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

plugwise/helper.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _get_actuator_functionalities(xml: etree, data: DeviceData) -> None:
117117
temp_dict[key] = format_measure(function.text, TEMP_CELSIUS) # type: ignore [literal-required]
118118

119119
if temp_dict:
120-
data[item] = temp_dict
120+
data[item] = temp_dict # type: ignore [literal-required]
121121

122122

123123
def schedules_temps(
@@ -896,26 +896,26 @@ def _appliance_measurements(
896896
if new_name := getattr(attrs, ATTR_NAME, None):
897897
measurement = new_name
898898

899-
data[measurement] = appl_p_loc.text
899+
data[measurement] = appl_p_loc.text # type: ignore [literal-required]
900900
# measurements with states "on" or "off" that need to be passed directly
901901
if measurement not in ("dhw_mode"):
902-
data[measurement] = format_measure(
902+
data[measurement] = format_measure( # type: ignore [literal-required]
903903
appl_p_loc.text, getattr(attrs, ATTR_UNIT_OF_MEASUREMENT)
904904
)
905905

906906
# Anna: save cooling-related measurements for later use
907907
# Use the local outdoor temperature as reference for turning cooling on/off
908908
if measurement == "cooling_activation_outdoor_temperature":
909-
self._cooling_activation_outdoor_temp = data[measurement]
909+
self._cooling_activation_outdoor_temp = data[measurement] # type: ignore [literal-required]
910910
if measurement == "cooling_deactivation_threshold":
911-
self._cooling_deactivation_threshold = data[measurement]
911+
self._cooling_deactivation_threshold = data[measurement] # type: ignore [literal-required]
912912
if measurement == "outdoor_air_temperature":
913-
self._outdoor_temp = data[measurement]
913+
self._outdoor_temp = data[measurement] # type: ignore [literal-required]
914914

915915
i_locator = f'.//logs/interval_log[type="{measurement}"]/period/measurement'
916916
if (appl_i_loc := appliance.find(i_locator)) is not None:
917917
name = f"{measurement}_interval"
918-
data[name] = format_measure(appl_i_loc.text, ENERGY_WATT_HOUR)
918+
data[name] = format_measure(appl_i_loc.text, ENERGY_WATT_HOUR) # type: ignore [literal-required]
919919

920920
def _wireless_availablity(self, appliance: etree, data: DeviceData) -> None:
921921
"""
@@ -962,7 +962,7 @@ def _cleanup_data(self, data: DeviceData) -> None:
962962
if not self._cooling_present:
963963
for item in ("cooling_state", "cooling_ena_switch"):
964964
if item in data:
965-
data.pop(item)
965+
data.pop(item) # type: ignore [misc]
966966
# Keep cooling_enabled for Elga
967967
if not self._elga and "cooling_enabled" in data:
968968
data.pop("cooling_enabled") # pragma: no cover
@@ -977,15 +977,15 @@ def _process_c_heating_state(self, data: DeviceData) -> None:
977977
# Anna + OnOff heater: use central_heating_state to show heating_state
978978
# Solution for Core issue #81839
979979
if self.smile_name == "Smile Anna":
980-
data["heating_state"] = data["c_heating_state"] is True
980+
data["heating_state"] = bool(data["c_heating_state"])
981981

982982
if self.smile_name == "Adam":
983983
data["heating_state"] = False
984984
# Adam + OnOff cooling: use central_heating_state to show heating/cooling_state
985985
if self._cooling_enabled:
986-
data["cooling_state"] = data["c_heating_state"] is True
986+
data["cooling_state"] = bool(data["c_heating_state"])
987987
else:
988-
data["heating_state"] = data["c_heating_state"] is True
988+
data["heating_state"] = bool(data["c_heating_state"])
989989

990990
def _get_appliance_data(self, d_id: str) -> DeviceData:
991991
"""
@@ -1471,7 +1471,7 @@ def _get_toggle_state(
14711471
for item in found:
14721472
if (toggle_type := item.find("type")) is not None:
14731473
if toggle_type.text == toggle:
1474-
data.update({name: item.find("state").text == "on"})
1474+
data[name] = item.find("state").text == "on" # type: ignore [literal-required]
14751475
# Remove the cooling_enabled key when the corresponding toggle is present
14761476
# Except for Elga
14771477
if toggle == "cooling_enabled" and not self._elga:

0 commit comments

Comments
 (0)