Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for separate horizontal/vertical swing modes #332

Merged
merged 35 commits into from
Nov 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4b341a7
Untested changes to add horizontal swing mode to the Daikin Onecta in…
jwillemsen Oct 31, 2024
3454afd
json fixes
jwillemsen Oct 31, 2024
6e8ce77
Fixed json
jwillemsen Oct 31, 2024
b75052f
Supported features and async
jwillemsen Oct 31, 2024
7ec72c4
Simplified swing modes
jwillemsen Nov 4, 2024
b2d8d78
precommit f ix
jwillemsen Nov 4, 2024
ee90f6c
test changes for horizontal
jwillemsen Nov 4, 2024
2887aca
Add import
jwillemsen Nov 4, 2024
daff9b7
Updated icons
jwillemsen Nov 5, 2024
81ef92b
Merge branch 'master' into jwi-horizontalswing
jwillemsen Nov 12, 2024
b9c79b3
precommit
jwillemsen Nov 12, 2024
107ac6d
Merge branch 'master' into jwi-horizontalswing
jwillemsen Nov 13, 2024
3212e7d
Merge branch 'master' into jwi-horizontalswing
jwillemsen Nov 14, 2024
b814e23
Merge branch 'master' into jwi-horizontalswing
jwillemsen Nov 18, 2024
33f4914
Merge branch 'master' into jwi-horizontalswing
jwillemsen Nov 21, 2024
36c44c1
Merge branch 'master' into jwi-horizontalswing
jwillemsen Nov 25, 2024
cbace3c
Merge branch 'jwi-horizontalswing' of https://github.com/jwillemsen/d…
jwillemsen Nov 25, 2024
0020fd7
Upgrade minimum HA version
jwillemsen Nov 27, 2024
dbb6dc5
Upgrade to python 3.13
jwillemsen Nov 28, 2024
a45e25c
Updated HA requirement
jwillemsen Nov 28, 2024
144ae49
Upgrade pip
jwillemsen Nov 28, 2024
d7553cb
Try pytest minimal verison
jwillemsen Nov 28, 2024
8576a25
Lower pytest
jwillemsen Nov 28, 2024
d8a0045
Lower HA
jwillemsen Nov 28, 2024
26151a3
Fixed test failures
jwillemsen Nov 28, 2024
acb1f6c
Fixed swing mode
jwillemsen Nov 28, 2024
c9e130e
Test duplicate setting
jwillemsen Nov 28, 2024
675f2c6
No pytes versi
jwillemsen Nov 28, 2024
3b6c3c0
Fixed debug message
jwillemsen Nov 28, 2024
ae51f3f
Updated snapshots
jwillemsen Nov 28, 2024
e09070e
Updated translations
jwillemsen Nov 28, 2024
47c6e54
Add icon
jwillemsen Nov 28, 2024
63456f3
Fixed error
jwillemsen Nov 28, 2024
8e26116
Increment minor version
jwillemsen Nov 28, 2024
e8ce0ce
Snapshot updates
jwillemsen Nov 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Upgrade minimum HA version
    * hacs.json:
jwillemsen committed Nov 27, 2024
commit 0020fd72803c2b1b432ebdea7b95742a64df44f3
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Daikin Onecta",
"render_readme": true,
"homeassistant": "2024.8.0"
"homeassistant": "2024.12.0"
}

Unchanged files with check annotations Beta

self._attr_target_temperature = self.get_target_temperature()
self._attr_hvac_modes = self.get_hvac_modes()
self._attr_swing_modes = self.get_swing_modes()
self._attr_swing_horizontal_modes = self.get_swing_horizontal_modes()

Check warning on line 128 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L128

Added line #L128 was not covered by tests
self._attr_preset_modes = self.get_preset_modes()
self._attr_fan_modes = self.get_fan_modes()
self._attr_hvac_mode = self.get_hvac_mode()
self._attr_swing_mode = self.get_swing_mode()
self._attr_swing_horizontal_mode = self.get_swing_horizontal_mode()

Check warning on line 133 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L133

Added line #L133 was not covered by tests
self._attr_preset_mode = self.get_preset_mode()
self._attr_fan_mode = self.get_fan_mode()
self._attr_device_info = self._device.device_info()
if operationmodedict is not None:
if operationmodedict.get("fanSpeed") is not None:
supported_features |= ClimateEntityFeature.FAN_MODE
fan_direction = operationmodedict.get("fanDirection")
if fan_direction is not None:
if fan_direction.get("vertical") is not None:
supported_features |= ClimateEntityFeature.SWING_MODE
if fan_direction.get("horizontal") is not None:
supported_features |= ClimateEntityFeature.SWING_HORIZONTAL_MODE

Check warning on line 227 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L222-L227

Added lines #L222 - L227 were not covered by tests
_LOGGER.info("Device '%s' supports features %s", self._device.name, supported_features)
return res
def __get_swing_modes(self, direction):
swingMode = ""

