Skip to content

Commit

Permalink
Merge pull request #327 from jwillemsen/jwi-testfanmodes
Browse files Browse the repository at this point in the history
Extend logging and added test for checking fanmodes
  • Loading branch information
jwillemsen authored Oct 21, 2024
2 parents eada847 + a2e0fb2 commit e543f11
Show file tree
Hide file tree
Showing 4 changed files with 2,404 additions and 4 deletions.
17 changes: 13 additions & 4 deletions custom_components/daikin_onecta/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,17 @@ def get_fan_mode(self):
if mode == FANMODE_FIXED:
fsm = fan_speed.get("modes")
if fsm is not None:
_LOGGER.info("FSM %s", fsm)
fixedModes = fsm[mode]
fan_mode = str(fixedModes["value"])
else:
fan_mode = mode

_LOGGER.info(
"Device '%s' has fan mode '%s'",
self._device.name,
fan_mode,
)

return fan_mode

def get_fan_modes(self):
Expand All @@ -466,11 +471,9 @@ def get_fan_modes(self):
if fan_speed is not None:
_LOGGER.info("Found fanspeed %s", fan_speed)
for c in fan_speed["currentMode"]["values"]:
_LOGGER.info("Device '%s' found fan mode %s", self._device.name, c)
if c == FANMODE_FIXED:
fsm = fan_speed.get("modes")
if fsm is not None:
_LOGGER.info("Device '%s' found fixed %s", self._device.name, fsm)
fixedModes = fsm[c]
min_val = int(fixedModes["minValue"])
max_val = int(fixedModes["maxValue"])
Expand All @@ -480,12 +483,18 @@ def get_fan_modes(self):
else:
fan_modes.append(c)

_LOGGER.info(
"Device '%s' has fan modes '%s'",
self._device.name,
fan_modes,
)

return fan_modes

async def async_set_fan_mode(self, fan_mode):
"""Set the fan mode"""
_LOGGER.debug(
"Device '%s' request to set fan_mode to %s",
"Device '%s' request to set fan_mode to '%s'",
self._device.name,
fan_mode,
)
Expand Down
Loading

0 comments on commit e543f11

Please sign in to comment.