Skip to content

Commit

Permalink
Merge pull request #4 from jwillemsen/jwi-swingmodes
Browse files Browse the repository at this point in the history
Support more swing modes
  • Loading branch information
jwillemsen authored Dec 21, 2023
2 parents 5d0d511 + 2c408cd commit 2db7028
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
43 changes: 28 additions & 15 deletions custom_components/daikin_residential_altherma/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,20 @@ def swing_mode(self):
h = horizontal["currentMode"]["value"]
if vertical is not None:
v = vertical["currentMode"]["value"]
if h != "stop":
if h == "swing":
swingMode = SWING_HORIZONTAL
if v != "stop":
if h != "stop":
if v == "swing":
swingMode = SWING_BOTH
else:
swingMode = SWING_VERTICAL
if v == "floorHeatingAirflow":
swingMode = "floorHeatingAirflow"
if v == "windNice":
if h == "swing":
swingMode = "Comfort Airflow and Horizontal"
else:
swingMode = "Comfort Airflow"

return swingMode

@property
Expand All @@ -501,12 +508,18 @@ def swing_modes(self):
for mode in horizontal["currentMode"]["values"]:
if mode == "swing":
swingModes.append(SWING_HORIZONTAL)
if mode == "floorHeatingAirflow":
swingModes.append(mode)
if vertical is not None:
for mode in vertical["currentMode"]["values"]:
if mode == "swing":
swingModes.append(SWING_VERTICAL)
if horizontal is not None:
swingModes.append(SWING_BOTH)
if horizontal is not None:
swingModes.append(SWING_BOTH)
if mode == "windNice":
swingModes.append("Comfort Airflow")
if horizontal is not None:
swingModes.append("Comfort Airflow and Horizontal")
_LOGGER.info("Support swing modes %s", swingModes)
return swingModes

Expand All @@ -521,22 +534,22 @@ async def async_set_swing_mode(self, swing_mode):
horizontal = fanDirection.get("horizontal")
vertical = fanDirection.get("vertical")
if horizontal is not None:
new_hMode = (
"swing"
if swing_mode in (SWING_HORIZONTAL, SWING_BOTH)
else "stop"
)
new_hMode = "stop"
if swing_mode in (SWING_HORIZONTAL, SWING_BOTH, "Comfort Airflow and Horizontal"):
new_hMode = "swing"
res = await self._device.set_path(self._device.getId(), self.embedded_id, "fanControl", f"/operationModes/{operationmode}/fanDirection/horizontal/currentMode", new_hMode)
if res is False:
_LOGGER.warning("Device '%s' problem setting horizontal swing mode to %s", self._device.name, new_hMode)
else:
fanControl["value"]["operationModes"][operationmode]["fanDirection"]["horizontal"]["currentMode"]["value"] = new_hMode
if vertical is not None:
new_vMode = (
"swing"
if swing_mode in (SWING_VERTICAL, SWING_BOTH)
else "stop"
)
new_vMode = "stop"
if swing_mode in (SWING_VERTICAL, SWING_BOTH):
new_vMode = "swing"
if swing_mode in ("floorHeatingAirflow"):
new_vMode = "floorHeatingAirflow"
if swing_mode in ("Comfort Airflow", "Comfort Airflow and Horizontal"):
new_vMode = "windNice"
res &= await self._device.set_path(self._device.getId(), self.embedded_id, "fanControl", f"/operationModes/{operationmode}/fanDirection/vertical/currentMode", new_vMode)
if res is False:
_LOGGER.warning("Device '%s' problem setting horizontal swing mode to %s", self._device.name, new_vMode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"requirements": [
"oic==1.6.0"
],
"version": "3.0.1"
"version": "3.1.0"
}

0 comments on commit 2db7028

Please sign in to comment.