Check warning on line 560 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L559-L560

Added lines #L559 - L560 were not covered by tests
cc = self.climate_control()
fanControl = cc.get("fanControl")
if fanControl is not None:
if operationmodedict is not None:
fan_direction = operationmodedict.get("fanDirection")
if fan_direction is not None:
fd = fan_direction.get(direction)
if fd is not None:
swingMode = fd["currentMode"]["value"].lower()

Check warning on line 571 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L569-L571

Added lines #L569 - L571 were not covered by tests
_LOGGER.info(
"Device '%s' has %s swing mode '%s'",
return swingMode
def get_swing_mode(self):
return self.__get_swing_modes("vertical")

Check warning on line 583 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L582-L583

Added lines #L582 - L583 were not covered by tests
def get_swing_horizontal_mode(self):
return self.__get_swing_modes("horizontal")

Check warning on line 586 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L585-L586

Added lines #L585 - L586 were not covered by tests
def __get_swing_modes(self, direction):

Check warning on line 588 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L588

Added line #L588 was not covered by tests
swingModes = []
cc = self.climate_control()
fanControl = cc.get("fanControl")
if fanControl is not None:
swingModes = []

Check warning on line 593 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L593

Added line #L593 was not covered by tests
operationmode = cc["operationMode"]["value"]
operationmodedict = fanControl["value"]["operationModes"].get(operationmode)
if operationmodedict is not None:
fanDirection = operationmodedict.get("fanDirection")
if fanDirection is not None:
vertical = fanDirection.get(direction)

Check warning on line 599 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L599

Added line #L599 was not covered by tests
if vertical is not None:
for mode in vertical["currentMode"]["values"]:
swingModes.append(mode.lower())
_LOGGER.info("Device '%s' support %s swing modes %s", self._device.name, direction, swingModes)

Check warning on line 603 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L602-L603

Added lines #L602 - L603 were not covered by tests
return swingModes
def get_swing_modes(self):
return self.__get_swing_modes("vertical")

Check warning on line 607 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L606-L607

Added lines #L606 - L607 were not covered by tests
def get_swing_horizontal_modes(self):
return self.__get_swing_modes("horizontal")

Check warning on line 610 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L609-L610

Added lines #L609 - L610 were not covered by tests
async def __set_swing(self, direction, swing_mode):

Check warning on line 612 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L612

Added line #L612 was not covered by tests
_LOGGER.debug(
"Device '%s' request to set swing %s mode to %s",
self._device.name,
operation_mode = cc["operationMode"]["value"]
fan_direction = fan_control["value"]["operationModes"][operation_mode].get("fanDirection")
if fan_direction is not None:
fd = fan_direction.get(direction)
if fd is not None:
new_mode = "stop"

Check warning on line 629 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L627-L629

Added lines #L627 - L629 were not covered by tests
# For translation the current mode is always lower case, but we need to send
# the daikin mixed case mode, so search that
for mode in fd["currentMode"]["values"]:
if swing_mode == mode.lower():
new_mode = mode
res = await self._device.patch(

Check warning on line 635 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L632-L635

Added lines #L632 - L635 were not covered by tests
self._device.id,
self._embedded_id,
"fanControl",
direction,
new_mode,
)
return res

Check warning on line 649 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L649

Added line #L649 was not covered by tests
async def async_set_swing_mode(self, swing_mode):
if self.swing_mode != swing_mode:
res = self.__set_swing("vertical", swing_mode)

Check warning on line 653 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L651-L653

Added lines #L651 - L653 were not covered by tests
if res is True:
self._attr_swing_mode = swing_mode
self.async_write_ha_state()

Check warning on line 657 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L655-L657

Added lines #L655 - L657 were not covered by tests
else:
_LOGGER.debug(

Check warning on line 659 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L659

Added line #L659 was not covered by tests
"Device '%s' request to set vertical swing mode '%s' ignored already set",
self._device.name,
swing_mode,
)
return res

Check warning on line 665 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L665

Added line #L665 was not covered by tests
async def async_set_swing_horizontal_mode(self, swing_mode):
if self.swing_horizontal_mode != swing_mode:
res = self.__set_swing("horizontal", swing_mode)

Check warning on line 669 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L667-L669

Added lines #L667 - L669 were not covered by tests
if res is True:
self._attr_swing_horizontal_mode = swing_mode
self.async_write_ha_state()

Check warning on line 673 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L671-L673

Added lines #L671 - L673 were not covered by tests
else:
_LOGGER.debug(

Check warning on line 675 in custom_components/daikin_onecta/climate.py

Codecov / codecov/patch

custom_components/daikin_onecta/climate.py#L675

Added line #L675 was not covered by tests
"Device '%s' request to set horizontal swing mode '%s' ignored already set",
self._device.name,
swing_mode,