Support 2-axis wind oscillation and overload-protection status on newer WindFree boards (issue #126)
Newer TP1X_DA-AC-RAC-01011_0000 firmware (Bespoke AI WindFree Deluxe, AR60H10D1JWNME) drops /wind/direction/vs/0 entirely and reports swing via a separate vertical/horizontal Swing|Fix pair on /wind/oscillation/vs/0 instead, which left swing_mode/swing_modes silently empty and the href unbound. climate.py now falls back to the oscillation resource when /wind/direction/vs/0 is absent, mapping the same off/vertical/horizontal/both vocabulary the existing swing control already uses. Also binds the board's /anomalyload/vs/0 overload-response resource as read-only diagnostic sensors (operation state + mode) -- the same "don't guess" precedent as the existing CURRENT_LIMIT capability, since nothing in the dump confirms the exact behavioral difference between its 'Alarm' and 'PowerSaving' modes or whether toggling it is safe on live HVAC hardware. Most of the other gaps this issue reported (Fan-only mode, WindFree preset labels, target-temperature channel selection, power on/off via the vendor resource) turned out to already be fixed by the just-merged cool-only global RAC work.
This commit is contained in:
9 files changed
+770
-4
No files matched your search
@@ -48,6 +48,7 @@ from .registry.capabilities.airconditioner import (
|
||||
HREF_TEMPS_VS as TEMPS_VS_HREF,
|
||||
HREF_WIND_STRENGTH as WIND_STRENGTH_HREF,
|
||||
HREF_WIND_DIRECTION as WIND_DIRECTION_HREF,
|
||||
HREF_WIND_OSCILLATION as WIND_OSCILLATION_HREF,
|
||||
HREF_CONVENIENT as CONVENIENT_HREF,
|
||||
)
|
||||
from .registry.capabilities.common import normalize_temp_unit
|
||||
@@ -120,6 +121,26 @@ _DEVICE_TO_SWING: dict[str, str] = {
|
||||
}
|
||||
_SWING_TO_DEVICE = {v: k for k, v in _DEVICE_TO_SWING.items()}
|
||||
|
||||
# Swing fallback via /wind/oscillation/vs/0 (issue #126) -- boards without
|
||||
# WIND_DIRECTION_HREF at all report two independent Swing|Fix toggles
|
||||
# instead of one combined code. Same HA vocabulary as _DEVICE_TO_SWING
|
||||
# above (off/vertical/horizontal/both), just read from/written to a pair
|
||||
# of fields rather than a single one.
|
||||
def _oscillation_swing(rep: dict) -> str | None:
|
||||
vertical = rep.get('vertical')
|
||||
horizontal = rep.get('horizontal')
|
||||
if vertical is None and horizontal is None:
|
||||
return None
|
||||
v = vertical == 'Swing'
|
||||
h = horizontal == 'Swing'
|
||||
if v and h:
|
||||
return 'both'
|
||||
if v:
|
||||
return 'vertical'
|
||||
if h:
|
||||
return 'horizontal'
|
||||
return 'off'
|
||||
|
||||
# Preset (convenient mode): resolved dynamically from the device's own
|
||||
# /mode/convenient/vs/0 supportedModes -- no per-model table. The device 'Off'
|
||||
# code maps to HA's PRESET_NONE ("no preset active"); every other code is
|
||||
@@ -358,13 +379,25 @@ class LocalThingsClimate(LocalThingsEntity, ClimateEntity):
|
||||
def fan_modes(self) -> list[str]:
|
||||
return self._read_modes(WIND_STRENGTH_HREF, _DEVICE_TO_FAN)
|
||||
|
||||
def _swing_via_direction(self) -> bool:
|
||||
"""True when WIND_DIRECTION_HREF is the swing channel to use --
|
||||
signalled by its presence. Boards without it (issue #126) report
|
||||
the 2-axis oscillation resource instead; see _oscillation_swing."""
|
||||
return bool(self._rep(WIND_DIRECTION_HREF))
|
||||
|
||||
@property
|
||||
def swing_mode(self):
|
||||
return self._read_mode(WIND_DIRECTION_HREF, _DEVICE_TO_SWING)
|
||||
if self._swing_via_direction():
|
||||
return self._read_mode(WIND_DIRECTION_HREF, _DEVICE_TO_SWING)
|
||||
return _oscillation_swing(self._rep(WIND_OSCILLATION_HREF))
|
||||
|
||||
@property
|
||||
def swing_modes(self) -> list[str]:
|
||||
return self._read_modes(WIND_DIRECTION_HREF, _DEVICE_TO_SWING)
|
||||
if self._swing_via_direction():
|
||||
return self._read_modes(WIND_DIRECTION_HREF, _DEVICE_TO_SWING)
|
||||
if self._rep(WIND_OSCILLATION_HREF):
|
||||
return list(_SWING_TO_DEVICE.keys())
|
||||
return []
|
||||
|
||||
@property
|
||||
def preset_mode(self):
|
||||
@@ -428,7 +461,12 @@ class LocalThingsClimate(LocalThingsEntity, ClimateEntity):
|
||||
await self._set_mapped('fan', _FAN_TO_DEVICE, fan_mode)
|
||||
|
||||
async def async_set_swing_mode(self, swing_mode: str) -> None:
|
||||
await self._set_mapped('swing', _SWING_TO_DEVICE, swing_mode)
|
||||
if self._swing_via_direction():
|
||||
await self._set_mapped('swing', _SWING_TO_DEVICE, swing_mode)
|
||||
return
|
||||
if self._rep(WIND_OSCILLATION_HREF):
|
||||
await self.coordinator.async_send_command(
|
||||
self._bound, ('oscillation', swing_mode))
|
||||
|
||||
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
||||
if preset_mode == PRESET_AI_COMFORT:
|
||||
|
||||
@@ -25,6 +25,7 @@ REGISTRY = DeviceRegistry(
|
||||
airconditioner.DISPLAY_LIGHT,
|
||||
airconditioner.MUTE_ONCE,
|
||||
airconditioner.CURRENT_LIMIT,
|
||||
airconditioner.ANOMALY_LOAD,
|
||||
airconditioner.CURRENT_TEMPERATURE,
|
||||
airconditioner.CURRENT_TEMPERATURE_VS,
|
||||
airconditioner.HUMIDITY,
|
||||
|
||||
@@ -35,13 +35,19 @@ HREF_TEMP_DESIRED = '/temperature/desired/0' # target_temperature (write ta
|
||||
HREF_TEMP_CONTROL = '/temperature/control/vs/0' # target_temperature_step
|
||||
HREF_WIND_STRENGTH = '/wind/strength/vs/0' # fan_mode
|
||||
HREF_WIND_DIRECTION = '/wind/direction/vs/0' # swing_mode
|
||||
# Newer boards (issue #126, TP1X_DA-AC-RAC-01011 WindFree variant) report no
|
||||
# HREF_WIND_DIRECTION at all and instead carry a 2-axis oscillation resource
|
||||
# (separate vertical/horizontal Swing|Fix toggles, each with its own angle).
|
||||
# climate.py falls back to this when HREF_WIND_DIRECTION is absent, the same
|
||||
# duality pattern as the OCF/vendor temperature channel below.
|
||||
HREF_WIND_OSCILLATION = '/wind/oscillation/vs/0' # swing_mode fallback
|
||||
HREF_CONVENIENT = '/mode/convenient/vs/0' # preset_mode
|
||||
HREF_TEMPS_VS = '/temperatures/vs/0' # vendor temp fallback (items[] array)
|
||||
|
||||
CLIMATE_CONSUMED_HREFS = [
|
||||
HREF_POWER, HREF_POWER_VS, HREF_TEMP_CURRENT, HREF_TEMP_DESIRED,
|
||||
HREF_TEMP_CONTROL, HREF_TEMPS_VS, HREF_WIND_STRENGTH, HREF_WIND_DIRECTION,
|
||||
HREF_CONVENIENT,
|
||||
HREF_WIND_OSCILLATION, HREF_CONVENIENT,
|
||||
]
|
||||
|
||||
|
||||
@@ -177,6 +183,15 @@ def _climate_write(payload, rep, href=None):
|
||||
return (['wind', 'strength', 'vs', '0'], {'x.com.samsung.da.modes': value})
|
||||
if kind == 'swing':
|
||||
return (['wind', 'direction', 'vs', '0'], {'x.com.samsung.da.modes': value})
|
||||
if kind == 'oscillation':
|
||||
# value is the HA swing_mode string ('off'/'vertical'/'horizontal'/
|
||||
# 'both'); both axes are independent Swing|Fix toggles on this
|
||||
# resource, so one HA value maps to a pair of fields written
|
||||
# together (see climate.py's oscillation fallback).
|
||||
return (['wind', 'oscillation', 'vs', '0'], {
|
||||
'vertical': 'Swing' if value in ('vertical', 'both') else 'Fix',
|
||||
'horizontal': 'Swing' if value in ('horizontal', 'both') else 'Fix',
|
||||
})
|
||||
if kind == 'preset':
|
||||
return (['mode', 'convenient', 'vs', '0'], {'x.com.samsung.da.modes': value})
|
||||
return None
|
||||
@@ -299,6 +314,31 @@ CURRENT_LIMIT = Capability(
|
||||
),
|
||||
)
|
||||
|
||||
# Overload-response setting (issue #126, TP1X_DA-AC-RAC-01011 WindFree
|
||||
# variant): `operation` toggles the feature and `mode` picks 'Alarm' vs
|
||||
# 'PowerSaving' out of `supportedModes`, with a `savingTime` duration
|
||||
# ('20'/'40'/'60' minutes) alongside. Plausible shape (compressor-overload
|
||||
# alarm vs. automatic power throttling), but nothing in the dump confirms
|
||||
# the exact behavioral difference between the two modes or whether writing
|
||||
# 'operation' is safe on live HVAC hardware -- exposed read-only per the
|
||||
# 'don't guess' rule, same precedent as CURRENT_LIMIT above.
|
||||
ANOMALY_LOAD = Capability(
|
||||
href='/anomalyload/vs/0',
|
||||
poll_tier='cold',
|
||||
entities=(
|
||||
BinarySensorDesc(key='overload_protection_active', field='operation',
|
||||
icon='mdi:flash-alert',
|
||||
entity_category='diagnostic',
|
||||
value_fn=lambda v: v == 'On'),
|
||||
SensorDesc(key='overload_protection_mode', field='mode',
|
||||
device_class='enum',
|
||||
options=('alarm', 'powersaving'),
|
||||
translation_key='overload_protection_mode',
|
||||
icon='mdi:flash-alert', entity_category='diagnostic',
|
||||
value_fn=lambda v: v.lower() if isinstance(v, str) else v),
|
||||
),
|
||||
)
|
||||
|
||||
# The climate entity already surfaces current_temperature as a card
|
||||
# attribute, but that's not enough for history graphs/automations/
|
||||
# statistics -- issue #75 asked for a standalone sensor. Same OCF-standard-
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
"current_limit_enabled": {
|
||||
"name": "Current limit enabled"
|
||||
},
|
||||
"overload_protection_active": {
|
||||
"name": "Overload protection active"
|
||||
},
|
||||
"cycle_active": {
|
||||
"name": "Running"
|
||||
},
|
||||
@@ -515,6 +518,13 @@
|
||||
"current_limit_level": {
|
||||
"name": "Current limit level"
|
||||
},
|
||||
"overload_protection_mode": {
|
||||
"name": "Overload protection mode",
|
||||
"state": {
|
||||
"alarm": "Alarm",
|
||||
"powersaving": "Power saving"
|
||||
}
|
||||
},
|
||||
"current_temp_c": {
|
||||
"name": "Temperature"
|
||||
},
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
"current_limit_enabled": {
|
||||
"name": "Stroombegrenzing ingeschakeld"
|
||||
},
|
||||
"overload_protection_active": {
|
||||
"name": "Overbelastingsbeveiliging actief"
|
||||
},
|
||||
"cycle_active": {
|
||||
"name": "Actief"
|
||||
},
|
||||
@@ -515,6 +518,13 @@
|
||||
"current_limit_level": {
|
||||
"name": "Niveau stroombegrenzing"
|
||||
},
|
||||
"overload_protection_mode": {
|
||||
"name": "Modus overbelastingsbeveiliging",
|
||||
"state": {
|
||||
"alarm": "Alarm",
|
||||
"powersaving": "Energiebesparing"
|
||||
}
|
||||
},
|
||||
"current_temp_c": {
|
||||
"name": "Temperatuur"
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user