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

feat: implements mode UV nano for air conditioner RAC_056905_WW #604

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions custom_components/smartthinq_sensors/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ class ThinQSwitchEntityDescription(SwitchEntityDescription):
turn_off_fn=lambda x: x.device.set_lighting_display(False),
turn_on_fn=lambda x: x.device.set_lighting_display(True),
),
ThinQSwitchEntityDescription(
key=AirConditionerFeatures.MODE_UN_NANO,
name="UV Nano",
icon="mdi:alpha-u-box-outline",
turn_off_fn=lambda x: x.device.set_uv_nano(False),
turn_on_fn=lambda x: x.device.set_uv_nano(True),
),
ThinQSwitchEntityDescription(
key=AirConditionerFeatures.MODE_AWHP_SILENT,
name="Silent mode",
Expand Down
1 change: 1 addition & 0 deletions custom_components/smartthinq_sensors/wideq/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class AirConditionerFeatures(StrEnum):
ROOM_TEMP = "room_temperature"
WATER_IN_TEMP = "water_in_temperature"
WATER_OUT_TEMP = "water_out_temperature"
MODE_UN_NANO = "mode_un_nano"


class AirPurifierFeatures(StrEnum):
Expand Down
24 changes: 24 additions & 0 deletions custom_components/smartthinq_sensors/wideq/devices/ac.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
STATE_MODE_AIRCLEAN = ["AirClean", "airState.wMode.airClean"]
STATE_MODE_JET = ["Jet", "airState.wMode.jet"]
STATE_LIGHTING_DISPLAY = ["DisplayControl", "airState.lightingState.displayControl"]
STATE_UV_NANO = ["UVNano", "airState.miscFuncState.Uvnano"]
STATE_RESERVATION_SLEEP_TIME = ["SleepTime", "airState.reservation.sleepTime"]

FILTER_TYPES = [
Expand Down Expand Up @@ -89,6 +90,7 @@
CMD_STATE_MODE_AIRCLEAN = [CTRL_BASIC, "Set", STATE_MODE_AIRCLEAN]
CMD_STATE_MODE_JET = [CTRL_BASIC, "Set", STATE_MODE_JET]
CMD_STATE_LIGHTING_DISPLAY = [CTRL_BASIC, "Set", STATE_LIGHTING_DISPLAY]
CMD_STATE_UV_NANO = [CTRL_BASIC, "Set", STATE_UV_NANO]
CMD_RESERVATION_SLEEP_TIME = [CTRL_BASIC, "Set", STATE_RESERVATION_SLEEP_TIME]

# AWHP Section
Expand Down Expand Up @@ -127,6 +129,9 @@
LIGHTING_DISPLAY_OFF = "0"
LIGHTING_DISPLAY_ON = "1"

UV_NANO_OFF = "0"
UV_NANO_ON = "1"

MODE_OFF = "@OFF"
MODE_ON = "@ON"

Expand Down Expand Up @@ -805,6 +810,12 @@ async def set_lighting_display(self, status: bool):
lighting = LIGHTING_DISPLAY_ON if status else LIGHTING_DISPLAY_OFF
await self.set(keys[0], keys[1], key=keys[2], value=lighting)

async def set_uv_nano(self, status: bool):
"""Set the lighting display on or off."""
keys = self._get_cmd_keys(CMD_STATE_UV_NANO)
state = UV_NANO_ON if status else UV_NANO_OFF
await self.set(keys[0], keys[1], key=keys[2], value=state)

async def set_mode_awhp_silent(self, value: bool):
"""Set the AWHP silent mode on or off."""
if not self.is_air_to_water:
Expand Down Expand Up @@ -1219,6 +1230,18 @@ def lighting_display(self):
False,
)

@property
def mode_uv_nano(self):
"""Return display lighting status."""
key = self._get_state_key(STATE_UV_NANO)
if (value := self.to_int_or_none(self._data.get(key))) is None:
return None
return self._update_feature(
AirConditionerFeatures.MODE_UN_NANO,
str(value) == UV_NANO_ON,
False,
)

@property
def filters_life(self):
"""Return percentage status for all filters."""
Expand Down Expand Up @@ -1338,6 +1361,7 @@ def _update_features(self):
self.mode_airclean,
self.mode_jet,
self.lighting_display,
self.mode_uv_nano,
self.water_in_current_temp,
self.water_out_current_temp,
self.mode_awhp_silent,
Expand Down