Skip to content

Commit

Permalink
Use repr formatter in log prints for enums (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
mill1000 authored Aug 5, 2024
1 parent 8d73e5e commit 1bb038d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion msmart/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def convert(v, t):

# Set remaining properties
for prop, value in new_properties.items():
_LOGGER.info("Setting '%s' to %s.", prop, repr(value))
_LOGGER.info("Setting '%s' to %r.", prop, value)
setattr(device, prop, value)

# Apply to device
Expand Down
8 changes: 4 additions & 4 deletions msmart/device/AC/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ async def _apply_properties(self, properties: dict[PropertyId, Union[bytes, int]

# Warn if attempting to update a property that isn't supported
for prop in (properties.keys() - self._supported_properties):
_LOGGER.warning("Device is not capable of property %s.", prop)
_LOGGER.warning("Device is not capable of property %r.", prop)

# Always add buzzer property
properties[PropertyId.BUZZER] = self._beep_on
Expand All @@ -410,16 +410,16 @@ async def apply(self) -> None:
# Warn if trying to apply unsupported modes
if self._operational_mode not in self._supported_op_modes:
_LOGGER.warning(
"Device is not capable of operational mode %s.", self._operational_mode)
"Device is not capable of operational mode %r.", self._operational_mode)

if (self._fan_speed not in self._supported_fan_speeds
and not self._supports_custom_fan_speed):
_LOGGER.warning(
"Device is not capable of fan speed %s.", self._fan_speed)
"Device is not capable of fan speed %r.", self._fan_speed)

if self._swing_mode not in self._supported_swing_modes:
_LOGGER.warning(
"Device is not capable of swing mode %s.", self._swing_mode)
"Device is not capable of swing mode %r.", self._swing_mode)

if self._turbo_mode and not self._supports_turbo_mode:
_LOGGER.warning("Device is not capable of turbo mode.")
Expand Down

0 comments on commit 1bb038d

Please sign in to comment.