Skip to content

Commit

Permalink
chore: missing typing for AC (midea-lan#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
chemelli74 authored Jun 5, 2024
1 parent faf7a38 commit 75fbd8e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions midealocal/devices/ac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ def make_message_uniq_set(self) -> MessageSubProtocolSet | MessageGeneralSet:

def set_attribute(self, attr: str, value: Any) -> None:
# if nat a sensor
message: MessageToggleDisplay | MessageNewProtocolSet | None = None
message: (
MessageToggleDisplay | MessageNewProtocolSet | MessageGeneralSet | None
) = None
if attr not in [
DeviceAttributes.indoor_temperature,
DeviceAttributes.outdoor_temperature,
Expand Down Expand Up @@ -334,7 +336,7 @@ def set_attribute(self, attr: str, value: Any) -> None:
)
setattr(message, str(self._fresh_air_version), fresh_air)
elif attr in self._attributes.keys():
message = self.make_message_uniq_set()
message = self.make_message_set()
if attr in [
DeviceAttributes.boost_mode,
DeviceAttributes.sleep_mode,
Expand All @@ -354,15 +356,17 @@ def set_attribute(self, attr: str, value: Any) -> None:
self.build_send(message)

def set_target_temperature(self, target_temperature: float, mode: int) -> None:
message: MessageGeneralSet = self.make_message_uniq_set()
message: MessageSubProtocolSet | MessageGeneralSet = (
self.make_message_uniq_set()
)
message.target_temperature = target_temperature
if mode is not None:
message.power = True
message.mode = mode
self.build_send(message)

def set_swing(self, swing_vertical: bool, swing_horizontal: bool) -> None:
message: MessageGeneralSet = self.make_message_uniq_set()
message: MessageGeneralSet = self.make_message_set()
message.swing_vertical = swing_vertical
message.swing_horizontal = swing_horizontal
self.build_send(message)
Expand Down

0 comments on commit 75fbd8e

Please sign in to comment.