Skip to content

Commit

Permalink
Fix BRP069: Add swing_mode support for Alira X devices (#23)
Browse files Browse the repository at this point in the history
* move to instance members

* move ssl_context out of constructor

* add alira responses

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Move parse_response to class method

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove extra space in pydaikin/response.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fredrik Erlandsson <[email protected]>
  • Loading branch information
3 people authored Aug 29, 2024
1 parent c67be6b commit 324d858
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion pydaikin/daikin_brp069.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,26 @@ class DaikinBRP069(Appliance):
'filter_sign_info': 'filter dirty',
}

@staticmethod
def parse_response(response_body):
"""Parse response from Daikin
Translate swing mode from 2 parameters to 1 (Special case for certain models e.g Alira X)
"""
_LOGGER.debug("Parsing %s", response_body)
response = super(DaikinBRP069, DaikinBRP069).parse_response(response_body)

if response.get("f_dir_ud") == "0" and response.get("f_dir_lr") == "0":
response["f_dir"] = '0'
elif response.get("f_dir_ud") == "S" and response.get("f_dir_lr") == "0":
response["f_dir"] = '1'
elif response.get("f_dir_ud") == "0" and response.get("f_dir_lr") == "S":
response["f_dir"] = '2'
elif response.get("f_dir_ud") == "S" and response.get("f_dir_lr") == "S":
response["f_dir"] = '3'

return response

async def init(self):
"""Init status."""
await self.auto_set_clock()
Expand Down Expand Up @@ -179,7 +199,13 @@ async def set(self, settings):
if self.support_fan_rate:
params.update({"f_rate": self.values['f_rate']})
if self.support_swing_mode:
params.update({"f_dir": self.values['f_dir']})
if 'f_dir_lr' in self.values and 'f_dir_ud' in self.values:
# Australian Alira X uses 2 separate parameters instead of the combined f_dir
f_dir_ud = 'S' if self.values['f_dir'] in ('1', '3') else '0'
f_dir_lr = 'S' if self.values['f_dir'] in ('2', '3') else '0'
params.update({"f_dir_ud": f_dir_ud, "f_dir_lr": f_dir_lr})
else:
params.update({"f_dir": self.values['f_dir']})

_LOGGER.debug("Sending request to %s with params: %s", path, params)
await self._get_resource(path, params)
Expand Down

0 comments on commit 324d858

Please sign in to comment.