Skip to content

Commit

Permalink
Send the buzzer property in an all SetProperties commands (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
mill1000 authored Apr 30, 2024
1 parent 47c619e commit 438e2cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion msmart/device/AC/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CapabilityId(IntEnum):
FAHRENHEIT = 0x0222
DISPLAY_CONTROL = 0x0224
TEMPERATURES = 0x0225
BUZZER = 0x022C
BUZZER = 0x022C # TODO Reference refers to this as "sound". Is this different then buzzer?
MAIN_HORIZONTAL_GUIDE_STRIP = 0x0230 # ??
SUP_HORIZONTAL_GUIDE_STRIP = 0x0231 # ??
TWINS_MACHINE = 0x0232 # ??
Expand All @@ -72,6 +72,7 @@ class CapabilityId(IntEnum):
class PropertyId(IntEnum):
SWING_UD_ANGLE = 0x0009
SWING_LR_ANGLE = 0x000A
BUZZER = 0x001A
INDOOR_HUMIDITY = 0x0015 # TODO Reference refers to a potential bug with this
SELF_CLEAN = 0x0039
RATE_SELECT = 0x0048
Expand Down
12 changes: 9 additions & 3 deletions msmart/device/AC/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,17 @@ def or_default(v, d) -> Any: return v if v is not None else d
for prop in (self._updated_properties - self._supported_properties):
_LOGGER.warning("Device is not capable of property %s.", prop)

# Build command with current state of updated properties
cmd = SetPropertiesCommand({
# Get current state of updated properties
props = {
k: getattr(self, self._PROPERTY_MAP[k])
for k in self._updated_properties & self._PROPERTY_MAP.keys()
})
}

# Always add buzzer property
props[PropertyId.BUZZER] = self._beep_on

# Build command with properties
cmd = SetPropertiesCommand(props)
for response in await self._send_command_get_responses(cmd):
self._process_state_response(response)

Expand Down

0 comments on commit 438e2cc

Please sign in to comment.