Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba089dbb5c | ||
|
|
0d0ffb57dd | ||
|
|
fe0db8586f | ||
|
|
8814fffa4f | ||
|
|
12922909c0 | ||
|
|
9d3782a29a | ||
|
|
edff7385c6 | ||
|
|
e684146f61 | ||
|
|
bc03ada208 | ||
|
|
67012c57d7 | ||
|
|
dbc5c55a97 | ||
|
|
19a2c03609 | ||
|
|
76f2c3c0cd | ||
|
|
a59ef6cca9 | ||
|
|
bc21f5f8f5 | ||
|
|
ab035a94af | ||
|
|
f6fbfc1f7f | ||
|
|
75466761a1 | ||
|
|
02d009380d | ||
|
|
9f1bcad3ec | ||
|
|
eeece4906c | ||
|
|
21af5708cb | ||
|
|
627b761462 | ||
|
|
3735d8b806 | ||
|
|
65fa80c71c | ||
|
|
1abaad7f40 | ||
|
|
389c65adbc | ||
|
|
74bdc04f56 | ||
|
|
f949ff04c2 | ||
|
|
3f9789512d | ||
|
|
cbe881818b | ||
|
|
2b85e20108 | ||
|
|
e5cd212a34 | ||
|
|
11c71a62e8 | ||
|
|
6d73ac8694 | ||
|
|
1cfe126313 | ||
|
|
8d1ecb4f2a | ||
|
|
0c1231794a | ||
|
|
67b28ed10f | ||
|
|
f12f67b2b3 | ||
|
|
2f7170c448 | ||
|
|
b8ef430ed4 | ||
|
|
cd3a47f9a4 | ||
|
|
ac995dcbd4 | ||
|
|
d80bd550fe | ||
|
|
cc16766b9d | ||
|
|
84465aee72 | ||
|
|
711a71876d | ||
|
|
9004125c97 | ||
|
|
0dd8bfb5fc | ||
|
|
9652a14f64 | ||
|
|
bb20eea191 | ||
|
|
0fbac7f14d | ||
|
|
78a545341b | ||
|
|
a4981f40a2 | ||
|
|
17cd78d975 | ||
|
|
863fe32526 | ||
|
|
13d2a38f5d | ||
|
|
d9e7daa203 | ||
|
|
d27bfc6405 | ||
|
|
bee4466b45 | ||
|
|
cef187b7af | ||
|
|
2265c52c77 | ||
|
|
b921bdbb28 | ||
|
|
9d28b088cb | ||
|
|
22b4508f95 | ||
|
|
f45bd6a72c | ||
|
|
1424c2222e | ||
|
|
ef66d1db71 | ||
|
|
16cb01ce5d | ||
|
|
676074b2f8 | ||
|
|
846aefbcba | ||
|
|
895fd87d2c | ||
|
|
248e473abe | ||
|
|
6828d0152b | ||
|
|
d6534c788a | ||
|
|
89fea83c80 | ||
|
|
d2787327fd | ||
|
|
1f7bdc9ac6 | ||
|
|
61a953d39a | ||
|
|
95ce358d55 | ||
|
|
5e2c23a62d | ||
|
|
b6f0bc22cb | ||
|
|
07c20e82aa | ||
|
|
efea9e9888 | ||
|
|
94798b5d9b | ||
|
|
f5e99d71e3 | ||
|
|
8ed3d1467f | ||
|
|
68dee12eb4 | ||
|
|
082a1b3cd4 | ||
|
|
00db7890f5 | ||
|
|
55765fdf9a | ||
|
|
d24c94e303 | ||
|
|
71f2101d11 | ||
|
|
ba5a3b529d | ||
|
|
f8849df8a6 |
No files matched your search
+1
-1
@@ -6,4 +6,4 @@ FROM ghcr.io/home-assistant/home-assistant:stable
|
||||
# repeats the install attempt on every container recreate. Baking
|
||||
# smartthings-local into the image keeps the dev container usable
|
||||
# offline and avoids relying on that runtime install path.
|
||||
RUN pip3 install --no-cache-dir "smartthings-local>=0.1.2"
|
||||
RUN pip3 install --no-cache-dir "smartthings-local>=0.1.8"
|
||||
@@ -159,7 +159,7 @@ data:
|
||||
href: /mode/vs/0
|
||||
```
|
||||
|
||||
returning `{"href", "actual_href", "code", "raw_code", "rep"}` off a **live GET straight from the device**, not the cache — which can be up to a poll interval stale, exactly the staleness that would make `held` above meaningless. Omit `href` and you get `{"resources": {href: rep, ...}}`, the cached snapshot of everything this integration currently tracks on that device, with no GET at all — useful for seeing what's there before you start writing to it, without hammering the appliance.
|
||||
returning `{"href", "actual_href", "code", "raw_code", "rep"}` off a **live GET straight from the device**, not the cache — which can be up to a poll interval stale, exactly the staleness that would make `held` above meaningless. A sixth key, `body`, appears only when the response isn't a Property map: a Collection (`/device/0`, and the `x.com.samsung.devcol` siblings some boards expose) answers a CBOR list, which `rep` can't carry, and which would otherwise read as an accepted-but-empty resource. Omit `href` and you get `{"resources": {href: rep, ...}}`, the cached snapshot of everything this integration currently tracks on that device, with no GET at all — useful for seeing what's there before you start writing to it, without hammering the appliance.
|
||||
|
||||
The **Debug write** panel under a device's Configure menu (Part 4) is the friendlier single-write path over this same machinery — pick an href, type a payload, see the result — for when you don't need a sequence.
|
||||
|
||||
@@ -270,6 +270,12 @@ If reconnects become persistent (more than a handful per minute), something's ac
|
||||
|
||||
Deregistering a device in SmartThings causes a reset of its network settings as soon as it accesses Samsung's servers, dropping it off Wi-Fi until it's re-onboarded through the SmartThings app. As such, consider keeping devices registered even if egress-blocked, to avoid them resetting upon brief internet access.
|
||||
|
||||
### Restarting while an appliance is powered off
|
||||
|
||||
If Home Assistant restarts while an appliance is unplugged or switched off at the wall, its device and entities still load — restored from the last successful discovery, showing `unavailable` until the appliance answers again. Automations and dashboards keep referring to entities that exist, and the integration retries in the background, so the device comes back on its own within a poll cycle of being powered on. Entities read `unavailable` rather than their last known values on purpose: the integration can't verify what a disconnected appliance is doing, and recorded history is kept by the recorder either way.
|
||||
|
||||
This only applies to an appliance the integration has reached at least once. A brand-new device that has never answered has nothing to restore from, so setting it up still requires it to be reachable.
|
||||
|
||||
### Multi-subdevice ("2-in-1") air conditioner systems
|
||||
|
||||
Some Samsung installs run more than one indoor subdevice off a single outdoor unit, all reachable over the *one* IP/DTLS session your config entry connects to (a floor-standing + wall-mounted 2-in-1 is a common shape). The integration discovers any sibling subdevices automatically, once, right after the first successful poll — there's nothing to configure. Each discovered subdevice gets its own HA device (linked to the main one via "via device") and its own `climate` card, so it lands in its own room in the dashboard instead of being invisible or mixed into the master's state.
|
||||
|
||||
@@ -2,9 +2,15 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
import logging
|
||||
import re
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER as PARTICULATE_UNIT,
|
||||
)
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import Event, HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
@@ -12,8 +18,8 @@ from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import CONF_HOST, CONF_PORT, CONF_SERIAL, DOMAIN, PLATFORMS
|
||||
from .coordinator import LocalThingsCoordinator
|
||||
from .const import CONF_DEVICE_TYPE, CONF_HOST, CONF_PORT, CONF_SERIAL, DOMAIN, PLATFORMS
|
||||
from .coordinator import LocalThingsCoordinator, snapshot_store
|
||||
from .registry.identity import resolve_serial
|
||||
from .services import async_setup_services
|
||||
|
||||
@@ -125,6 +131,100 @@ def _repair_placeholder_keys(hass: HomeAssistant, entry: ConfigEntry, serial: st
|
||||
)
|
||||
|
||||
|
||||
# Registries whose Dust/FineDust/SuperFineDust sensors gained pm10/pm25/pm1
|
||||
# and a unit in the release that introduced entry version 3. Deliberately
|
||||
# not every family reading /sensors/vs/0: range_hood and airconditioner
|
||||
# still declare no unit for their identically-named sensors, and relabelling
|
||||
# their statistics to µg/m³ would assert a unit those entities don't report
|
||||
# -- creating the very mismatch this migration exists to prevent.
|
||||
_PARTICULATE_TYPED_IN_V3 = frozenset({"air_purifier", "air_monitor"})
|
||||
|
||||
# unique_id is f"{DOMAIN}_{serial}_{state_key}"; state_key is the descriptor
|
||||
# key, optionally carrying a subdevice prefix and a trailing `_<n>` instance
|
||||
# (registry/adapter._key, discovery.instance_suffix). Matching the tail rather
|
||||
# than rebuilding the whole id keeps this working for a renamed entity, whose
|
||||
# entity_id -- and so its statistic_id -- no longer follows from the key.
|
||||
_PARTICULATE_KEY_RE = re.compile(r"_(?:super_fine_dust|fine_dust|dust)(?:_\d+)?$")
|
||||
|
||||
|
||||
@callback
|
||||
def _relabel_particulate_statistics(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Point existing particulate statistics at the unit they always were.
|
||||
|
||||
These sensors recorded long-term statistics with no unit, and the
|
||||
release carrying this migration gives them µg/m³. Home Assistant treats
|
||||
that as a unit change it can't convert and *suppresses statistics
|
||||
generation entirely* for the entity until someone resolves the repair
|
||||
(sensor.recorder._update_issues -> UNITS_CHANGED_ISSUE, and the matching
|
||||
`continue` in its compile path). Silently freezing the history we just
|
||||
finished labelling is the worst of both outcomes, so the metadata is
|
||||
corrected up front instead.
|
||||
|
||||
Only the metadata row is rewritten, never the recorded values. The
|
||||
readings were always µg/m³ concentrations (issue #325); what was missing
|
||||
was the label, so there is nothing to convert and no way for this to
|
||||
distort history. That is also why it uses
|
||||
`async_update_statistics_metadata` and not `change_statistics_unit`,
|
||||
which would scale every stored value.
|
||||
|
||||
A no-op when this device family isn't one that gained the unit, or when
|
||||
the device never recorded any statistics -- the underlying UPDATE simply
|
||||
matches no rows.
|
||||
|
||||
Returns False only when the recorder wasn't loaded, meaning the caller
|
||||
should leave the entry on its old version and try again next start.
|
||||
"""
|
||||
if entry.data.get(CONF_DEVICE_TYPE) not in _PARTICULATE_TYPED_IN_V3:
|
||||
return True
|
||||
if "recorder" not in hass.config.components:
|
||||
# after_dependencies orders the recorder ahead of us when it's
|
||||
# configured, so this is either an install without it (nothing to
|
||||
# relabel, and the retry costs one set lookup per start) or a boot
|
||||
# where it failed to come up. Not distinguishable here, and burning
|
||||
# the one-shot migration on the second case would leave the
|
||||
# statistics suppressed for good.
|
||||
_LOGGER.debug("recorder not loaded, deferring statistics relabel")
|
||||
return False
|
||||
|
||||
from homeassistant.components.recorder.statistics import (
|
||||
STATISTIC_UNIT_TO_UNIT_CONVERTER,
|
||||
async_update_statistics_metadata,
|
||||
)
|
||||
|
||||
kwargs: dict[str, Any] = {"new_unit_of_measurement": PARTICULATE_UNIT}
|
||||
# `new_unit_class` only exists from HA 2025.11; hacs.json still supports
|
||||
# 2025.1, where passing it is a TypeError -- which would propagate out of
|
||||
# async_migrate_entry and fail the whole entry. Where it is supported it
|
||||
# must be named, since omitting it is deprecated from HA 2026.11. µg/m³
|
||||
# has a converter, so the value is 'concentration' rather than None.
|
||||
if "new_unit_class" in inspect.signature(async_update_statistics_metadata).parameters:
|
||||
converter = STATISTIC_UNIT_TO_UNIT_CONVERTER.get(PARTICULATE_UNIT)
|
||||
kwargs["new_unit_class"] = converter.UNIT_CLASS if converter is not None else None
|
||||
|
||||
ent_reg = er.async_get(hass)
|
||||
for registry_entry in er.async_entries_for_config_entry(ent_reg, entry.entry_id):
|
||||
if registry_entry.domain != "sensor":
|
||||
continue
|
||||
if not _PARTICULATE_KEY_RE.search(registry_entry.unique_id):
|
||||
continue
|
||||
_LOGGER.debug("relabelling statistics unit for %s", registry_entry.entity_id)
|
||||
try:
|
||||
async_update_statistics_metadata(hass, registry_entry.entity_id, **kwargs)
|
||||
except Exception:
|
||||
# Relabelling is a convenience: without it the user gets Home
|
||||
# Assistant's own units_changed repair, which is where they were
|
||||
# before this migration existed. Never worth failing setup over,
|
||||
# so no recorder-side surprise can cost them the integration.
|
||||
_LOGGER.warning(
|
||||
"Could not relabel statistics unit for %s; Home Assistant will "
|
||||
"offer a units-changed repair for it instead",
|
||||
registry_entry.entity_id,
|
||||
exc_info=True,
|
||||
)
|
||||
return True
|
||||
return True
|
||||
|
||||
|
||||
async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Migrate an entry to the current version.
|
||||
|
||||
@@ -132,8 +232,11 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
can key its registry entries before the first poll (issue #236), and
|
||||
repairs whatever the old placeholder-keyed registration already
|
||||
orphaned.
|
||||
|
||||
v2 -> v3 relabels the recorded statistics for the particulate sensors,
|
||||
which gained a device_class/unit in the same release (issue #325).
|
||||
"""
|
||||
if entry.version > 2:
|
||||
if entry.version > 3:
|
||||
return False # downgrade: this release doesn't know the newer shape
|
||||
|
||||
if entry.version == 1:
|
||||
@@ -147,23 +250,40 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
_repair_placeholder_keys(hass, entry, serial)
|
||||
_LOGGER.debug("migrated entry %s to version 2 (serial=%s)", entry.entry_id, serial)
|
||||
|
||||
if entry.version == 2 and _relabel_particulate_statistics(hass, entry):
|
||||
hass.config_entries.async_update_entry(entry, version=3)
|
||||
_LOGGER.debug("migrated entry %s to version 3", entry.entry_id)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
coordinator = LocalThingsCoordinator(hass, entry)
|
||||
|
||||
# Before the first refresh, so the coordinator keeps rescheduling even
|
||||
# when that refresh fails and leaves nothing subscribed: the base class
|
||||
# only re-arms its timer while it has listeners, and an offline load can
|
||||
# legitimately have zero live entities (every one of them disabled, say).
|
||||
# Without this the entry loads once and never polls again (issue #295).
|
||||
entry.async_on_unload(coordinator.async_add_listener(lambda: None))
|
||||
|
||||
try:
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
except Exception as err:
|
||||
# `_poll_once` deliberately leaves the session up on a TimeoutError
|
||||
# (see its docstring), so a refresh failing that way leaves a live,
|
||||
# bound UDP socket nothing would ever close. HA retries setup with a
|
||||
# new coordinator, and the source port is fixed by design
|
||||
# (`_local_source_port`), so an abandoned socket would squat the
|
||||
# exact port the next attempt binds.
|
||||
await coordinator.async_close()
|
||||
raise ConfigEntryNotReady(f"Cannot connect to device: {err}") from err
|
||||
except ConfigEntryNotReady:
|
||||
# An entry that has polled successfully before comes up on its last
|
||||
# known entity set and keeps retrying on the normal poll interval,
|
||||
# rather than sitting in setup-retry with a device that reads as
|
||||
# broken and entities that exist only as registry rows (issue #295).
|
||||
#
|
||||
# An entry that has never reached the device has no snapshot, so
|
||||
# there is nothing to show and no device metadata to name it with --
|
||||
# that case still fails, which is also what keeps the door open for
|
||||
# setup flows that need to interact with the device (issue #168).
|
||||
if not await coordinator.async_rehydrate():
|
||||
await coordinator.async_close()
|
||||
raise
|
||||
|
||||
hass.data[DOMAIN][entry.entry_id] = coordinator
|
||||
|
||||
# Send the DTLS close_notify on Core shutdown, not just on unload (issue
|
||||
@@ -220,6 +340,16 @@ async def async_remove_config_entry_device(
|
||||
return not (device.identifiers & live)
|
||||
|
||||
|
||||
async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
"""Delete the discovery snapshot this entry accumulated (issue #295).
|
||||
|
||||
Nothing else would: the store is keyed on entry_id, so re-adding the same
|
||||
appliance mints a new one and the old file would linger in .storage
|
||||
forever.
|
||||
"""
|
||||
await snapshot_store(hass, entry).async_remove()
|
||||
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
unloaded = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
if unloaded:
|
||||
|
||||
@@ -58,9 +58,6 @@ from .registry.capabilities.airconditioner import (
|
||||
from .registry.capabilities.airconditioner import (
|
||||
HREF_POWER_VS as POWER_VS_HREF,
|
||||
)
|
||||
from .registry.capabilities.airconditioner import (
|
||||
HREF_TEMP_CONTROL as TEMP_CONTROL_HREF,
|
||||
)
|
||||
from .registry.capabilities.airconditioner import (
|
||||
HREF_TEMP_CURRENT as TEMP_CURRENT_HREF,
|
||||
)
|
||||
@@ -80,6 +77,7 @@ from .registry.capabilities.airconditioner import (
|
||||
HREF_WIND_STRENGTH as WIND_STRENGTH_HREF,
|
||||
)
|
||||
from .registry.capabilities.airconditioner import (
|
||||
_temperature_step,
|
||||
extend_option_code_bit,
|
||||
has_extend_option_code,
|
||||
has_option_code,
|
||||
@@ -558,12 +556,11 @@ class LocalThingsClimate(LocalThingsEntity, ClimateEntity):
|
||||
|
||||
@property
|
||||
def target_temperature_step(self) -> float:
|
||||
return (
|
||||
_num(self._rep(TEMP_CONTROL_HREF).get("increment"))
|
||||
or _num(self._rep(TEMP_CONTROL_HREF).get("x.com.samsung.da.increment"))
|
||||
or _num(self._temps_vs().get("x.com.samsung.da.increment"))
|
||||
or 1.0
|
||||
)
|
||||
# Shared with the write path (airconditioner._climate_write) so a
|
||||
# step read here always matches the step a write is quantized to --
|
||||
# self._resources is this entity's own subdevice's canonical view
|
||||
# (issue #177), the same shape _temperature_step expects.
|
||||
return _temperature_step(self._resources) or 1.0
|
||||
|
||||
# -- hvac mode ----------------------------------------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1,377 @@
|
||||
"""Cloud "Download" programs on a laundry device (issue #342).
|
||||
|
||||
Some course tables carry a course whose recipe isn't fixed in firmware --
|
||||
selecting it runs whichever program was last pushed down from the
|
||||
SmartThings cloud ("Download" / "Downloaded" in the course catalog). Three
|
||||
tokens on ``/course/vs/0``'s ``x.com.samsung.da.options`` array drive it:
|
||||
|
||||
``CloudExtraCourse_<slot><slot>...`` the device's own list of downloaded
|
||||
program slots, one byte each -- the cloud counterpart of
|
||||
``EditCourseList_`` for local courses.
|
||||
``CloudCourse_<blob>`` the persisted default program.
|
||||
``OneTimeCloudCourse_<blob>`` a this-run-only override.
|
||||
|
||||
A ``<blob>`` is an opaque fixed-width payload whose byte 2 is the slot id
|
||||
it belongs to. Confirmed on two independent DA_WM_TP1_21_COMMON washers:
|
||||
the issue #342 reporter's, whose ``CloudExtraCourse_0A5C286B2D0C55301A``
|
||||
enumerates nine slots matching byte 2 of all nine of its programs exactly,
|
||||
and the WA55A7700AV dump in ``tests/fixtures``, whose two-slot
|
||||
``CloudExtraCourse_5958`` likewise matches its ``CloudCourse`` blob's byte
|
||||
2. Blob width is *not* fixed across boards (20 bytes vs 16), which is one
|
||||
reason nothing here ever synthesizes one.
|
||||
|
||||
``CloudExtraCourse_`` does not mean the same thing on every family, so
|
||||
nothing keys off it directly -- see ``cloud_slots``, which is what the rest
|
||||
of this module and its callers gate on. Even then, a device can advertise a
|
||||
slot whose payload has never been observed, so ``cloud_slots`` answers
|
||||
"which exist" while the store answers "which are usable"; the two are
|
||||
deliberately allowed to disagree.
|
||||
|
||||
What this module does and deliberately does not do
|
||||
--------------------------------------------------
|
||||
The device advertises *which* slots exist but never what any of them is
|
||||
called, and never the full blob for a slot other than the one currently
|
||||
loaded. A blob is only observable while the device happens to be sitting on
|
||||
that program, so the full payload is *learned by observation* and persisted
|
||||
(same rationale as learned.py's mode store), and the human-readable name is
|
||||
supplied by the user in the options flow. Nothing is hardcoded: no catalog
|
||||
of program ids, no table of blobs, no assumed Download course code. A
|
||||
hardcoded catalog was considered and rejected -- a blob is cloud-assigned
|
||||
per account/region, so one user's captured payload is not evidence about
|
||||
anyone else's device.
|
||||
|
||||
Blobs are replayed byte-for-byte, exactly as captured, and never
|
||||
decomposed or rebuilt. (Bytes 5/7/9 of the reporter's blobs do decode
|
||||
cleanly to that program's temperature/rinse/spin, but the same offsets
|
||||
produce nonsense against the WA55A7700AV blob, so that decode is recorded
|
||||
in docs/investigations/download-cycle.md rather than shipped.)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import threading
|
||||
|
||||
from .const import CONF_CLOUD_COURSES
|
||||
from .registry.capabilities.common import hex_pairs, option_value
|
||||
|
||||
COURSE_HREF = "/course/vs/0"
|
||||
|
||||
EXTRA_PREFIX = "CloudExtraCourse"
|
||||
DEFAULT_PREFIX = "CloudCourse"
|
||||
ONESHOT_PREFIX = "OneTimeCloudCourse"
|
||||
COURSE_PREFIX = "Course"
|
||||
|
||||
# Synthetic, integration-owned field the coordinator merges onto
|
||||
# /course/vs/0's rep so the registry's exists_fn/rep_fn/options/write_fn all
|
||||
# reach this store through their existing signatures -- rep_fn in particular
|
||||
# receives only its own href's rep, never the resource snapshot, so a
|
||||
# sibling-resource lookup isn't available to it. Namespaced away from
|
||||
# Samsung's own 'x.com.samsung.da.' fields so it can never collide with one,
|
||||
# and merged at read time only: it is never written to the state cache, never
|
||||
# sent to the device, and never part of a diagnostics dump.
|
||||
FIELD = "x.localthings.cloudCourses"
|
||||
|
||||
# Raw-value namespace for a cloud program in the cycle select. A slot id is
|
||||
# itself two hex chars, exactly like a local course code, so the two would be
|
||||
# indistinguishable (and could collide outright) as bare select values.
|
||||
RAW_PREFIX = "cloud:"
|
||||
|
||||
# A blob whose first two bytes are FFFF means "no program loaded" rather than
|
||||
# naming one -- WA55A7700AV reports
|
||||
# OneTimeCloudCourse_FFFF010049004D004A804C0037F0AC00 while sitting on a
|
||||
# perfectly ordinary local course, and its byte 2 (01) is not one of the slots
|
||||
# its own CloudExtraCourse_ advertises.
|
||||
_SENTINEL_PREFIX = "FFFF"
|
||||
|
||||
# Distinct from None, which is a real observation that carried no payload.
|
||||
# Only "never observed" suppresses a candidate; absent-then-loaded is a
|
||||
# genuine transition and should count.
|
||||
_UNOBSERVED = object()
|
||||
|
||||
# Byte offset within a blob that carries its slot id.
|
||||
_SLOT_BYTE = 2
|
||||
_MIN_BLOB_BYTES = 4
|
||||
|
||||
|
||||
def _hex_bytes(blob):
|
||||
if not isinstance(blob, str) or len(blob) % 2 or len(blob) < _MIN_BLOB_BYTES * 2:
|
||||
return []
|
||||
try:
|
||||
int(blob, 16)
|
||||
except ValueError:
|
||||
return []
|
||||
return hex_pairs(blob.upper())
|
||||
|
||||
|
||||
def is_loaded(blob) -> bool:
|
||||
"""True when `blob` names an actual program rather than 'none'."""
|
||||
return _slot_and_loaded(blob)[1]
|
||||
|
||||
|
||||
def slot_of(blob) -> str | None:
|
||||
"""The slot id `blob` belongs to, or None if it names no program."""
|
||||
slot, loaded = _slot_and_loaded(blob)
|
||||
return slot if loaded else None
|
||||
|
||||
|
||||
def _slot_and_loaded(blob) -> tuple[str | None, bool]:
|
||||
"""Both answers off one parse -- the public pair above needs the same
|
||||
byte split, and observe() asks for both about the same payload."""
|
||||
parts = _hex_bytes(blob)
|
||||
if not parts:
|
||||
return None, False
|
||||
if "".join(parts[:2]) == _SENTINEL_PREFIX:
|
||||
return None, False
|
||||
return parts[_SLOT_BYTE], True
|
||||
|
||||
|
||||
def advertised_slots(rep) -> list[str]:
|
||||
"""Slot ids this device says it has downloaded programs in, from its own
|
||||
CloudExtraCourse_ token. The authority on *which* programs exist -- this
|
||||
is never inferred from what has been learned so far, so "3 of 9
|
||||
discovered" is answerable."""
|
||||
raw = option_value(rep.get("x.com.samsung.da.options"), EXTRA_PREFIX)
|
||||
if not isinstance(raw, str) or len(raw) % 2:
|
||||
return []
|
||||
# Preserve the device's own order (first-seen wins) while dropping any
|
||||
# repeat, so the flow lists slots the way the appliance does.
|
||||
return list(dict.fromkeys(hex_pairs(raw.upper())))
|
||||
|
||||
|
||||
def cloud_slots(rep, courses) -> list[str]:
|
||||
"""Advertised slots that are not already selectable courses.
|
||||
|
||||
`CloudExtraCourse_` does not mean the same thing on every family. On the
|
||||
washers its bytes are opaque payload slots sharing nothing with the
|
||||
device's own course list, and selecting one needs the full payload. On
|
||||
the DW5000C dishwasher all four of its bytes *are* course codes in that
|
||||
device's own list (8E/8D/8F/02 -- Plastic, Pots and pans, Baby Care, and
|
||||
one untranslated), so there it is tagging which of its ordinary courses
|
||||
came from the cloud. Those are already selectable as plain `Course_`
|
||||
writes and need nothing from this module.
|
||||
|
||||
Subtracting the course list tells the two apart without having to guess
|
||||
the family: what remains is slots that cannot be selected any other way,
|
||||
which is exactly the set this module exists for.
|
||||
"""
|
||||
known = {c.upper() for c in courses or ()}
|
||||
return [slot for slot in advertised_slots(rep) if slot not in known]
|
||||
|
||||
|
||||
def supports_cloud_courses(rep, courses) -> bool:
|
||||
"""True for a device with downloaded programs it cannot otherwise run."""
|
||||
return bool(cloud_slots(rep, courses))
|
||||
|
||||
|
||||
def loaded_slot(rep) -> str | None:
|
||||
"""The slot whose payload the appliance currently holds -- the one-time
|
||||
override when one is set, else the saved default.
|
||||
|
||||
Deliberately not gated on the course being Download: the guided setup
|
||||
flow watches this before the Download course has been confirmed, and
|
||||
during that walk a change here *is* the signal that the user selected a
|
||||
different program. A stale token can't produce a false positive because
|
||||
the flow waits for a change from its own baseline, not for a value.
|
||||
"""
|
||||
options = rep.get("x.com.samsung.da.options")
|
||||
return slot_of(option_value(options, ONESHOT_PREFIX)) or slot_of(
|
||||
option_value(options, DEFAULT_PREFIX)
|
||||
)
|
||||
|
||||
|
||||
def _coerce(stored) -> tuple[str | None, dict[str, dict[str, str]]]:
|
||||
"""Restore the persisted record, dropping anything not the shape this
|
||||
module writes -- it round-trips through the config entry as plain JSON
|
||||
and a hand-edited .storage file must not be able to crash setup (same
|
||||
posture as learned._coerce)."""
|
||||
if not isinstance(stored, dict):
|
||||
return None, {}
|
||||
download = stored.get("download_course")
|
||||
if not isinstance(download, str) or not download:
|
||||
download = None
|
||||
slots: dict[str, dict[str, str]] = {}
|
||||
raw_slots = stored.get("slots")
|
||||
if isinstance(raw_slots, dict):
|
||||
for slot, record in raw_slots.items():
|
||||
if not isinstance(slot, str) or not isinstance(record, dict):
|
||||
continue
|
||||
blob = record.get("blob")
|
||||
if not is_loaded(blob) or slot_of(blob) != slot.upper():
|
||||
continue
|
||||
name = record.get("name")
|
||||
slots[slot.upper()] = {
|
||||
"blob": blob.upper(),
|
||||
"name": name if isinstance(name, str) and name.strip() else "",
|
||||
}
|
||||
return download, slots
|
||||
|
||||
|
||||
def persist(hass, entry, record: dict) -> None:
|
||||
"""Write `record` onto the entry. Runs on the event loop, which
|
||||
async_update_entry requires."""
|
||||
hass.config_entries.async_update_entry(entry, data={**entry.data, CONF_CLOUD_COURSES: record})
|
||||
|
||||
|
||||
class CloudCourses:
|
||||
"""Per-device store of discovered cloud programs.
|
||||
|
||||
Mutated from whichever thread applied the update (the DTLS reader for an
|
||||
OBSERVE notify, an executor thread for a poll -- see ObserveManager.apply),
|
||||
so every access takes the lock; persistence is the caller's job, on the
|
||||
event loop.
|
||||
"""
|
||||
|
||||
def __init__(self, stored_record=None) -> None:
|
||||
self._lock = threading.Lock()
|
||||
download, slots = _coerce(stored_record)
|
||||
self._download_course = download
|
||||
self._slots = slots
|
||||
# Course codes seen at the moment a one-time override was *loaded* --
|
||||
# candidates for "which course means Download on this board", pending
|
||||
# user confirmation (see download_candidates).
|
||||
self._candidates: dict[str, int] = {}
|
||||
# Last one-time payload seen, so a load can be told from a poll that
|
||||
# merely re-reports one. _UNOBSERVED until the first rep arrives.
|
||||
self._last_oneshot: object = _UNOBSERVED
|
||||
|
||||
# -- learning ---------------------------------------------------------
|
||||
|
||||
def observe(self, rep: dict) -> bool:
|
||||
"""Learn from one applied /course/vs/0 rep; True if anything changed.
|
||||
|
||||
Two facts are learnable here. A blob is recorded against the slot its
|
||||
own byte 2 names, so a program only has to be sitting loaded once --
|
||||
on either token -- to be replayable forever after.
|
||||
|
||||
The Download course code is only ever taken as a *candidate*, and
|
||||
only at the moment the one-time payload actually *changes* to a
|
||||
loaded value. That instant is the one the device is known to accept a
|
||||
program on, so the course selected then is real evidence. Counting
|
||||
every poll instead would rank by dwell time: tokens in this array are
|
||||
replaced by prefix and never evicted, so a stale OneTimeCloudCourse_
|
||||
outlives its run and sits there through however many polls the
|
||||
appliance spends on some ordinary course afterwards -- which is
|
||||
exactly the course that would then be suggested. A candidate is still
|
||||
never applied without confirmation in the options flow, but a
|
||||
confident wrong suggestion is most of the way to a wrong write, and a
|
||||
wrong write here starts a real wash cycle.
|
||||
"""
|
||||
options = rep.get("x.com.samsung.da.options")
|
||||
if not options:
|
||||
return False
|
||||
known_slots = advertised_slots(rep)
|
||||
oneshot = option_value(options, ONESHOT_PREFIX)
|
||||
with self._lock:
|
||||
# Compared once, at the end, against where this pass started --
|
||||
# not set per assignment. The two tokens can name the same slot
|
||||
# with different payloads (a downloaded program with its settings
|
||||
# tweaked for one run is exactly that shape), and a per-assignment
|
||||
# flag would then report a change on every single poll forever:
|
||||
# each pass writes the default's payload and then the one-shot's
|
||||
# over it, so neither is ever "already stored". Every one of those
|
||||
# reports rewrites the config entry, which on the SD-card installs
|
||||
# this integration runs on is the one cost here that really bites.
|
||||
# The end state is stable (the one-shot is written last and wins),
|
||||
# so comparing start to end settles after the first pass.
|
||||
before = {slot: record["blob"] for slot, record in self._slots.items()}
|
||||
for prefix in (DEFAULT_PREFIX, ONESHOT_PREFIX):
|
||||
blob = option_value(options, prefix)
|
||||
slot = slot_of(blob)
|
||||
# A blob whose slot the device doesn't advertise is not a
|
||||
# program this appliance offers -- don't record it.
|
||||
if slot is None or (known_slots and slot not in known_slots):
|
||||
continue
|
||||
record = self._slots.get(slot)
|
||||
if record is None:
|
||||
self._slots[slot] = {"blob": blob.upper(), "name": ""}
|
||||
else:
|
||||
record["blob"] = blob.upper()
|
||||
changed = before != {slot: rec["blob"] for slot, rec in self._slots.items()}
|
||||
|
||||
course = option_value(options, COURSE_PREFIX)
|
||||
# Only a transition we actually watched happen counts. On the
|
||||
# first observation there is nothing to compare against, so a
|
||||
# payload sitting there is equally consistent with "just loaded"
|
||||
# and "left over from last week" -- and on a board that doesn't
|
||||
# clear the token when leaving Download, believing the former
|
||||
# proposes whatever ordinary course the appliance happens to be
|
||||
# on. Accepting that prefill would start a real wash cycle.
|
||||
# (The two dumps in the corpus taken off the Download course both
|
||||
# show the appliance clearing it to the FFFF sentinel, so this
|
||||
# may never fire in practice -- which is not a reason to rely on
|
||||
# it.) Restores don't persist _last_oneshot, so every restart
|
||||
# re-enters this first-observation state deliberately.
|
||||
first_ever = self._last_oneshot is _UNOBSERVED
|
||||
if course and is_loaded(oneshot) and not first_ever and oneshot != self._last_oneshot:
|
||||
self._candidates[course] = self._candidates.get(course, 0) + 1
|
||||
self._last_oneshot = oneshot
|
||||
return changed
|
||||
|
||||
# -- reads ------------------------------------------------------------
|
||||
|
||||
def download_candidates(self) -> list[str]:
|
||||
"""Course codes seen at the moment a one-time program was loaded,
|
||||
most-observed first -- what the options flow offers as the likely
|
||||
Download course. Never used for a write on its own."""
|
||||
with self._lock:
|
||||
ranked = sorted(self._candidates.items(), key=lambda kv: (-kv[1], kv[0]))
|
||||
return [code for code, _ in ranked]
|
||||
|
||||
def named(self) -> dict[str, str]:
|
||||
"""Slots that are both learned and named -- the only ones offerable
|
||||
as a cycle option. An unnamed slot has no label that isn't either
|
||||
invented or an opaque hex id, so it stays out of the UI until the
|
||||
user supplies one."""
|
||||
with self._lock:
|
||||
return {slot: record["name"] for slot, record in self._slots.items() if record["name"]}
|
||||
|
||||
def snapshot(self) -> dict:
|
||||
with self._lock:
|
||||
return {
|
||||
"download_course": self._download_course,
|
||||
"slots": {slot: dict(record) for slot, record in self._slots.items()},
|
||||
}
|
||||
|
||||
def view(self) -> dict:
|
||||
"""What the registry sees under FIELD: only what a write or a label
|
||||
can actually be built from, so a descriptor never has to re-apply
|
||||
this module's rules."""
|
||||
with self._lock:
|
||||
if not self._download_course:
|
||||
return {}
|
||||
return {
|
||||
"download_course": self._download_course,
|
||||
"programs": {
|
||||
slot: {"blob": record["blob"], "name": record["name"]}
|
||||
for slot, record in self._slots.items()
|
||||
if self._is_usable(record)
|
||||
},
|
||||
}
|
||||
|
||||
# -- writes -----------------------------------------------------------
|
||||
|
||||
def set_download_course(self, code: str | None) -> None:
|
||||
with self._lock:
|
||||
self._download_course = code or None
|
||||
|
||||
def set_name(self, slot: str, name: str) -> None:
|
||||
with self._lock:
|
||||
record = self._slots.get(slot.upper())
|
||||
if record is not None:
|
||||
record["name"] = name.strip()
|
||||
|
||||
@staticmethod
|
||||
def _is_usable(record) -> bool:
|
||||
"""A slot is offerable once it has a name. The device supplies the
|
||||
payload; only the user can supply the label, so this is the whole
|
||||
rule and it is stated once."""
|
||||
return bool(record["name"])
|
||||
|
||||
|
||||
def undiscovered(rep: dict, record: dict, courses) -> list[str]:
|
||||
"""Cloud slots that aren't yet usable -- unlearned or unnamed. What the
|
||||
Repairs issue counts, and what the options flow asks the user to walk the
|
||||
appliance through. Counts against cloud_slots, not every advertised byte:
|
||||
a slot that is already a selectable course is nothing to set up."""
|
||||
programs = record.get("slots") or {}
|
||||
return [s for s in cloud_slots(rep, courses) if not (programs.get(s) or {}).get("name")]
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
import datetime
|
||||
import errno
|
||||
@@ -34,6 +35,7 @@ from homeassistant.helpers.selector import (
|
||||
TextSelectorType,
|
||||
)
|
||||
|
||||
from . import cloudcourse
|
||||
from .const import (
|
||||
CLIENTHELLO_PROBE_RETRIES,
|
||||
CLIENTHELLO_PROBE_TIMEOUT_S,
|
||||
@@ -62,6 +64,8 @@ from .const import (
|
||||
)
|
||||
from .learned import persist as learned_persist
|
||||
from .learned import stored as learned_stored
|
||||
from .registry.capabilities.laundry import cycle_options, personal_course_labels
|
||||
from .registry.subdevices import MAIN
|
||||
|
||||
_TEXT = TextSelector(TextSelectorConfig(type=TextSelectorType.TEXT))
|
||||
_MULTILINE = TextSelector(TextSelectorConfig(type=TextSelectorType.TEXT, multiline=True))
|
||||
@@ -74,6 +78,14 @@ _HYSTERESIS_MINUTES = NumberSelector(
|
||||
)
|
||||
)
|
||||
|
||||
# Guided download-cycle setup: how long a round waits for the user to
|
||||
# select a program, and how often it live-reads /course/vs/0 while doing
|
||||
# so. The read takes the session lock, so the interval is a few seconds
|
||||
# rather than sub-second -- fast enough to feel immediate to someone
|
||||
# standing at the appliance, slow enough not to starve polling.
|
||||
_CLOUD_WAIT_TIMEOUT_S = 180.0
|
||||
_CLOUD_PROBE_INTERVAL_S = 3.0
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
_SAMSUNG_CLOUD_HOST = "connect-v2.samsungiotcloud.com"
|
||||
@@ -481,27 +493,84 @@ _CERT_ALERTS = frozenset(
|
||||
}
|
||||
)
|
||||
|
||||
# OpenSSL renders a received fatal alert into its error text as e.g.
|
||||
# "tlsv1 alert unknown ca", which DtlsCoapSession.connect() wraps in a
|
||||
# ConnectionError. Reading it back tells us what the appliance objected to.
|
||||
#
|
||||
# Deliberately not the library's diagnostic probe (stateless=False): that
|
||||
# mode commits association state on the device, and an orphaned association
|
||||
# makes the next attempt time out (RFC 6347 §4.2.8) -- a bad trade on a
|
||||
# path the user is about to retry.
|
||||
# Older smartthings-local (< 0.1.3) rendered a received fatal alert straight
|
||||
# into the handshake exception's text, e.g. "tlsv1 alert unknown ca" wrapped
|
||||
# in a ConnectionError -- reading it back told us what the appliance
|
||||
# objected to. 0.1.3's "redacted typed failures" removed that: connect()'s
|
||||
# exceptions now carry a fixed, non-sensitive message with the real OpenSSL
|
||||
# text neither included nor chained (see smartthings_local.errors --
|
||||
# "backend errors can contain remote endpoints, local paths, or credential
|
||||
# metadata"). _alert_name is kept as a harmless fallback for exception text
|
||||
# that does carry it; _resolve_alert below is what actually classifies a
|
||||
# failure against a current library.
|
||||
_ALERT_RE = re.compile(r"alert ([a-z0-9 ]+)")
|
||||
|
||||
|
||||
def _alert_name(exc: Exception) -> str | None:
|
||||
"""The TLS alert an appliance sent, if this failure carried one."""
|
||||
"""The TLS alert an appliance sent, if this failure's exception text
|
||||
carried one (only ever true against smartthings-local < 0.1.3)."""
|
||||
match = _ALERT_RE.search(str(exc).lower())
|
||||
return match.group(1).strip().replace(" ", "_") if match else None
|
||||
|
||||
|
||||
def _diagnostic_alert(host: str, port: int, cert_pem: str, key_pem: str):
|
||||
"""One opt-in stateful handshake against `port`, using our real
|
||||
credentials, so a fatal Alert can be classified from the raw record
|
||||
itself rather than parsed out of an exception's text.
|
||||
|
||||
This is the library's diagnose_dtls_handshake -- deliberately not used
|
||||
for the primary candidate scan (it commits association state on the
|
||||
device, and an orphaned association makes the *next* attempt time out
|
||||
per RFC 6347 §4.2.8). Here it only runs once every real candidate has
|
||||
already failed, to explain a failure that's happening either way --
|
||||
one more orphaned association is a fair trade for a message that says
|
||||
why, on a path the user is about to retry regardless.
|
||||
|
||||
Imported lazily, like `_clienthello_probe`, so an install whose
|
||||
smartthings-local predates this API degrades to a generic message
|
||||
instead of failing to load the config flow at all.
|
||||
"""
|
||||
from smartthings_local.protocol.dtls_probe import diagnose_dtls_handshake
|
||||
|
||||
return diagnose_dtls_handshake(
|
||||
host,
|
||||
port,
|
||||
cert_pem=cert_pem,
|
||||
key_pem=key_pem,
|
||||
timeout=CLIENTHELLO_PROBE_TIMEOUT_S,
|
||||
retries=CLIENTHELLO_PROBE_RETRIES,
|
||||
)
|
||||
|
||||
|
||||
def _resolve_alert(exc: Exception, host: str, port: int, cert_pem: str, key_pem: str) -> str | None:
|
||||
"""The TLS alert `port`'s failed handshake carried, if any -- the
|
||||
exception's own text first (cheap, and all an older library ever
|
||||
offers), then one bounded diagnostic handshake against a current one
|
||||
that redacts it (see _diagnostic_alert)."""
|
||||
name = _alert_name(exc)
|
||||
if name is not None:
|
||||
return name
|
||||
try:
|
||||
result = _diagnostic_alert(host, port, cert_pem, key_pem)
|
||||
except Exception:
|
||||
return None
|
||||
if result.alert is None:
|
||||
return None
|
||||
level, name = result.alert
|
||||
# ProbeResult.alert is set for a *received* alert record of either
|
||||
# level -- fatal (2) means the appliance actually broke off the
|
||||
# handshake over it; a warning (1, e.g. close_notify on an otherwise
|
||||
# ordinary close) is not evidence of a rejection and must not be read
|
||||
# as one. The old exception-text path never had this ambiguity: an
|
||||
# OpenSSL exception only ever rendered for a fatal alert.
|
||||
return name if level == 2 else None
|
||||
|
||||
|
||||
def _classify_handshake_failure(
|
||||
host: str,
|
||||
scan: _PortScan,
|
||||
failures: list[tuple[int, Exception]],
|
||||
alerts: dict[int, str] | None = None,
|
||||
) -> CannotConnect:
|
||||
"""Turn "no port worked" into the most specific thing we can honestly
|
||||
say, in rough order of how much the evidence tells us: an alert means
|
||||
@@ -509,13 +578,21 @@ def _classify_handshake_failure(
|
||||
certificate); a confirmed DTLS port that then timed out is likely still
|
||||
holding a session from a previous attempt; otherwise the sweep's own
|
||||
shape is the evidence.
|
||||
|
||||
`alerts` is the per-port classification `_handshake_and_read` already
|
||||
resolved (exception text, or a diagnostic handshake -- see
|
||||
_resolve_alert); a caller with only raw failures (or an older library)
|
||||
still gets `_alert_name`'s exception-text reading as a fallback.
|
||||
"""
|
||||
alerts = [name for name in (_alert_name(exc) for _, exc in failures) if name]
|
||||
cert_alerts = [name for name in alerts if name in _CERT_ALERTS]
|
||||
resolved = dict(alerts or {})
|
||||
for port, exc in failures:
|
||||
resolved.setdefault(port, _alert_name(exc))
|
||||
alert_names = [name for name in resolved.values() if name]
|
||||
cert_alerts = [name for name in alert_names if name in _CERT_ALERTS]
|
||||
if cert_alerts:
|
||||
return CertRejected(f"{host} rejected our certificate (alert {cert_alerts[0]})")
|
||||
if alerts:
|
||||
return HandshakeFailed(f"{host} refused the DTLS handshake (alert {alerts[0]})")
|
||||
if alert_names:
|
||||
return HandshakeFailed(f"{host} refused the DTLS handshake (alert {alert_names[0]})")
|
||||
if scan.confirmed:
|
||||
return HandshakeTimeout(
|
||||
f"DTLS server confirmed on {host}:{scan.confirmed} but the handshake never completed"
|
||||
@@ -614,6 +691,40 @@ def _read_device(sess, host: str, port: int) -> dict:
|
||||
}
|
||||
|
||||
|
||||
def _diagnose_failures(
|
||||
host: str,
|
||||
scan: _PortScan,
|
||||
failures: list[tuple[int, Exception]],
|
||||
cert_pem: str,
|
||||
key_pem: str,
|
||||
) -> dict[int, str]:
|
||||
"""At most one diagnostic handshake (see _diagnostic_alert) across every
|
||||
port `_handshake_and_read` just gave up on -- not one per port.
|
||||
|
||||
Called only after that loop has fully exhausted `scan.candidates`, never
|
||||
interleaved with it: `_diagnostic_alert`'s own docstring says the extra
|
||||
orphaned association it costs is a fair trade "on a path the user is
|
||||
about to retry regardless" -- true for the retry `_probe_and_validate`
|
||||
itself makes on a CertRejected (a fresh `_handshake_and_read` call
|
||||
against this same `scan`), but only if that retry's real handshake
|
||||
attempts are the ones landing on a clean slate. Running the diagnostic
|
||||
per candidate mid-loop would pollute exactly the port(s) that retry is
|
||||
about to reattempt; running several of them multiplies both the latency
|
||||
(each is its own bounded handshake) and the pollution for no extra
|
||||
classification value, since _classify_handshake_failure only ever needs
|
||||
one alert to decide.
|
||||
|
||||
Targets a confirmed-live port over an unconfirmed sweep candidate --
|
||||
the one actually worth spending the extra handshake on.
|
||||
"""
|
||||
if not failures:
|
||||
return {}
|
||||
by_port = dict(failures)
|
||||
port = next((p for p in scan.confirmed if p in by_port), next(iter(by_port)))
|
||||
alert = _resolve_alert(by_port[port], host, port, cert_pem, key_pem)
|
||||
return {port: alert} if alert is not None else {}
|
||||
|
||||
|
||||
def _handshake_and_read(host: str, scan: _PortScan, cert_pem: str, key_pem: str) -> dict:
|
||||
"""Handshake each candidate in turn, returning the first device that answers."""
|
||||
from smartthings_local.protocol.dtls_session import DtlsCoapSession
|
||||
@@ -637,7 +748,8 @@ def _handshake_and_read(host: str, scan: _PortScan, cert_pem: str, key_pem: str)
|
||||
if sess is not None:
|
||||
with contextlib.suppress(Exception):
|
||||
sess.close()
|
||||
raise _classify_handshake_failure(host, scan, failures)
|
||||
alerts = _diagnose_failures(host, scan, failures, cert_pem, key_pem)
|
||||
raise _classify_handshake_failure(host, scan, failures, alerts)
|
||||
|
||||
|
||||
def _probe_and_validate(
|
||||
@@ -681,7 +793,10 @@ def _probe_and_validate(
|
||||
|
||||
|
||||
class LocalThingsConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
VERSION = 2
|
||||
# v3 relabels the particulate sensors' recorded statistics; a freshly
|
||||
# created entry has none to relabel, so it starts at the migrated
|
||||
# version rather than walking through v2 (see async_migrate_entry).
|
||||
VERSION = 3
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._host: str = ""
|
||||
@@ -827,15 +942,27 @@ class LocalThingsOptionsFlow(config_entries.OptionsFlow):
|
||||
def __init__(self) -> None:
|
||||
self._debug_href: str = ""
|
||||
self._debug_result: tuple[int, dict] | None = None
|
||||
# Guided download-cycle setup. `_cloud_task` is created once per
|
||||
# round and reused across re-entries (Home Assistant re-enters a
|
||||
# progress step while its spinner is up).
|
||||
self._cloud_task: asyncio.Task[str | None] | None = None
|
||||
self._cloud_slot: str | None = None
|
||||
self._cloud_baseline: str | None = None
|
||||
|
||||
def _coordinator(self):
|
||||
return self.hass.data.get(DOMAIN, {}).get(self.config_entry.entry_id)
|
||||
|
||||
async def async_step_init(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult:
|
||||
return self.async_show_menu(
|
||||
step_id="init",
|
||||
menu_options=["settings", "forget_learned_modes", "debug_write"],
|
||||
)
|
||||
menu = ["settings", "forget_learned_modes", "debug_write"]
|
||||
# Only offered on an appliance that actually advertises downloaded
|
||||
# programs (issue #342) -- every other device would get a menu entry
|
||||
# leading to an empty screen.
|
||||
coord = self._coordinator()
|
||||
if coord is not None and cloudcourse.supports_cloud_courses(
|
||||
coord.cloud_course_rep(), cycle_options(coord.canonical_resources(MAIN))
|
||||
):
|
||||
menu.insert(1, "cloud_courses")
|
||||
return self.async_show_menu(step_id="init", menu_options=menu)
|
||||
|
||||
async def async_step_settings(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
@@ -901,6 +1028,385 @@ class LocalThingsOptionsFlow(config_entries.OptionsFlow):
|
||||
description_placeholders={"codes": ", ".join(codes) if codes else "(none)"},
|
||||
)
|
||||
|
||||
async def async_step_cloud_courses(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Entry point for download-cycle setup (issue #342).
|
||||
|
||||
Guided setup is offered first because it is the only version of this
|
||||
that a first-time user can complete confidently: it asks about a
|
||||
program in the moment they select it, rather than about a list of hex
|
||||
ids some time later. The bulk form stays for renaming afterwards,
|
||||
which guided setup is bad at.
|
||||
"""
|
||||
return self.async_show_menu(
|
||||
step_id="cloud_courses",
|
||||
menu_options=["cloud_guided", "cloud_manual"],
|
||||
)
|
||||
|
||||
@callback
|
||||
def async_remove(self) -> None:
|
||||
"""Stop probing when the flow goes away.
|
||||
|
||||
Closing the dialog is the documented way to leave guided setup, so it
|
||||
has to actually stop: an abandoned round would otherwise go on
|
||||
live-reading /course/vs/0 every few seconds until its timeout, taking
|
||||
the session lock each time, for a user who has walked away.
|
||||
"""
|
||||
if self._cloud_task is not None and not self._cloud_task.done():
|
||||
self._cloud_task.cancel()
|
||||
self._cloud_task = None
|
||||
|
||||
async def async_step_cloud_guided(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Start (or restart) a guided discovery round."""
|
||||
coord = self._coordinator()
|
||||
if coord is None:
|
||||
return self.async_abort(reason="not_loaded")
|
||||
self._cloud_task = None
|
||||
self._cloud_slot = None
|
||||
# Baseline: whatever is loaded right now. The round completes when
|
||||
# the appliance moves off it, so the program the user has *already*
|
||||
# selected can't immediately re-trigger and loop the flow.
|
||||
self._cloud_baseline = cloudcourse.loaded_slot(coord.cloud_course_rep())
|
||||
return await self.async_step_cloud_wait()
|
||||
|
||||
async def async_step_cloud_wait(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Wait for the user to select a different downloaded program.
|
||||
|
||||
The task is created once and reused across re-entries -- Home
|
||||
Assistant polls this step while the spinner is up, and building a
|
||||
fresh task each time would restart the wait forever.
|
||||
"""
|
||||
coord = self._coordinator()
|
||||
if coord is None:
|
||||
return self.async_abort(reason="not_loaded")
|
||||
|
||||
if self._cloud_task is None:
|
||||
self._cloud_task = self.hass.async_create_task(
|
||||
self._await_cloud_selection(coord), eager_start=False
|
||||
)
|
||||
if not self._cloud_task.done():
|
||||
return self.async_show_progress(
|
||||
step_id="cloud_wait",
|
||||
progress_action="cloud_wait",
|
||||
progress_task=self._cloud_task,
|
||||
description_placeholders=self._cloud_progress_placeholders(coord),
|
||||
)
|
||||
|
||||
self._cloud_slot = self._cloud_task.result()
|
||||
self._cloud_task = None
|
||||
if self._cloud_slot is None:
|
||||
return self.async_show_progress_done(next_step_id="cloud_timeout")
|
||||
return self.async_show_progress_done(next_step_id="cloud_name")
|
||||
|
||||
async def _await_cloud_selection(self, coord) -> str | None:
|
||||
"""Poll until the loaded program changes; None on timeout."""
|
||||
deadline = time.monotonic() + _CLOUD_WAIT_TIMEOUT_S
|
||||
while time.monotonic() < deadline:
|
||||
slot = await coord.async_probe_cloud_courses()
|
||||
# Only a slot the store actually recorded. The probe reports
|
||||
# whatever payload is loaded, while observe() declines one whose
|
||||
# slot the device doesn't advertise -- offering to name that would
|
||||
# take a name and silently discard it, since there is no record to
|
||||
# hang it on and no payload to replay.
|
||||
if (
|
||||
slot is not None
|
||||
and slot != self._cloud_baseline
|
||||
and coord.cloud_courses.snapshot()["slots"].get(slot)
|
||||
):
|
||||
return slot
|
||||
await asyncio.sleep(_CLOUD_PROBE_INTERVAL_S)
|
||||
return None
|
||||
|
||||
def _cloud_progress_placeholders(self, coord) -> dict[str, str]:
|
||||
"""Counts plus the names assigned so far.
|
||||
|
||||
Listing them is what makes a nine-program walk followable -- it is
|
||||
the only orientation available, since the programs still to do are
|
||||
unnamed by definition. Shown while naming too, where it doubles as
|
||||
duplicate avoidance: the form rejects a repeated name, so seeing the
|
||||
others first beats being bounced.
|
||||
|
||||
In the appliance's own advertised order, which is at least a stable
|
||||
order, without numbering them -- whether that order matches the dial
|
||||
is plausible but unverified, and implying it would be worse than
|
||||
saying nothing.
|
||||
"""
|
||||
rep = coord.cloud_course_rep()
|
||||
courses = cycle_options(coord.canonical_resources(MAIN))
|
||||
record = coord.cloud_courses.snapshot()
|
||||
slots = cloudcourse.cloud_slots(rep, courses)
|
||||
names = [n for s in slots if (n := (record["slots"].get(s) or {}).get("name"))]
|
||||
return {
|
||||
"named": str(len(names)),
|
||||
"total": str(len(slots)),
|
||||
"named_list": ", ".join(names) if names else "none yet",
|
||||
}
|
||||
|
||||
async def async_step_cloud_name(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Name the program the user just selected.
|
||||
|
||||
Persists immediately rather than batching to the end of the flow, so
|
||||
closing the dialog at any point is a clean "save and exit" -- there is
|
||||
no pending work to lose, and reopening resumes from the store.
|
||||
"""
|
||||
coord = self._coordinator()
|
||||
if coord is None or self._cloud_slot is None:
|
||||
return self.async_abort(reason="not_loaded")
|
||||
slot = self._cloud_slot
|
||||
existing = (coord.cloud_courses.snapshot()["slots"].get(slot) or {}).get("name", "")
|
||||
|
||||
if user_input is not None:
|
||||
# Rebuilt into the shared validator's shape. `download_course`
|
||||
# is forwarded only when this form actually carried it, so its
|
||||
# absence still means "not asked about" rather than "clear it".
|
||||
payload: dict[str, Any] = {f"name_{slot}": str(user_input.get("name", "")).strip()}
|
||||
if "download_course" in user_input:
|
||||
payload["download_course"] = user_input["download_course"]
|
||||
errors = self._apply_cloud_course_names(coord, [slot], payload)
|
||||
if errors:
|
||||
return self._cloud_name_form(coord, slot, existing, errors=errors)
|
||||
# Straight back to waiting: the appliance is still sitting on this
|
||||
# program, and the next round baselines on it, so there is nothing
|
||||
# to click through.
|
||||
self._cloud_baseline = slot
|
||||
return await self.async_step_cloud_wait()
|
||||
|
||||
return self._cloud_name_form(coord, slot, existing)
|
||||
|
||||
def _cloud_name_form(
|
||||
self, coord, slot: str, existing: str, errors: dict[str, str] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""One text field, with the copy switched on whether this program is
|
||||
already set up. Re-selecting one is not an error -- it is how someone
|
||||
checks their work -- so it gets an edit form rather than a rejection,
|
||||
and the counter deliberately does not move.
|
||||
|
||||
The Download course joins the form the first time round, and only
|
||||
until it is confirmed. Guided setup would otherwise finish having
|
||||
collected names but no course, and a program needs both before it can
|
||||
be offered -- so the whole walk would produce nothing selectable. It
|
||||
is asked here rather than up front because this is the first moment
|
||||
there is evidence to prefill: the user has just loaded a program, so
|
||||
the course showing alongside it is the Download one.
|
||||
"""
|
||||
placeholders = self._cloud_progress_placeholders(coord)
|
||||
placeholders["slot"] = slot
|
||||
placeholders["remaining"] = (
|
||||
coord.resource("/operational/state/vs/0").get("x.com.samsung.da.remainingTime") or "--"
|
||||
)
|
||||
fields: dict[Any, Any] = {vol.Optional("name", default=existing): _TEXT}
|
||||
if not coord.cloud_courses.snapshot()["download_course"]:
|
||||
fields[
|
||||
vol.Optional("download_course", description={"suggested_value": self._cloud_course})
|
||||
] = self._cloud_course_selector(coord)
|
||||
return self.async_show_form(
|
||||
step_id="cloud_name",
|
||||
data_schema=vol.Schema(fields),
|
||||
errors=errors or {},
|
||||
description_placeholders=placeholders,
|
||||
last_step=False,
|
||||
)
|
||||
|
||||
@property
|
||||
def _cloud_course(self) -> str | None:
|
||||
"""The best observed candidate, narrowed to what the selector offers.
|
||||
|
||||
Unfiltered, a candidate the appliance's own course list no longer
|
||||
contains would prefill a dropdown that rejects it, and the form would
|
||||
fail validation on a value the user never chose.
|
||||
"""
|
||||
coord = self._coordinator()
|
||||
if coord is None:
|
||||
return None
|
||||
available = cycle_options(coord.canonical_resources(MAIN))
|
||||
return next((c for c in coord.cloud_courses.download_candidates() if c in available), None)
|
||||
|
||||
def _cloud_course_selector(self, coord):
|
||||
"""The appliance's own course codes, observed candidates first.
|
||||
|
||||
custom_value stays off deliberately: whatever lands here becomes the
|
||||
Course_ token of a real write, and a typed-in code the appliance
|
||||
doesn't offer would start something nobody chose.
|
||||
"""
|
||||
available = cycle_options(coord.canonical_resources(MAIN))
|
||||
candidates = [c for c in coord.cloud_courses.download_candidates() if c in available]
|
||||
ordered = candidates + [c for c in available if c not in candidates]
|
||||
return SelectSelector(
|
||||
SelectSelectorConfig(
|
||||
options=ordered,
|
||||
custom_value=False,
|
||||
mode=SelectSelectorMode.DROPDOWN,
|
||||
)
|
||||
)
|
||||
|
||||
async def async_step_cloud_timeout(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Nothing was selected in time. Offer another round rather than
|
||||
dropping the user out of the flow -- and an explicit finish, for
|
||||
anyone who doesn't think to close the dialog."""
|
||||
coord = self._coordinator()
|
||||
if coord is None:
|
||||
return self.async_abort(reason="not_loaded")
|
||||
return self.async_show_menu(
|
||||
step_id="cloud_timeout",
|
||||
menu_options=["cloud_guided", "cloud_finish"],
|
||||
description_placeholders=self._cloud_progress_placeholders(coord),
|
||||
)
|
||||
|
||||
async def async_step_cloud_finish(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
return self.async_create_entry(data=dict(self.config_entry.options))
|
||||
|
||||
async def async_step_cloud_manual(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Name the cloud "Download" programs this appliance has (issue #342).
|
||||
|
||||
The device advertises how many downloaded programs it holds but never
|
||||
what any of them is called, and only ever exposes the replay payload
|
||||
for the one currently loaded. So this screen can only offer the ones
|
||||
already seen loaded, and asks the user for the names -- the appliance
|
||||
has no name to give and inventing one is not an option (the same rule
|
||||
that governs unrecognized local course codes).
|
||||
|
||||
Also confirms which course code means Download. It is auto-detected
|
||||
by observation, but never used for a write until confirmed here: the
|
||||
options array replaces tokens by prefix and never evicts them, so a
|
||||
stale program token can be reported alongside an unrelated course and
|
||||
make an ordinary wash cycle look like the Download one. Writing the
|
||||
wrong code would start the wrong cycle.
|
||||
"""
|
||||
coord = self._coordinator()
|
||||
if coord is None:
|
||||
return self.async_abort(reason="not_loaded")
|
||||
|
||||
store = coord.cloud_courses
|
||||
rep = coord.cloud_course_rep()
|
||||
record = store.snapshot()
|
||||
slots = record["slots"]
|
||||
advertised = cloudcourse.cloud_slots(rep, cycle_options(coord.canonical_resources(MAIN)))
|
||||
# Learned slots keep the appliance's own ordering; anything learned
|
||||
# but no longer advertised still gets a row so a name isn't stranded.
|
||||
known = [s for s in advertised if s in slots] + [s for s in slots if s not in advertised]
|
||||
|
||||
if user_input is not None:
|
||||
errors = self._apply_cloud_course_names(coord, known, user_input)
|
||||
if not errors:
|
||||
return self.async_create_entry(data=dict(self.config_entry.options))
|
||||
return self._cloud_courses_form(coord, known, advertised, errors=errors)
|
||||
|
||||
return self._cloud_courses_form(coord, known, advertised)
|
||||
|
||||
def _apply_cloud_course_names(self, coord, known, user_input) -> dict[str, str]:
|
||||
"""Validate and store the submitted names + Download course code.
|
||||
|
||||
The select maps a chosen label back to a raw value by matching display
|
||||
text, so two options sharing a label resolve to whichever comes first.
|
||||
Two sources of collision are checkable here and both are rejected:
|
||||
the user's own names against each other, and against the appliance's
|
||||
personal-course labels, which the device reports verbatim and the
|
||||
select renders as-is.
|
||||
|
||||
A collision with a *translated* local course name is deliberately not
|
||||
checked. The catalog this process can read is English (catalog.py),
|
||||
while what the user actually sees is localized in the frontend -- so
|
||||
checking it would reject "Cotton" for a German user whose dropdown
|
||||
says "Baumwolle", and still miss the real collision when they type
|
||||
"Baumwolle". Wrong in both directions outside one locale, against an
|
||||
outcome the option ordering already makes deterministic (local
|
||||
courses come first, so a shared label resolves to the real cycle).
|
||||
"""
|
||||
names = {slot: str(user_input.get(f"name_{slot}", "")).strip() for slot in known}
|
||||
stored_slots = coord.cloud_courses.snapshot()["slots"]
|
||||
taken = {name.casefold() for name in self._device_course_names(coord)}
|
||||
# Programs this form isn't editing. The bulk form edits every slot at
|
||||
# once so this adds nothing there, but guided setup submits one at a
|
||||
# time -- without it, naming two programs the same was accepted, and
|
||||
# the select resolves a shared label to whichever option comes first,
|
||||
# so picking the second would run the first one's payload.
|
||||
taken |= {
|
||||
record["name"].casefold()
|
||||
for slot, record in stored_slots.items()
|
||||
if record["name"] and slot not in known
|
||||
}
|
||||
for name in names.values():
|
||||
if not name:
|
||||
continue
|
||||
if name.casefold() in taken:
|
||||
return {"base": "cloud_course_name_duplicate"}
|
||||
taken.add(name.casefold())
|
||||
|
||||
# Absent means "this form didn't ask" -- the guided name form drops
|
||||
# the field once the course is confirmed -- which must leave the
|
||||
# stored value alone rather than clearing it. A program is only
|
||||
# offerable when both a name and the course are set, so clearing it
|
||||
# here would make naming things remove them from the cycle list.
|
||||
if "download_course" not in user_input:
|
||||
coord.apply_cloud_courses(names)
|
||||
return {}
|
||||
|
||||
# Belt and braces over the selector's own custom_value=False: this
|
||||
# value becomes the Course_ token of a real write, so it is checked
|
||||
# against the appliance's own course list here too, where the store
|
||||
# is actually updated.
|
||||
course = user_input.get("download_course") or None
|
||||
if course is not None and course not in cycle_options(coord.canonical_resources(MAIN)):
|
||||
return {"base": "cloud_course_unknown_course"}
|
||||
|
||||
coord.apply_cloud_courses(names, course)
|
||||
return {}
|
||||
|
||||
def _device_course_names(self, coord) -> set[str]:
|
||||
"""Course names this appliance reports itself.
|
||||
|
||||
Only the personal-course labels: the device sends these as text and
|
||||
the select renders them unchanged, so they are the same string in
|
||||
every locale and can be compared against safely. See the caller for
|
||||
why translated course names are not included.
|
||||
"""
|
||||
resources = coord.canonical_resources(MAIN)
|
||||
personal = personal_course_labels(resources)
|
||||
return {name for code in cycle_options(resources) if (name := personal.get(code.upper()))}
|
||||
|
||||
def _cloud_courses_form(
|
||||
self, coord, known, advertised, errors: dict[str, str] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
store = coord.cloud_courses
|
||||
record = store.snapshot()
|
||||
slots = record["slots"]
|
||||
|
||||
fields: dict[Any, Any] = {}
|
||||
for slot in known:
|
||||
fields[vol.Optional(f"name_{slot}", default=slots.get(slot, {}).get("name", ""))] = (
|
||||
_TEXT
|
||||
)
|
||||
|
||||
suggested = record["download_course"] or self._cloud_course
|
||||
fields[vol.Optional("download_course", description={"suggested_value": suggested})] = (
|
||||
self._cloud_course_selector(coord)
|
||||
)
|
||||
|
||||
pending = [s for s in advertised if s not in slots]
|
||||
return self.async_show_form(
|
||||
step_id="cloud_manual",
|
||||
data_schema=vol.Schema(fields),
|
||||
errors=errors or {},
|
||||
description_placeholders={
|
||||
"found": str(len(known)),
|
||||
"total": str(len(advertised)) if advertised else str(len(known)),
|
||||
"pending": ", ".join(pending) if pending else "(none)",
|
||||
},
|
||||
)
|
||||
|
||||
async def async_step_debug_write(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -48,6 +48,15 @@ CONF_LEARNED_MODES = "learned_modes"
|
||||
CONF_LEARN_MODES = "learn_device_modes"
|
||||
DEFAULT_LEARN_MODES = True
|
||||
|
||||
# entry.data key: cloud "Download" programs discovered on a laundry device
|
||||
# (issue #342). Same rationale as CONF_LEARNED_MODES -- a program's full
|
||||
# replay payload is only ever visible while the device happens to be sitting
|
||||
# on it, so it has to survive a restart -- but a richer shape, because a
|
||||
# cloud program also needs a user-supplied name and the device's own
|
||||
# Download course code. See cloudcourse.py, which owns the shape. Shape:
|
||||
# {"download_course": "87"|null, "slots": {slot: {"blob": ..., "name": ...}}}
|
||||
CONF_CLOUD_COURSES = "cloud_courses"
|
||||
|
||||
# Options-flow key (entry.options, not entry.data): lets a user override
|
||||
# the device-wide remote-control-off write block for a specific device
|
||||
# (issue #54). Some devices accept certain writes even while reporting
|
||||
|
||||
@@ -9,8 +9,9 @@ import logging
|
||||
import threading
|
||||
import time
|
||||
import zlib
|
||||
from dataclasses import asdict
|
||||
from datetime import timedelta
|
||||
from typing import Any
|
||||
from typing import Any, cast
|
||||
|
||||
import cbor2
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -18,12 +19,17 @@ from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
from smartthings_local.ocf.state_cache import StateCache
|
||||
from smartthings_local.protocol.dtls_session import DtlsCoapSession
|
||||
|
||||
from . import cloudcourse
|
||||
from .cloudcourse import CloudCourses
|
||||
from .cloudcourse import persist as cloud_persist
|
||||
from .const import (
|
||||
CONF_BYPASS_REMOTE_CONTROL,
|
||||
CONF_CLOUD_COURSES,
|
||||
CONF_DEVICE_TYPE,
|
||||
CONF_HOST,
|
||||
CONF_LEAF_CERT_PEM,
|
||||
@@ -43,7 +49,7 @@ from .const import (
|
||||
from .learned import LEARNABLE, LearnedModes, persist
|
||||
from .observe import GRACE_PERIOD_S, MODE_OBSERVE, MODE_POLL, ObserveManager
|
||||
from .registry import CAPABILITIES
|
||||
from .registry.adapter import flatten
|
||||
from .registry.adapter import _key, flatten
|
||||
from .registry.batch import parse_device0_batch
|
||||
from .registry.by_type import resolve as resolve_registry
|
||||
from .registry.capabilities.common import (
|
||||
@@ -52,6 +58,7 @@ from .registry.capabilities.common import (
|
||||
remote_control_enabled,
|
||||
remote_control_required_for_write,
|
||||
)
|
||||
from .registry.capabilities.laundry import cycle_options
|
||||
from .registry.discovery import BoundEntity
|
||||
from .registry.entities import ClimateDesc
|
||||
from .registry.identity import (
|
||||
@@ -62,6 +69,7 @@ from .registry.identity import (
|
||||
resolve_serial,
|
||||
)
|
||||
from .registry.subdevices import (
|
||||
MAIN,
|
||||
Subdevice,
|
||||
canonical_view,
|
||||
discover_partitioned,
|
||||
@@ -69,10 +77,28 @@ from .registry.subdevices import (
|
||||
normalize_seed_batch,
|
||||
)
|
||||
|
||||
# Sentinel for apply_cloud_courses: "leave this field as it is",
|
||||
# distinct from None which means "clear it".
|
||||
_KEEP = object()
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
_SEED_PATH = ["device", "0"]
|
||||
|
||||
# Discovery snapshot (issue #295): exactly what the last successful first
|
||||
# cycle fed _run_discovery, so a restart can register the same entities
|
||||
# while the appliance is unreachable. Kept in .storage rather than on the
|
||||
# config entry -- it's device state, not configuration, and runs to tens of
|
||||
# kilobytes.
|
||||
_SNAPSHOT_VERSION = 1
|
||||
|
||||
|
||||
def snapshot_store(hass: HomeAssistant, entry: ConfigEntry) -> Store[dict[str, Any]]:
|
||||
"""This entry's discovery-snapshot store. A free function so
|
||||
`async_remove_entry` can delete the file without standing up a whole
|
||||
coordinator to reach it."""
|
||||
return Store(hass, _SNAPSHOT_VERSION, f"{DOMAIN}.{entry.entry_id}.discovery")
|
||||
|
||||
|
||||
class _NoOpDescriptor:
|
||||
"""No-op: StateCache requires an on_observation hook; this integration
|
||||
@@ -93,10 +119,15 @@ def _local_source_port(host: str) -> int:
|
||||
time per RFC 6347 §4.2.8, instead of holding it 5-15 min. See
|
||||
DTLS_LOCAL_PORT_BASE. Requires smartthings-local >= 0.1.1.
|
||||
|
||||
Must stay unique per device on this host too: the library's socket is
|
||||
unconnected, so two devices sharing a port would mis-demux each other's
|
||||
datagrams. Last IPv4 octet as offset for the common case; a stable
|
||||
CRC32 fold otherwise.
|
||||
Must stay unique per device on this host too. That used to be load-
|
||||
bearing for demuxing: an unconnected socket handed every device's
|
||||
datagrams to whichever recvfrom() happened to be listening on their
|
||||
shared port. smartthings-local >= 0.1.3 connect()s its UDP socket
|
||||
instead (see endpoint.py's open_connected_udp_socket), so the kernel
|
||||
already filters incoming datagrams to each session's own resolved peer
|
||||
-- but a distinct port per device keeps that guarantee from ever
|
||||
depending on it, and keeps captures/logs unambiguous. Last IPv4 octet
|
||||
as offset for the common case; a stable CRC32 fold otherwise.
|
||||
"""
|
||||
try:
|
||||
offset = int(ipaddress.IPv4Address(host)) & 0xFF
|
||||
@@ -193,7 +224,10 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
# A block-level ACK timeout on the summary GET doesn't prove the session
|
||||
# is dead (see _poll_once) -- require this many in a row before treating
|
||||
# it as one, so one slow transfer doesn't tear down a working OBSERVE
|
||||
# subscription.
|
||||
# subscription. Only covers that ambiguous case: smartthings-local
|
||||
# >= 0.1.6 raises a distinct SessionClosedError, not a TimeoutError, the
|
||||
# moment a dead reader thread is confirmed, and _defer_reconnect_for
|
||||
# never defers that -- see its docstring for what changed there.
|
||||
_POLL_TIMEOUT_LIMIT: int = 3
|
||||
|
||||
# Named (not inline literals) so the write-settle window in
|
||||
@@ -202,6 +236,17 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
_POST_TIMEOUT_S: float = 8.0
|
||||
_POLL_TIMEOUT_S: float = 35.0
|
||||
|
||||
# First-discovery subdevice enumeration is part of config-entry setup, so
|
||||
# it must have a finite wall-clock cost. A UUID-prefixed AC whose
|
||||
# /<uuid>/device/0 Collection is absent falls back to individual property
|
||||
# probes; some firmware silently drops unknown prefixed paths instead of
|
||||
# returning 4.04, making the old 10s-per-href scan take several minutes.
|
||||
# Keep enough time for a real blockwise Collection response, then use
|
||||
# short timeouts for the small Property resources, all under one budget.
|
||||
_SUBDEVICE_ENUMERATION_BUDGET_S: float = 15.0
|
||||
_SUBDEVICE_COLLECTION_TIMEOUT_S: float = 10.0
|
||||
_SUBDEVICE_PROPERTY_TIMEOUT_S: float = 1.0
|
||||
|
||||
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
# Per-device logger so every log line (including the base
|
||||
# coordinator's and ObserveManager's) identifies which device it's
|
||||
@@ -219,6 +264,11 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
self._identity: DeviceIdentity | None = None
|
||||
self._discovered = False
|
||||
self.bound = []
|
||||
self._snapshot_store = snapshot_store(hass, entry)
|
||||
# Both set only when this entry loaded from a snapshot instead of a
|
||||
# live poll -- see async_rehydrate.
|
||||
self._rehydrate_resources: dict[str, dict] | None = None
|
||||
self._rehydrated_keys: frozenset[tuple[str, str]] | None = None
|
||||
# Sibling indoor subdevices on this connection (issue #177); set
|
||||
# once at first discovery, narrowed to the ones with live state (see
|
||||
# subdevices.discover_partitioned). Never includes MAIN itself.
|
||||
@@ -248,6 +298,9 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
# supported (issue #327), restored from the entry so one learned
|
||||
# last week is still offered today. See learned.py.
|
||||
self._learned = LearnedModes(entry.data.get(CONF_LEARNED_MODES))
|
||||
# Cloud "Download" programs discovered on this device (issue #342).
|
||||
# Same restore-from-entry shape as _learned above; see cloudcourse.py.
|
||||
self._cloud = CloudCourses(entry.data.get(CONF_CLOUD_COURSES))
|
||||
# Narrowed to this device's own climate hrefs once discovery has
|
||||
# run -- see _refresh_learnable_hrefs.
|
||||
self._learnable_hrefs: set[str] = set()
|
||||
@@ -301,6 +354,61 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
which copies every tracked href to build the snapshot dict."""
|
||||
return self._cache.get(href) or {}
|
||||
|
||||
def entity_resources(self) -> dict[str, dict]:
|
||||
"""The live snapshot as entity descriptors should see it: the device's
|
||||
own reps, plus this integration's discovered cloud programs merged
|
||||
onto /course/vs/0 under cloudcourse.FIELD (issue #342).
|
||||
|
||||
Merged at read time rather than applied to the state cache, so the
|
||||
synthetic field can never be polled over or written to the device --
|
||||
`last_resources` stays exactly what the appliance reported. It rides
|
||||
on the rep instead of a resource of its own because rep_fn receives
|
||||
only its own href's rep: a sibling href would be invisible to it, and
|
||||
/course/vs/0 is the one resource every consumer of this data is
|
||||
already bound to.
|
||||
|
||||
MAIN only, by construction: cloudcourse.COURSE_HREF is a canonical
|
||||
href and this snapshot is keyed by actual ones, so a composite
|
||||
appliance's second course resource (/<uuid>/course/vs/0 on the
|
||||
one-body washer-dryer) is not merged and not learned from. No device
|
||||
seen so far advertises cloud programs on anything but MAIN; making
|
||||
this per-subdevice means keying the store by actual href the way
|
||||
LearnedModes does, and migrating the persisted shape.
|
||||
"""
|
||||
snapshot = self.last_resources
|
||||
rep = snapshot.get(cloudcourse.COURSE_HREF)
|
||||
if rep is None:
|
||||
return snapshot
|
||||
view = self._cloud.view()
|
||||
if not view:
|
||||
return snapshot
|
||||
snapshot[cloudcourse.COURSE_HREF] = {**rep, cloudcourse.FIELD: view}
|
||||
return snapshot
|
||||
|
||||
def entity_rep(self, href: str) -> dict:
|
||||
"""One href's rep as descriptors see it -- `resource()` plus the
|
||||
merge `entity_resources` would have applied. Exists so the write path
|
||||
doesn't copy every tracked href to read one rep, which is the very
|
||||
thing `resource()` was added to avoid."""
|
||||
rep = self.resource(href)
|
||||
if href != cloudcourse.COURSE_HREF or not rep:
|
||||
return rep
|
||||
view = self._cloud.view()
|
||||
return {**rep, cloudcourse.FIELD: view} if view else rep
|
||||
|
||||
def device_resources(self, subdevice: Subdevice) -> dict[str, dict]:
|
||||
"""`subdevice`'s canonical view of exactly what the appliance
|
||||
reported -- no integration state merged in.
|
||||
|
||||
The counterpart to canonical_resources for everything that *exports*
|
||||
resources rather than rendering entities from them: diagnostics and
|
||||
the debug read service. Keeping this a separate call rather than
|
||||
filtering the merged view downstream is what makes "a dump is what the
|
||||
device said" a property of which method you call, instead of a
|
||||
convention every future exporter has to remember.
|
||||
"""
|
||||
return canonical_view(subdevice, self.last_resources, self.subdevices)
|
||||
|
||||
def canonical_resources(self, subdevice: Subdevice) -> dict[str, dict]:
|
||||
"""`subdevice`'s view of the live snapshot, rewritten to canonical
|
||||
hrefs (issue #177, see subdevices.canonical_view). Any platform
|
||||
@@ -314,10 +422,39 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
cached = self._canonical_cache.get(view_key)
|
||||
if cached is not None:
|
||||
return cached
|
||||
view = canonical_view(subdevice, self._cache.snapshot(), self.subdevices)
|
||||
view = canonical_view(subdevice, self.entity_resources(), self.subdevices)
|
||||
self._canonical_cache[view_key] = view
|
||||
return view
|
||||
|
||||
@property
|
||||
def rehydrated(self) -> bool:
|
||||
"""True while this entry's entities came from a snapshot rather than
|
||||
a live poll (issue #295)."""
|
||||
return self._rehydrate_resources is not None
|
||||
|
||||
@property
|
||||
def discovery_resources(self) -> dict[str, dict]:
|
||||
"""What entity._is_included should judge an entity's existence
|
||||
against: the rehydration snapshot on an offline load, the live cache
|
||||
otherwise.
|
||||
|
||||
Deliberately separate from `last_resources`, which stays empty until
|
||||
the device answers -- that emptiness is what keeps a rehydrated
|
||||
entity `unavailable` instead of rendering a snapshot's stale value.
|
||||
Only read while platforms are being forwarded; nothing consults it
|
||||
once the entities exist.
|
||||
"""
|
||||
if self._rehydrate_resources is None:
|
||||
return self.last_resources
|
||||
return self._rehydrate_resources
|
||||
|
||||
def discovery_canonical(self, subdevice: Subdevice) -> dict[str, dict]:
|
||||
"""`discovery_resources` in `subdevice`'s canonical view -- the
|
||||
exists_fn counterpart to canonical_resources."""
|
||||
if self._rehydrate_resources is None:
|
||||
return self.canonical_resources(subdevice)
|
||||
return canonical_view(subdevice, self._rehydrate_resources, self.subdevices)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Learned modes (issue #327)
|
||||
# ------------------------------------------------------------------
|
||||
@@ -378,7 +515,11 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
|
||||
An 'optimistic' rep is the value this integration just wrote, not
|
||||
one the device reported, so there is nothing to learn from it."""
|
||||
if source == "optimistic" or href not in self._learnable_hrefs:
|
||||
if source == "optimistic":
|
||||
return
|
||||
if href == cloudcourse.COURSE_HREF:
|
||||
self._observe_cloud_courses(rep)
|
||||
if href not in self._learnable_hrefs:
|
||||
return
|
||||
if not self.learning_enabled:
|
||||
return
|
||||
@@ -395,6 +536,134 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
def _persist_learned(self) -> None:
|
||||
persist(self.hass, self._entry, self._learned.snapshot())
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Cloud "Download" programs (issue #342) -- see cloudcourse.py
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def _observe_cloud_courses(self, rep: dict) -> None:
|
||||
"""Learn a downloaded program's replay payload from one applied
|
||||
/course/vs/0 rep. Runs on whichever thread applied the update, so
|
||||
both the persist and the Repairs refresh go through hass.add_job.
|
||||
|
||||
Unlike learned modes this has no opt-out option: it records only
|
||||
what the appliance itself reports about programs it itself
|
||||
advertises, and nothing is offered in the UI until the user names it.
|
||||
"""
|
||||
if not self._cloud.observe(rep):
|
||||
return
|
||||
self.hass.add_job(self._persist_cloud_courses)
|
||||
|
||||
@callback
|
||||
def _persist_cloud_courses(self) -> None:
|
||||
cloud_persist(self.hass, self._entry, self._cloud.snapshot())
|
||||
# A newly learned program changes what entity_resources() hands out.
|
||||
self._canonical_cache.clear()
|
||||
self._refresh_cloud_course_issue()
|
||||
|
||||
@property
|
||||
def cloud_courses(self) -> CloudCourses:
|
||||
"""The discovered-program store, for reads (snapshot/view/candidates).
|
||||
|
||||
Mutations go through apply_cloud_courses below, not through this --
|
||||
the store itself doesn't persist or invalidate, and `_canonical_cache`
|
||||
now depends on its contents, so a caller that mutates it directly
|
||||
leaves entity options stale with no error to say so.
|
||||
"""
|
||||
return self._cloud
|
||||
|
||||
def cloud_course_rep(self) -> dict:
|
||||
"""/course/vs/0's live rep -- what advertises the slot list."""
|
||||
return self.resource(cloudcourse.COURSE_HREF)
|
||||
|
||||
async def async_probe_cloud_courses(self) -> str | None:
|
||||
"""Live-read /course/vs/0, apply it, and report which slot is loaded.
|
||||
|
||||
/course/vs/0 is cold-tier, so passively a program selection can take
|
||||
a whole poll interval to show up -- far too slow for the guided setup
|
||||
flow, which is a person standing at the appliance waiting for Home
|
||||
Assistant to notice. The read goes through the normal apply path, so
|
||||
learning and persistence still happen in exactly one place.
|
||||
|
||||
Returns None when the read fails; the caller is a retry loop and a
|
||||
single missed read is not worth surfacing.
|
||||
"""
|
||||
try:
|
||||
code, rep, _body = await self.async_raw_read(cloudcourse.COURSE_HREF)
|
||||
except Exception:
|
||||
# One missed probe; the caller is a retry loop.
|
||||
self._log.debug("cloud-course probe failed", exc_info=True)
|
||||
return None
|
||||
if not _coap_accepted(code) or not rep:
|
||||
return None
|
||||
self._observe.apply(cloudcourse.COURSE_HREF, rep, source="poll")
|
||||
return cloudcourse.loaded_slot(rep)
|
||||
|
||||
def apply_cloud_courses(self, names: dict[str, str], download_course: object = _KEEP) -> None:
|
||||
"""The one mutation path for the cloud-program store (issue #342).
|
||||
|
||||
Takes the whole submission at once so a nine-program naming pass is
|
||||
one config-entry write rather than nine, and so persistence, the
|
||||
canonical-view invalidation and the Repairs refresh can't be done for
|
||||
one half of a change and skipped for the other.
|
||||
|
||||
`download_course` defaults to "leave it alone" rather than None.
|
||||
Guided setup submits one name at a time and says nothing about the
|
||||
course; with None as the default that silently cleared a course the
|
||||
user had already confirmed, and since a program is only offerable
|
||||
once both are set, naming things made them disappear.
|
||||
"""
|
||||
for slot, name in names.items():
|
||||
self._cloud.set_name(slot, name)
|
||||
if download_course is not _KEEP:
|
||||
self._cloud.set_download_course(cast("str | None", download_course))
|
||||
self._persist_cloud_courses()
|
||||
|
||||
@callback
|
||||
def _refresh_cloud_course_issue(self) -> None:
|
||||
"""Raise or clear the "you have downloaded programs Home Assistant
|
||||
can't offer yet" Repairs issue (issue #342).
|
||||
|
||||
A downloaded program is only usable once the appliance has been seen
|
||||
sitting on it (that is the only time its replay payload is visible)
|
||||
and the user has given it a name. The device advertises how many it
|
||||
has, so the gap between that and what's usable is knowable -- and
|
||||
it can only be closed by the user walking the appliance through its
|
||||
own Download list, which is exactly what a Repair is for.
|
||||
|
||||
Gated on having seen at least one payload, which is the only
|
||||
available evidence that this household uses downloaded programs at
|
||||
all. Without it, an appliance that merely advertises slots -- the
|
||||
DW5000C fixture reports four and has never loaded any -- would carry
|
||||
a permanent warning about a feature its owner may never touch, and
|
||||
nothing they do in Home Assistant could clear it. Running one
|
||||
downloaded program is what turns the nudge on, and naming them is
|
||||
what turns it off.
|
||||
"""
|
||||
issue_id = f"cloud_courses_{self._entry.entry_id}"
|
||||
rep = self.cloud_course_rep()
|
||||
record = self._cloud.snapshot()
|
||||
courses = cycle_options(self.canonical_resources(MAIN))
|
||||
pending = cloudcourse.undiscovered(rep, record, courses)
|
||||
slots = cloudcourse.cloud_slots(rep, courses)
|
||||
needs_course = bool(slots) and not record["download_course"]
|
||||
if record["slots"] and (pending or needs_course):
|
||||
ir.async_create_issue(
|
||||
self.hass,
|
||||
DOMAIN,
|
||||
issue_id,
|
||||
is_fixable=False,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="cloud_courses_undiscovered",
|
||||
translation_placeholders={
|
||||
"device_name": self.device_info.get("name") or "This appliance",
|
||||
"pending": str(len(pending)),
|
||||
"total": str(len(slots)),
|
||||
},
|
||||
learn_more_url=DEVICE_SUPPORT_ISSUE_URL,
|
||||
)
|
||||
else:
|
||||
ir.async_delete_issue(self.hass, DOMAIN, issue_id)
|
||||
|
||||
def device_info_for(self, subdevice: Subdevice) -> DeviceInfo:
|
||||
"""DeviceInfo for one logical subdevice on this connection (issue
|
||||
#177): the master's own device_info for MAIN, or a linked child
|
||||
@@ -497,7 +766,7 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
with self._push_pending_lock:
|
||||
self._push_pending = False
|
||||
if self.bound:
|
||||
self.async_set_updated_data(flatten(self.bound, self._cache.snapshot()))
|
||||
self.async_set_updated_data(flatten(self.bound, self.entity_resources()))
|
||||
|
||||
def _poll_once(self) -> dict[str, dict]:
|
||||
"""GET /device/0, return parsed resources. Blocking.
|
||||
@@ -506,6 +775,14 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
not that the session is dead (earlier blocks succeeded). Left open;
|
||||
`_async_update_data` decides whether repeated timeouts warrant a
|
||||
reconnect. Any other exception is unambiguous -- close immediately.
|
||||
|
||||
smartthings-local >= 0.1.6 tells those two cases apart itself now:
|
||||
a reader thread that has actually died raises `SessionClosedError`
|
||||
(a ConnectionError, not a TimeoutError) the moment the next request
|
||||
notices, instead of the old behavior of quietly hanging out to this
|
||||
call's own timeout and surfacing as an ambiguous `TimeoutError`.
|
||||
See `_defer_reconnect_for` for what that changes about how soon a
|
||||
confirmed-dead session gets reconnected.
|
||||
"""
|
||||
if self._session is None:
|
||||
self._connect_session()
|
||||
@@ -646,6 +923,40 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
# Discovery (runs once on first successful poll)
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def _subdevice_probe_priority(
|
||||
self,
|
||||
resources: dict[str, dict],
|
||||
) -> tuple[str, ...]:
|
||||
"""Return live primary-entity hrefs in hot/warm-first order.
|
||||
|
||||
A prefixed subdevice without a Collection endpoint has to be probed
|
||||
one Property href at a time. Resolve the master through the same
|
||||
registry used by discovery and put resources that produce primary
|
||||
entities first. This is metadata-driven rather than an AC-specific
|
||||
list: a future composite appliance gets the priority its own registry
|
||||
declares, while unknown devices simply retain the normal href order.
|
||||
"""
|
||||
registry = resolve_registry(
|
||||
resources,
|
||||
device_types=self._identity.device_types if self._identity else (),
|
||||
)
|
||||
if registry is None:
|
||||
return ()
|
||||
|
||||
tier_rank = {"hot": 0, "warm": 1, "cold": 2}
|
||||
ranked = []
|
||||
for order, href in enumerate(resources):
|
||||
primary_caps = [
|
||||
capability
|
||||
for capability in registry.capabilities.get(href, ())
|
||||
if any(desc.entity_category is None for desc in capability.entities)
|
||||
]
|
||||
if not primary_caps:
|
||||
continue
|
||||
rank = min(tier_rank.get(capability.poll_tier, 2) for capability in primary_caps)
|
||||
ranked.append((rank, order, href))
|
||||
return tuple(href for _, _, href in sorted(ranked))
|
||||
|
||||
def _enumerate_subdevices_blocking(self, resources: dict[str, dict]) -> dict[str, dict]:
|
||||
"""One-time (first discovery only) probe for sibling indoor
|
||||
subdevices on this connection (issue #177) -- see
|
||||
@@ -671,6 +982,10 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
resources,
|
||||
oic_res,
|
||||
probe_log=lambda href, found: probes.__setitem__(href, found),
|
||||
preferred_hrefs=self._subdevice_probe_priority(resources),
|
||||
time_budget=self._SUBDEVICE_ENUMERATION_BUDGET_S,
|
||||
collection_timeout=self._SUBDEVICE_COLLECTION_TIMEOUT_S,
|
||||
property_timeout=self._SUBDEVICE_PROPERTY_TIMEOUT_S,
|
||||
)
|
||||
self.subdevices = subdevices
|
||||
self._subdevice_probes = probes
|
||||
@@ -734,7 +1049,148 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
self._entry, data={**self._entry.data, **identity}
|
||||
)
|
||||
|
||||
def _run_discovery(self, resources: dict[str, dict]) -> None:
|
||||
# ------------------------------------------------------------------
|
||||
# Discovery snapshot (issue #295)
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def _bound_keys(self) -> frozenset[tuple[str, str]]:
|
||||
"""This entity set's identity: one (subdevice, state key) pair per
|
||||
bound entity. `_key` is the unique_id suffix, so two discoveries that
|
||||
agree here would register byte-identical entities."""
|
||||
return frozenset((b.subdevice.key, _key(b)) for b in self.bound)
|
||||
|
||||
async def _async_save_snapshot(
|
||||
self, resources: dict[str, dict], candidates: list[Subdevice]
|
||||
) -> None:
|
||||
"""Record what this first cycle handed `_run_discovery`, so the next
|
||||
restart can replay it while the appliance is unreachable.
|
||||
|
||||
`candidates` is the pre-narrowing subdevice list (issue #177):
|
||||
`discover_partitioned` takes candidates and returns the live ones, so
|
||||
replaying against the narrowed list would rediscover nothing for a
|
||||
composite appliance's siblings.
|
||||
|
||||
Written now rather than through `async_delay_save`, because a pending
|
||||
delayed write outlives whatever queued it: it lands after
|
||||
`async_remove_entry` has deleted the file and recreates it orphaned,
|
||||
and a reload scheduled by `_reconcile_rehydrated` would read the
|
||||
pre-reload snapshot back off disk. This runs once per entry load, so
|
||||
the immediate write costs nothing worth deferring.
|
||||
"""
|
||||
ident = self._identity
|
||||
try:
|
||||
await self._snapshot_store.async_save(
|
||||
{
|
||||
"resources": dict(resources),
|
||||
"subdevice_candidates": [asdict(su) for su in candidates],
|
||||
"identity": asdict(ident) if ident is not None else None,
|
||||
}
|
||||
)
|
||||
except Exception as e:
|
||||
# Never fail a poll over the snapshot -- a board reporting
|
||||
# something the JSON encoder rejects would otherwise break
|
||||
# polling outright. Worst case this entry can't load offline,
|
||||
# which is where it was before any of this existed.
|
||||
self._log.warning("could not write discovery snapshot: %s", e)
|
||||
|
||||
async def async_rehydrate(self) -> bool:
|
||||
"""Register the last known entity set without reaching the device.
|
||||
|
||||
Replays the stored snapshot through `_run_discovery`, which is what
|
||||
makes this faithful: same code path, same registry resolution, so an
|
||||
offline load produces the entity set the device last actually
|
||||
reported rather than a guess reconstructed from a parallel format.
|
||||
|
||||
Returns False when there's nothing stored (an entry that has never
|
||||
polled successfully) or the replay produced nothing usable -- the
|
||||
caller raises ConfigEntryNotReady in that case, exactly as before.
|
||||
"""
|
||||
try:
|
||||
stored = await self._snapshot_store.async_load()
|
||||
except Exception as e: # corrupt or unreadable store
|
||||
self._log.warning("could not read discovery snapshot: %s", e)
|
||||
return False
|
||||
if not stored or not stored.get("resources"):
|
||||
return False
|
||||
|
||||
resources = stored["resources"]
|
||||
try:
|
||||
ident = stored.get("identity")
|
||||
if ident is not None:
|
||||
self._identity = DeviceIdentity(
|
||||
manufacturer=ident.get("manufacturer") or "",
|
||||
model=ident.get("model") or "",
|
||||
name=ident.get("name") or "",
|
||||
serial=ident.get("serial"),
|
||||
device_types=tuple(ident.get("device_types") or ()),
|
||||
raw=ident.get("raw") or {},
|
||||
)
|
||||
# JSON gives lists back where Subdevice declares tuples, and it's
|
||||
# a frozen (hashable) dataclass used as a dict key in flatten().
|
||||
self.subdevices = [
|
||||
Subdevice(
|
||||
kind=su["kind"],
|
||||
key=su["key"],
|
||||
seed_path=tuple(su.get("seed_path") or ()),
|
||||
flat_hrefs=tuple(su.get("flat_hrefs") or ()),
|
||||
)
|
||||
for su in stored.get("subdevice_candidates") or ()
|
||||
]
|
||||
self._run_discovery(resources, from_snapshot=True)
|
||||
except Exception as e:
|
||||
# A snapshot written by an older release can outlive both the
|
||||
# stored shape and the registry it was discovered against. This
|
||||
# has to catch the rebuild as well as the replay: an exception
|
||||
# escaping here reaches async_setup_entry, which only handles
|
||||
# ConfigEntryNotReady, so the entry would land in SETUP_ERROR --
|
||||
# never retried, and with its session left open.
|
||||
self._log.warning("discovery snapshot could not be replayed: %s", e, exc_info=True)
|
||||
self.bound = []
|
||||
self.subdevices = []
|
||||
return False
|
||||
|
||||
# _run_discovery sets _discovered; put it back. The snapshot only
|
||||
# supplied an entity set to register -- the first live poll must
|
||||
# still enumerate subdevices and rediscover for real.
|
||||
self._discovered = False
|
||||
self._rehydrate_resources = resources
|
||||
self._rehydrated_keys = self._bound_keys()
|
||||
if not self.bound:
|
||||
return False
|
||||
self._log.info(
|
||||
"device unreachable; restored %d entities from the last discovery "
|
||||
"snapshot and will keep retrying every %ds",
|
||||
len(self.bound),
|
||||
SUMMARY_INTERVAL_S,
|
||||
)
|
||||
return True
|
||||
|
||||
@callback
|
||||
def _reconcile_rehydrated(self) -> None:
|
||||
"""Reload the entry when a live discovery disagrees with the snapshot
|
||||
this load registered from.
|
||||
|
||||
Platforms enumerate `bound` exactly once, at forward time, so a
|
||||
firmware update, a newly-answering sibling subdevice or a different
|
||||
appliance at the same IP can't be picked up in place -- the entry has
|
||||
to come back up against the live set.
|
||||
"""
|
||||
if self._rehydrated_keys is None:
|
||||
return
|
||||
stale = self._rehydrated_keys
|
||||
self._rehydrated_keys = None
|
||||
live = self._bound_keys()
|
||||
if live == stale:
|
||||
return
|
||||
self._log.info(
|
||||
"live discovery differs from the snapshot this entry loaded from "
|
||||
"(%d entities gone, %d new); reloading",
|
||||
len(stale - live),
|
||||
len(live - stale),
|
||||
)
|
||||
self.hass.config_entries.async_schedule_reload(self._entry.entry_id)
|
||||
|
||||
def _run_discovery(self, resources: dict[str, dict], from_snapshot: bool = False) -> None:
|
||||
# Diagnostics only -- names the firmware generation (e.g. '7.0 Air
|
||||
# conditioner' is Tizen Lite); doesn't route, since every device
|
||||
# that reports it is already typed by modelNum.
|
||||
@@ -850,7 +1306,13 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
model=model,
|
||||
)
|
||||
self._persist_identity(serial, model, mfr, device_type_name)
|
||||
self._update_coverage_gap_issue(device_type_name is None, unbound, name)
|
||||
if not from_snapshot:
|
||||
# A coverage gap is a claim about what the device reports, so only
|
||||
# a live poll gets to make it. Replaying a snapshot would restate
|
||||
# last run's conclusion while pointing the user at a diagnostics
|
||||
# download that is empty until the appliance answers, and any
|
||||
# drift in the device name between the two would churn the issue.
|
||||
self._update_coverage_gap_issue(device_type_name is None, unbound, name)
|
||||
|
||||
self._hot_hrefs = sorted(hot)
|
||||
self._warm_hrefs = sorted(warm)
|
||||
@@ -915,7 +1377,38 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
if self._session is None:
|
||||
# _poll_once already connects on a real poll; only fires if
|
||||
# the session was closed out from under us concurrently.
|
||||
await self.hass.async_add_executor_job(self._connect_session)
|
||||
try:
|
||||
await self.hass.async_add_executor_job(self._connect_session)
|
||||
except Exception as e:
|
||||
# Not a poll failure -- the poll that reached this line
|
||||
# already succeeded, and observe mode is only an
|
||||
# optimization on top of it. Give up on push this cycle
|
||||
# the same way the two branches below do, rather than
|
||||
# letting this escape _async_update_data uncaught: none
|
||||
# of this integration's reconnect bookkeeping would run,
|
||||
# and the base coordinator logs an ERROR traceback in
|
||||
# place of the deliberately quiet "poll failed,
|
||||
# reconnecting" voice used everywhere else in this file.
|
||||
#
|
||||
# Not counted by _reconnect_is_frequent() (that window
|
||||
# records reconnects the poll path itself performed --
|
||||
# feeding it a secondary path's failure would push the
|
||||
# next routine poll reconnect over the warn threshold),
|
||||
# and nothing to _close_session(): _connect_session only
|
||||
# publishes self._session once connect() and
|
||||
# start_reader() have both already succeeded, so it's
|
||||
# still None here. No _resubscribe_due either -- that
|
||||
# flag means "a live session nothing has tried yet",
|
||||
# and setting it would re-enter this doomed handshake
|
||||
# every cycle; _last_observe_attempt_ts (stamped above)
|
||||
# already paces the retry to _RECOVERY_RETRY_S.
|
||||
self._log.info(
|
||||
"observe-mode reconnect failed (%s), staying on polling: %s",
|
||||
type(e).__name__,
|
||||
e,
|
||||
)
|
||||
self._observe.abandon_observe_attempt()
|
||||
return
|
||||
sess = self._session
|
||||
if sess is None:
|
||||
return
|
||||
@@ -971,6 +1464,19 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
`_POLL_TIMEOUT_LIMIT` consecutive timeouts pile up. Any other
|
||||
exception reconnects immediately.
|
||||
|
||||
That includes `SessionClosedError`, which is the point: before
|
||||
smartthings-local 0.1.6, a reader thread that had actually died was
|
||||
indistinguishable from a slow transfer -- both surfaced here only as
|
||||
a `TimeoutError`, so this tolerance was the only thing standing
|
||||
between a truly dead session and a reconnect, worst case about
|
||||
`_POLL_TIMEOUT_LIMIT` poll cycles (~2 minutes at the default 30s
|
||||
interval). 0.1.6 confirms reader death directly and raises a
|
||||
ConnectionError subclass for it instead, which isn't a TimeoutError
|
||||
and so skips this tolerance entirely -- a genuinely dead session now
|
||||
reconnects on the very first occurrence. Intended (see this repo's
|
||||
README, "Known device behavior"), not a regression, but a real
|
||||
change in observed reconnect timing for that one failure mode.
|
||||
|
||||
Never defers before first discovery (issue #254): deferring returns
|
||||
an empty dict, which the base coordinator treats as a successful
|
||||
first refresh -- and since platforms enumerate `bound` once, the
|
||||
@@ -1021,7 +1527,7 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
type(e).__name__,
|
||||
e,
|
||||
)
|
||||
return flatten(self.bound, self._cache.snapshot())
|
||||
return flatten(self.bound, self.entity_resources())
|
||||
self._consecutive_poll_timeouts = 0
|
||||
# A lone reconnect is routine (README's "Known device
|
||||
# behavior"); only warn once they pile up. Pause first so
|
||||
@@ -1050,7 +1556,7 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
# there are bound entities to carry it.
|
||||
if self._discovered and snapshot:
|
||||
self._log.debug("Full error:", exc_info=e2)
|
||||
return flatten(self.bound, snapshot)
|
||||
return flatten(self.bound, self.entity_resources())
|
||||
raise UpdateFailed(f"poll failed after reconnect: {e2}") from e2
|
||||
else:
|
||||
# A fresh session has zero OBSERVE registrations; if we
|
||||
@@ -1073,9 +1579,37 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
# cycle's snapshot so discovery sees every subdevice on the
|
||||
# first poll rather than waiting a cycle.
|
||||
async with self._session_lock:
|
||||
resources = await self.hass.async_add_executor_job(
|
||||
self._enumerate_subdevices_blocking, resources
|
||||
)
|
||||
try:
|
||||
resources = await self.hass.async_add_executor_job(
|
||||
self._enumerate_subdevices_blocking, resources
|
||||
)
|
||||
except Exception as e:
|
||||
# _connect_session() inside here only runs at all if the
|
||||
# session the poll above just used got closed out from
|
||||
# under us within this same cycle -- rare, but not
|
||||
# impossible, and unguarded before this. Losing the
|
||||
# subdevice probe isn't losing first discovery: `resources`
|
||||
# keeps the value _poll_once already returned, so
|
||||
# discovery below still runs on the master's own data,
|
||||
# same posture _poll_subdevice_seed takes for one sibling
|
||||
# going quiet.
|
||||
#
|
||||
# Not a one-cycle blip, though: `_run_discovery` a few
|
||||
# lines below sets `self._discovered = True`
|
||||
# unconditionally this same cycle, which is what gates
|
||||
# this whole block -- there is no next cycle where this
|
||||
# is retried. A composite appliance whose enumeration
|
||||
# fails here loses its sibling subdevices' entities for
|
||||
# this config entry's lifetime (a reload probes again).
|
||||
# warning, not debug, because of that: it's silent and
|
||||
# permanent otherwise, with nothing in the log pointing
|
||||
# at why a device is missing entities it should have.
|
||||
self._log.warning(
|
||||
"subdevice enumeration failed on first discovery; "
|
||||
"any sibling subdevices will be missing until this "
|
||||
"config entry is reloaded: %s",
|
||||
e,
|
||||
)
|
||||
|
||||
source = "sweep" if self._discovered else "poll"
|
||||
first_cycle = not self._discovered
|
||||
@@ -1085,7 +1619,13 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
# StateCache has no eviction, so the only way to keep them out
|
||||
# is to not put them in. Safe to reorder: _run_discovery reads
|
||||
# the passed dict, never the cache.
|
||||
candidates = list(self.subdevices)
|
||||
self._run_discovery(resources)
|
||||
# Banked before the reconcile below, so a reload it schedules
|
||||
# comes up against this discovery rather than the one that is
|
||||
# being replaced.
|
||||
await self._async_save_snapshot(resources, candidates)
|
||||
self._reconcile_rehydrated()
|
||||
resources = self._live_subdevice_resources(resources)
|
||||
sweep_mismatch = False
|
||||
if self._observe.mode == MODE_OBSERVE:
|
||||
@@ -1098,6 +1638,14 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
for href, rep in resources.items():
|
||||
self._observe.apply(href, rep, source=source)
|
||||
|
||||
if first_cycle:
|
||||
# The apply loop above has just fed this poll's /course/vs/0 to
|
||||
# the cloud-program store, so the gap is knowable now. Explicit
|
||||
# rather than left to _persist_cloud_courses: a device whose
|
||||
# programs are all already named learns nothing on this cycle and
|
||||
# would otherwise never get its stale Repair cleared.
|
||||
self._refresh_cloud_course_issue()
|
||||
|
||||
if first_cycle or self._resubscribe_due:
|
||||
self._resubscribe_due = False
|
||||
await self._attempt_observe_mode()
|
||||
@@ -1114,7 +1662,7 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
self._run_subpolls(force=sweep_mismatch), name="localthings_subpoll"
|
||||
)
|
||||
|
||||
return flatten(self.bound, self._cache.snapshot())
|
||||
return flatten(self.bound, self.entity_resources())
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Command dispatch (called by entity platforms in Task 5)
|
||||
@@ -1136,18 +1684,34 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
if write_fn is None:
|
||||
return
|
||||
href = bound_entity.href
|
||||
rep = self._cache.get(href or "") or {}
|
||||
resources = self._cache.snapshot()
|
||||
# Through entity_rep(), not the bare cache: write_fn must see the
|
||||
# same rep exists_fn/rep_fn were handed, including the merged
|
||||
# cloud-program field (issue #342). Identical to the cache entry for
|
||||
# every href that field doesn't touch, and without copying the whole
|
||||
# tree to read one rep.
|
||||
rep = self.entity_rep(href or "")
|
||||
# The remote-control gate below keys off the raw on-the-wire href
|
||||
# and a raw snapshot -- /remotectrl/* is a shared, MAIN-only
|
||||
# resource that a subdevice's canonical_resources() view (owned
|
||||
# hrefs only) would drop entirely. write_fn/validate_fn, by
|
||||
# contrast, are written against canonical hrefs (same convention as
|
||||
# exists_fn/rep_fn -- see entity.py's _resources), so they get this
|
||||
# entity's own subdevice view instead of the raw snapshot: without
|
||||
# it, a composite device's write_fn reading resources.get(some
|
||||
# canonical href) (e.g. airconditioner._temperature_step) would
|
||||
# silently see the master's resource instead of its own subdevice's.
|
||||
raw_resources = self._cache.snapshot()
|
||||
bypass_remote_control = self._entry.options.get(CONF_BYPASS_REMOTE_CONTROL, False)
|
||||
if (
|
||||
not bypass_remote_control
|
||||
and remote_control_required_for_write(resources, href or "")
|
||||
and not remote_control_enabled(resources)
|
||||
and remote_control_required_for_write(raw_resources, href or "")
|
||||
and not remote_control_enabled(raw_resources)
|
||||
):
|
||||
raise ServiceValidationError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="remote_control_disabled",
|
||||
)
|
||||
resources = self.canonical_resources(bound_entity.subdevice)
|
||||
validate_fn = getattr(desc, "validate_fn", None)
|
||||
if validate_fn is not None:
|
||||
error = validate_fn(payload, rep, resources)
|
||||
@@ -1303,12 +1867,24 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
self._log.debug("raw write follow-up read failed: %s", e)
|
||||
return code, new_rep
|
||||
|
||||
def _raw_read_blocking(self, path_segs: list[str], href: str) -> tuple[int, dict]:
|
||||
def _raw_read_blocking(self, path_segs: list[str], href: str) -> tuple[int, dict, Any]:
|
||||
"""Debug primitive: a live GET, deliberately bypassing the cache
|
||||
(issue #300) -- the cache can be up to a poll interval stale,
|
||||
exactly the staleness that makes testing whether a write held or
|
||||
got silently reverted by the board unreliable. Blocking -- runs in
|
||||
executor."""
|
||||
executor.
|
||||
|
||||
Returns `(code, rep, body)`. `rep` is the decoded body only when it
|
||||
is a Property map, since that's the shape the observe cache and
|
||||
every capability are written against. `body` is whatever CBOR
|
||||
actually decoded to, and exists because a Collection answers a
|
||||
*list*, not a map: `/device/0` and its `x.com.samsung.devcol`
|
||||
siblings return the `[devcol rep, {href, rep}, ...]` batch
|
||||
`parse_device0_batch` reads. Reporting only `rep` rendered those as
|
||||
an accepted-but-empty `2.05 {}`, which reads as "the resource is
|
||||
there and has nothing in it" -- the opposite of what a full batch
|
||||
means, and how issue #335's `/sec/devices` was nearly written off.
|
||||
"""
|
||||
if self._session is None:
|
||||
self._connect_session()
|
||||
sess = self._session
|
||||
@@ -1316,6 +1892,7 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
raise RuntimeError("no session")
|
||||
code, payload = sess.get(path_segs, timeout=10.0)
|
||||
rep: dict = {}
|
||||
body: Any = None
|
||||
if code == 0x45 and payload:
|
||||
try:
|
||||
body = cbor2.loads(payload)
|
||||
@@ -1325,11 +1902,13 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
if isinstance(body, dict):
|
||||
self._observe.apply(href, body, source="poll")
|
||||
rep = body
|
||||
return code, rep
|
||||
return code, rep, body
|
||||
|
||||
async def async_raw_read(self, href: str) -> tuple[int, dict]:
|
||||
async def async_raw_read(self, href: str) -> tuple[int, dict, Any]:
|
||||
"""Debug-only live GET (issue #300, backs the read_resource
|
||||
service). Same href validation as async_raw_write."""
|
||||
service). Same href validation as async_raw_write. Three-tuple --
|
||||
see `_raw_read_blocking` for why the raw body comes back alongside
|
||||
the Property-map `rep`."""
|
||||
path_segs = _href_to_path_segs(href)
|
||||
if not path_segs:
|
||||
raise ServiceValidationError(
|
||||
@@ -1338,9 +1917,31 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
)
|
||||
norm_href = "/" + "/".join(path_segs)
|
||||
async with self._session_lock:
|
||||
return await self.hass.async_add_executor_job(
|
||||
self._raw_read_blocking, path_segs, norm_href
|
||||
)
|
||||
try:
|
||||
return await self.hass.async_add_executor_job(
|
||||
self._raw_read_blocking, path_segs, norm_href
|
||||
)
|
||||
except Exception as e:
|
||||
# Unlike async_raw_write_sequence, there's nothing to
|
||||
# reconnect-and-retry here -- a live debug read either lands
|
||||
# or it doesn't, and a service call is the one place on this
|
||||
# path a raw session exception would otherwise reach a user
|
||||
# untranslated (write_resource already goes through
|
||||
# HomeAssistantError; this brings read_resource in line).
|
||||
if not isinstance(e, TimeoutError):
|
||||
# Same TimeoutError-vs-anything-else split as
|
||||
# _poll_once: a block-ACK timeout alone doesn't prove
|
||||
# the session is dead, but anything else does -- and
|
||||
# leaving a confirmed-dead one installed would fail
|
||||
# every read/write identically until the next real
|
||||
# poll cycle's own reconnect notices.
|
||||
await self.hass.async_add_executor_job(self._close_session)
|
||||
self._log.warning("debug read failed for %s: %s", norm_href, e)
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="debug_read_failed",
|
||||
translation_placeholders={"href": norm_href, "error": str(e)},
|
||||
) from e
|
||||
|
||||
async def async_raw_write_sequence(
|
||||
self,
|
||||
@@ -1448,9 +2049,26 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
verified: dict[str, Any] = {}
|
||||
async with self._session_lock:
|
||||
for href in dict.fromkeys(r["href"] for r in results):
|
||||
vcode, vrep = await self.hass.async_add_executor_job(
|
||||
self._raw_read_blocking, _href_to_path_segs(href), href
|
||||
)
|
||||
read_error: str | None = None
|
||||
try:
|
||||
vcode, vrep, _vbody = await self.hass.async_add_executor_job(
|
||||
self._raw_read_blocking, _href_to_path_segs(href), href
|
||||
)
|
||||
except Exception as e:
|
||||
# The write already landed -- see `results` above,
|
||||
# built before this wait ever started. A failed
|
||||
# confirmation read (the session dying in the gap
|
||||
# verify_after just waited out, say) must not lose
|
||||
# that outcome behind a raised exception here, and
|
||||
# one href's failure shouldn't stop the rest of the
|
||||
# batch from being checked. Same "couldn't verify"
|
||||
# posture as a 4.04/empty read below: held stays
|
||||
# None, not False -- but raw_code 0 alone is also
|
||||
# what a 4.04 produces, so read_error is what tells
|
||||
# the two apart for a caller inspecting the response.
|
||||
self._log.debug("raw write verification read failed for %s: %s", href, e)
|
||||
vcode, vrep = 0, {}
|
||||
read_error = str(e)
|
||||
# None, not False, when the re-read brought back nothing
|
||||
# to compare: every comparison against an empty rep is
|
||||
# False, which would report a 4.04 as a revert -- the one
|
||||
@@ -1465,6 +2083,7 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
if read_ok
|
||||
else None
|
||||
),
|
||||
"read_error": read_error,
|
||||
}
|
||||
response["verified"] = verified
|
||||
|
||||
|
||||
@@ -16,8 +16,10 @@ from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.loader import async_get_integration
|
||||
|
||||
from . import cloudcourse
|
||||
from .const import DOMAIN
|
||||
from .coordinator import LocalThingsCoordinator
|
||||
from .registry.capabilities.laundry import cycle_options
|
||||
from .registry.redact import redact_resources
|
||||
from .registry.subdevices import MAIN
|
||||
|
||||
@@ -32,6 +34,7 @@ async def async_get_config_entry_diagnostics(
|
||||
# disk (listdir + open + read_text), which trips HA's event-loop blocking
|
||||
# detector when called inline here. Offload it to the executor.
|
||||
stl_version = await hass.async_add_executor_job(pkg_version, "smartthings-local")
|
||||
cloud_courses = coordinator.cloud_courses.snapshot()
|
||||
|
||||
# /oic/p, /oic/d, and /oic/res sit outside the /device/0 batch captured
|
||||
# below, so they'd otherwise never reach an issue report. /oic/d's `rt`
|
||||
@@ -54,7 +57,7 @@ async def async_get_config_entry_diagnostics(
|
||||
# than redacting /information/vs/0 again -- modelNum never matches
|
||||
# redact.py's substring rules, so the value is the same either way.
|
||||
matching = [b for b in coordinator.bound if b.subdevice == su]
|
||||
res = redact_resources(coordinator.canonical_resources(su))
|
||||
res = redact_resources(coordinator.device_resources(su))
|
||||
return {
|
||||
"kind": su.kind,
|
||||
"key": su.key,
|
||||
@@ -88,7 +91,7 @@ async def async_get_config_entry_diagnostics(
|
||||
# /mode/vs/0 under no attribution. Each sibling reports its own
|
||||
# resources in `subdevices` below instead. For a device with no
|
||||
# subdevices, this is byte-identical to `last_resources`.
|
||||
"resources": redact_resources(coordinator.canonical_resources(MAIN)),
|
||||
"resources": redact_resources(coordinator.device_resources(MAIN)),
|
||||
# Sibling indoor subdevices discovered on this connection (issue
|
||||
# #177). subdeviceIdList (the UUID a prefixed subdevice's key comes
|
||||
# from) is deliberately NOT redacted here, unlike elsewhere in
|
||||
@@ -137,6 +140,25 @@ async def async_get_config_entry_diagnostics(
|
||||
"enabled": coordinator.learning_enabled,
|
||||
"codes": coordinator.learned_snapshot(),
|
||||
},
|
||||
# Cloud "Download" programs discovered on this device (issue #342),
|
||||
# reported separately from `resources` for the same reason as
|
||||
# learned_modes above -- the dump there stays exactly what the device
|
||||
# said, and this is what the integration made of it.
|
||||
#
|
||||
# Reported in full, names included. Half of what can go wrong with
|
||||
# this feature is a configuration question -- which programs got
|
||||
# named, which Download course was confirmed, whether a payload was
|
||||
# ever captured for a slot the device advertises -- and none of that
|
||||
# is answerable from the payloads alone. The names are the user's own
|
||||
# words, so this is the one place they appear; they reach a dump only
|
||||
# because its owner chose to download and share it.
|
||||
"cloud_courses": {
|
||||
"advertised_slots": cloudcourse.advertised_slots(coordinator.cloud_course_rep()),
|
||||
"cloud_slots": cloudcourse.cloud_slots(
|
||||
coordinator.cloud_course_rep(), cycle_options(coordinator.device_resources(MAIN))
|
||||
),
|
||||
**cloud_courses,
|
||||
},
|
||||
"integration_version": integration.version,
|
||||
"smartthings_local_version": stl_version,
|
||||
"observe_mode": coordinator.observe_mode,
|
||||
|
||||
@@ -35,12 +35,16 @@ def _is_included(bound: BoundEntity, coordinator: LocalThingsCoordinator) -> boo
|
||||
`bound`'s own subdevice's canonical view instead of the raw snapshot,
|
||||
same rule as everywhere else a whole-resources-dict scan happens --
|
||||
this is a free function, so it can't use self._resources.
|
||||
|
||||
Reads `discovery_resources`, not `last_resources`: on an offline load
|
||||
(issue #295) the live cache is still empty, and judging existence
|
||||
against it would filter every rehydrated entity away.
|
||||
"""
|
||||
rep = coordinator.last_resources.get(bound.href)
|
||||
rep = coordinator.discovery_resources.get(bound.href)
|
||||
if rep is None:
|
||||
return False
|
||||
if bound.desc.exists_fn is not None:
|
||||
return bound.desc.exists_fn(rep, coordinator.canonical_resources(bound.subdevice))
|
||||
return bound.desc.exists_fn(rep, coordinator.discovery_canonical(bound.subdevice))
|
||||
if bound.desc.field:
|
||||
if not rep or is_stub_rep(rep):
|
||||
return True
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"domain": "localthings",
|
||||
"name": "LocalThings",
|
||||
"after_dependencies": ["recorder"],
|
||||
"codeowners": ["@mbillow"],
|
||||
"config_flow": true,
|
||||
"dependencies": [],
|
||||
@@ -10,7 +11,7 @@
|
||||
"requirements": [
|
||||
"cbor2>=5.4.6",
|
||||
"pyOpenSSL>=23.0",
|
||||
"smartthings-local>=0.1.2"
|
||||
"smartthings-local>=0.1.8"
|
||||
],
|
||||
"version": "0.20.0"
|
||||
"version": "0.22.0"
|
||||
}
|
||||
@@ -56,6 +56,26 @@ SUCCESS_FRACTION = 0.8
|
||||
PUSH_HEALTH_WINDOW_S = 60.0
|
||||
|
||||
|
||||
def _is_alarms_href(href: str) -> bool:
|
||||
"""True for /alarms/vs/<index> in any subdevice-translated shape --
|
||||
the canonical MAIN form (/alarms/vs/0), an indexed subdevice's
|
||||
renumbered instance (/alarms/vs/<key>), or a prefixed subdevice's
|
||||
UUID-qualified form (/<uuid>/alarms/vs/0). `Subdevice.to_actual`
|
||||
(registry/subdevices.py) only ever rewrites the trailing index
|
||||
segment or prepends a prefix -- it never touches the 'alarms/vs'
|
||||
stem -- so matching that fixed segment plus a wildcard tail catches
|
||||
every shape without this module needing to be subdevice-aware.
|
||||
|
||||
See `ObserveManager.apply`'s use of this for why the href matters:
|
||||
unlike most resources, /alarms/vs/0's `x.com.samsung.da.items` array
|
||||
is a complete snapshot of every currently-active alarm, not a
|
||||
possibly-partial field update -- so it must never be merged onto a
|
||||
stale prior rep (issue #348).
|
||||
"""
|
||||
head, _, _ = href.rpartition("/")
|
||||
return head.endswith("/alarms/vs")
|
||||
|
||||
|
||||
class ObserveManager:
|
||||
"""Per-device observe-mode state: mode, write-settle guard, and (later)
|
||||
subscription/staleness tracking. Pure sync logic — safe to call from
|
||||
@@ -122,6 +142,20 @@ class ObserveManager:
|
||||
comes through, even though nothing about the device's actual
|
||||
supported options changed.
|
||||
|
||||
`_is_alarms_href` is the one exception to that merge (issue #348):
|
||||
/alarms/vs/0's `items` array is always sent as a complete
|
||||
snapshot of every currently-active alarm, never a partial delta
|
||||
-- confirmed by a live `read_resource` GET returning `{}` (no
|
||||
`items` key at all) the moment a washer's board actually clears
|
||||
an alarm, which entity.py already documents as this resource's
|
||||
normal no-alarm shape. Merging that `{}` onto the prior rep the
|
||||
same way as everywhere else silently kept the stale `items`
|
||||
entry forever: an absent key merges as "unchanged" everywhere
|
||||
else, but on this href absent specifically means "cleared".
|
||||
Every family that exposes an alarm sensor shares this href
|
||||
(common.ALARMS, range_hood's own copy), so this is a full
|
||||
replace for all of them, not a washer-specific carve-out.
|
||||
|
||||
`apply()` is the sole path StateCache mutations flow through in
|
||||
this component (poll, sweep, and OBSERVE notify all funnel here),
|
||||
so `_cache_lock` serializes the read-then-write across those
|
||||
@@ -149,7 +183,7 @@ class ObserveManager:
|
||||
self.log.debug("dropping %s update for %s (settling)", source, href)
|
||||
return False
|
||||
with self._cache_lock:
|
||||
merged = {**(self.cache.get(href) or {}), **rep}
|
||||
merged = dict(rep) if _is_alarms_href(href) else {**(self.cache.get(href) or {}), **rep}
|
||||
changed = self.cache.apply_rep(href, merged, source=source)
|
||||
# Outside the cache lock -- the hook takes locks of its own and
|
||||
# never reads the cache back. `source` is passed along rather than
|
||||
|
||||
@@ -225,13 +225,16 @@ _OIC_TYPE_TO_KEY: dict[str, str] = {
|
||||
"oic.d.dishwasher": "dishwasher",
|
||||
"oic.d.dryer": "dryer",
|
||||
"oic.d.oven": "oven",
|
||||
"oic.d.range": "range", # issue #324 -- oven+cooktop combo, no /information/vs/0
|
||||
"oic.d.refrigerator": "refrigerator",
|
||||
"oic.d.krefrigerator": "refrigerator", # issue #328 -- kimchi refrigerator
|
||||
"oic.d.washer": "washer",
|
||||
"x.com.st.d.airqualitysensor": "air_monitor",
|
||||
"x.com.st.d.dehumidifier": "dehumidifier",
|
||||
"x.com.st.d.hood": "range_hood", # AHD-WW-TP1-22-COMMON
|
||||
"x.com.st.d.stickcleaner": "vacuum_station",
|
||||
"x.com.st.d.steamcloset": "air_dresser",
|
||||
"x.com.st.d.winecellar": "refrigerator", # issue #328 -- same TP1X_REF_21K board
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ REGISTRY = DeviceRegistry(
|
||||
fridge.DOOR_ALERT,
|
||||
common.WATER_FILTER,
|
||||
fridge.AIR_FILTER,
|
||||
fridge.DEODOR_FILTER,
|
||||
fridge.AUTO_DOOR_TIMER,
|
||||
fridge.WINECELLAR_PANTRY_ZONE,
|
||||
fridge.WINECELLAR_INFO,
|
||||
dishwasher.DIAGNOSIS,
|
||||
fridge.ICEMAKER_NIGHTTIME,
|
||||
fridge.FLEX_ZONE,
|
||||
@@ -44,5 +48,6 @@ REGISTRY = DeviceRegistry(
|
||||
fridge.DOOR_GENERIC,
|
||||
fridge.KIMCHI_ZONE,
|
||||
fridge.KIMCHI_DOOR_GENERIC,
|
||||
fridge.AUTO_DOOR_VARIANT,
|
||||
],
|
||||
)
|
||||
@@ -1,9 +1,7 @@
|
||||
"""Stick-vacuum clean/auto-empty station device registry (issue #131).
|
||||
"""Stick-vacuum clean/auto-empty station device registry (issues #131 / #219).
|
||||
|
||||
See capabilities/vacuum_station.py's module docstring for why this only
|
||||
covers the station's own dustbag/dustbin/UV-sanitize state and not any
|
||||
vacuum-body control (suction, battery, cleaning mode) -- the diagnostics
|
||||
dump this was built from reports none of that.
|
||||
Station dustbag/dustbin/UV-sanitize state plus, when present (VS9700),
|
||||
wand battery/charging via `/status/stick/vs/0`. No suction/room-map control.
|
||||
"""
|
||||
|
||||
from ..capabilities import common, ignored, vacuum_station
|
||||
@@ -20,6 +18,7 @@ REGISTRY = DeviceRegistry(
|
||||
vacuum_station.DUSTBAG_USAGE,
|
||||
vacuum_station.DUSTBIN_SETTING,
|
||||
vacuum_station.CLEANSTATION_STATUS,
|
||||
vacuum_station.STICK_BODY,
|
||||
]
|
||||
),
|
||||
)
|
||||
@@ -10,18 +10,25 @@ the same dust/fine_dust/super_fine_dust/odor/clean_level keys so this
|
||||
device shares those capabilities' catalog entries. This board additionally
|
||||
reports a CO2 reading the other two families don't.
|
||||
|
||||
A second `value` list element on the particulate-matter types (e.g. Dust's
|
||||
`['31', '2']`) reads like a coarse quality-grade code, but nothing on this
|
||||
board confirms what its scale means -- left unbound rather than guessed;
|
||||
index 0 is the only slot any family has ever read.
|
||||
A second `value` list element on the particulate-matter types (Dust's
|
||||
`['31', '2']`) is the device's own graded air-quality level for that
|
||||
reading -- see common.sensor_item_value. Still unbound here: the grade's
|
||||
floor differs by board family, and CleanLevel already carries the
|
||||
aggregate. This board's own readings are load-bearing evidence for the
|
||||
PM mapping, though: 23 grading one step above the floor as FineDust is
|
||||
what rules out a PM10-width band for that field.
|
||||
|
||||
Dust/FineDust/SuperFineDust aren't assigned an HA `device_class`
|
||||
(pm10/pm25/pm1) or `unit` despite reading like plausible ug/m3 particulate
|
||||
values: Samsung's own two-tier Korean convention maps only to a PM10/PM2.5
|
||||
pair, and this board's three-tier naming doesn't confirm where the extra
|
||||
tier or a PM1 reading fits. A wrong guess would silently mislabel every
|
||||
reading forever, so they're plain `measurement` sensors named after the
|
||||
device's own field instead, matching air_purifier.AIR_QUALITY's precedent.
|
||||
Dust/FineDust/SuperFineDust carry the same HA `device_class`/`unit` as the
|
||||
purifier family (issue #325, Dust=PM10 / FineDust=PM2.5 /
|
||||
SuperFineDust=PM1 in μg/m³). The mapping rests on device-side grading this
|
||||
board shares rather than on anything purifier-specific, so typing one
|
||||
family and not the other would have been an inconsistency, not caution.
|
||||
|
||||
These sensors have recorded *unitless* long-term statistics since issue
|
||||
#210, though, and Home Assistant suppresses statistics generation outright
|
||||
for an entity whose unit no longer matches its recorded metadata -- so
|
||||
stamping a unit on would have silently stopped the history it was meant to
|
||||
label. __init__.py's v2->v3 entry migration relabels that metadata first.
|
||||
"""
|
||||
|
||||
from datetime import time as dt_time
|
||||
@@ -31,12 +38,15 @@ from ..entities import BinarySensorDesc, SensorDesc, SwitchDesc, TimeDesc
|
||||
from .air_purifier import _AIR_QUALITY_SENSORS
|
||||
from .common import int_or_none, sensor_item_value
|
||||
|
||||
# _AIR_QUALITY_SENSORS' fourth column (state_class) is deliberately discarded
|
||||
# here: air_purifier leaves Odor/CleanLevel unstamped because they read as
|
||||
# device_class/unit are taken from the shared rows; state_class deliberately
|
||||
# is not. air_purifier leaves Odor/CleanLevel unstamped because they read as
|
||||
# graded indices on that family, while this board has stamped all five as
|
||||
# `measurement` since it was added (issue #210). Consuming the column would
|
||||
# silently drop long-term statistics for two sensors on shipped devices, so
|
||||
# the shared rows supply only the key/icon/type here.
|
||||
# `measurement` since it was added (issue #210) -- consuming that column
|
||||
# would silently drop long-term statistics for two sensors on shipped
|
||||
# devices. The pm10/pm25/pm1 labels carry over cleanly, though: they rest on
|
||||
# device-side grading this board shares (see the module docstring), and
|
||||
# __init__.py's v2->v3 entry migration relabels the unitless statistics
|
||||
# these five have been recording so the new unit doesn't suppress them.
|
||||
SENSORS = Capability(
|
||||
href="/sensors/vs/0",
|
||||
poll_tier="warm",
|
||||
@@ -47,9 +57,11 @@ SENSORS = Capability(
|
||||
field="x.com.samsung.da.items",
|
||||
icon=icon,
|
||||
state_class="measurement",
|
||||
device_class=device_class,
|
||||
unit=unit,
|
||||
value_fn=lambda items, t=sensor_type: sensor_item_value(items, t),
|
||||
)
|
||||
for key, icon, sensor_type, _ in _AIR_QUALITY_SENSORS
|
||||
for key, icon, sensor_type, _state_class, device_class, unit in _AIR_QUALITY_SENSORS
|
||||
),
|
||||
SensorDesc(
|
||||
key="co2",
|
||||
|
||||
@@ -51,13 +51,13 @@ def _has_top_level_modes(rep, resources):
|
||||
return isinstance(rep.get("x.com.samsung.da.supportedModes"), (list, tuple))
|
||||
|
||||
|
||||
# The fourth column is state_class, which is what makes Home Assistant keep
|
||||
# long-term statistics for a sensor -- without one, a reading is only in the
|
||||
# short-term recorder history and disappears with the next purge (10 days by
|
||||
# default), so it can't back a long-range air-quality graph. The values are
|
||||
# already numeric (sensor_item_value returns int), so nothing else was in the
|
||||
# way; three sensors in this same module (filter_progress, fan_speed_level,
|
||||
# hepa_filter_usage) already declare one.
|
||||
# Columns: key, icon, device item type, state_class, device_class, unit.
|
||||
# state_class is what makes Home Assistant keep long-term statistics --
|
||||
# without one, a reading is only in the short-term recorder history and
|
||||
# disappears with the next purge (10 days by default), so it can't back a
|
||||
# long-range air-quality graph. The values are already numeric
|
||||
# (sensor_item_value returns int); three sensors in this same module
|
||||
# (filter_progress, fan_speed_level, hepa_filter_usage) already declare one.
|
||||
#
|
||||
# Only the three particulate readings get it. They fall monotonically with
|
||||
# particle size on three independent board families -- 11/9/5 on ARTIK051_TVTL
|
||||
@@ -67,15 +67,40 @@ def _has_top_level_modes(rep, resources):
|
||||
# indices instead, where the mean of a grade isn't obviously meaningful; left
|
||||
# without a state_class rather than guessing.
|
||||
#
|
||||
# Deliberately no device_class/unit here: pm1/pm25/pm10 would assert the
|
||||
# reading is a µg/m³ concentration, and the dumps never say so. That's a
|
||||
# separate call from making the series recordable at all.
|
||||
# device_class/unit: Dust=PM10, FineDust=PM2.5, SuperFineDust=PM1, all
|
||||
# μg/m³ (issue #325). Three independent lines, none of them naming order --
|
||||
# which is what the earlier "plausible but unconfirmed" note rejected:
|
||||
#
|
||||
# 1. The device grades its own readings. Each dust item's value[] is
|
||||
# [concentration, grade] (see common.sensor_item_value); the grade band
|
||||
# is not shared across the three fields -- a reading of 18 grades one
|
||||
# step *above* the floor as SuperFineDust (air_monitor fixture) but *at*
|
||||
# the floor as Dust (range_hood fixture), both 1-based families. So the
|
||||
# firmware itself treats them as three different scales ordered
|
||||
# coarse-to-fine, rather than one repeated measurement.
|
||||
# 2. Where each field's floor/second-band boundary falls brackets the
|
||||
# Korean CAI bands: Dust good at 18, graded up at 31 (CAI PM10 breaks
|
||||
# at 30/31); FineDust good at 14, graded up at 23 (CAI PM2.5 breaks at
|
||||
# 15/16); SuperFineDust good at 9, graded up at 18 (PM2.5-style, which
|
||||
# is what a PM1 reading gets -- there is no standard PM1 index).
|
||||
# 3. A live ARTIK051_TVTL read against the SmartThings app at the same
|
||||
# moment: Dust matched the app's PM10 exactly, the other two were 1
|
||||
# μg/m³ off in the same order, and the app shows exactly these three
|
||||
# tiers, so there is no fourth candidate to assign.
|
||||
#
|
||||
# Dust >= FineDust >= SuperFineDust holds on all 11 fixtures that report
|
||||
# this resource, which is the cumulative-mass ordering PM10 >= PM2.5 >= PM1
|
||||
# requires by definition. The unit literal must stay HA's own spelling of
|
||||
# μg/m³ (U+03BC GREEK SMALL LETTER MU, not U+00B5 MICRO SIGN) -- they render
|
||||
# alike but only U+03BC is in DEVICE_CLASS_UNITS, and the mismatch is a
|
||||
# runtime warning per entity, not a test failure. Pinned by
|
||||
# tests/test_sensor_device_class_units.py.
|
||||
_AIR_QUALITY_SENSORS = (
|
||||
("dust", "mdi:blur", "Dust", "measurement"),
|
||||
("fine_dust", "mdi:blur", "FineDust", "measurement"),
|
||||
("super_fine_dust", "mdi:blur", "SuperFineDust", "measurement"),
|
||||
("odor", "mdi:scent", "Odor", None),
|
||||
("clean_level", "mdi:air-filter", "CleanLevel", None),
|
||||
("dust", "mdi:blur", "Dust", "measurement", "pm10", "μg/m³"),
|
||||
("fine_dust", "mdi:blur", "FineDust", "measurement", "pm25", "μg/m³"),
|
||||
("super_fine_dust", "mdi:blur", "SuperFineDust", "measurement", "pm1", "μg/m³"),
|
||||
("odor", "mdi:scent", "Odor", None, None, None),
|
||||
("clean_level", "mdi:air-filter", "CleanLevel", None, None, None),
|
||||
)
|
||||
|
||||
AIR_QUALITY = Capability(
|
||||
@@ -87,9 +112,11 @@ AIR_QUALITY = Capability(
|
||||
field="x.com.samsung.da.items",
|
||||
icon=icon,
|
||||
state_class=state_class,
|
||||
device_class=device_class,
|
||||
unit=unit,
|
||||
value_fn=lambda items, t=sensor_type: sensor_item_value(items, t),
|
||||
)
|
||||
for key, icon, sensor_type, state_class in _AIR_QUALITY_SENSORS
|
||||
for key, icon, sensor_type, state_class, device_class, unit in _AIR_QUALITY_SENSORS
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ here off the coordinator snapshot. These caps stay out of the global
|
||||
capabilities/__init__.py) -- AC-only, by_type registry only.
|
||||
"""
|
||||
|
||||
import math
|
||||
from dataclasses import replace
|
||||
|
||||
from ..capability import Capability
|
||||
@@ -22,7 +23,7 @@ from ..entities import (
|
||||
SwitchDesc,
|
||||
)
|
||||
from . import common
|
||||
from .common import filter_usage_percent, normalize_temp_unit
|
||||
from .common import filter_usage_hours, filter_usage_percent, normalize_temp_unit
|
||||
from .laundry import option_write
|
||||
|
||||
|
||||
@@ -100,8 +101,15 @@ def _threshold_write(payload, rep, href=None):
|
||||
def _sensor_item_value(items, type_):
|
||||
"""First value of the /sensors/vs/0 item with the given
|
||||
x.com.samsung.da.type. Dust/FineDust/SuperFineDust report a 2-element
|
||||
array; only v[0] is used, since the second element's meaning is
|
||||
unconfirmed. No device_class is set: the resource exposes no unit."""
|
||||
array; only v[0] is used. v[1] is the device's own graded air-quality
|
||||
level for that reading, left unbound because its floor differs by
|
||||
family -- see common.sensor_item_value for the full note.
|
||||
|
||||
No device_class here: unlike air_purifier (issue #325), no AC family
|
||||
has had its dust readings correlated against the app, and every AC
|
||||
fixture reports permanent zeros or ties, so this file's own dumps
|
||||
supply no grade-band evidence either. Returns a string rather than an
|
||||
int, which these diagnostic entities have always done."""
|
||||
for it in items or []:
|
||||
if isinstance(it, dict) and it.get("x.com.samsung.da.type") == type_:
|
||||
v = it.get("x.com.samsung.da.value")
|
||||
@@ -364,6 +372,33 @@ def _has_option_token(prefix):
|
||||
)
|
||||
|
||||
|
||||
def _has_option_token_any_board(prefix):
|
||||
"""Token-presence test with no board-generation gate.
|
||||
|
||||
`_has_option_token` above requires `is_legacy_board`, which was right for
|
||||
the settings it guards but wrong for a token whose presence is itself the
|
||||
only signal that needs checking -- issue #367 found `OutdoorTemp_` live
|
||||
on 14 of 23 recorded fixtures despite none of them being legacy boards.
|
||||
Same shape as `beep`'s Volume_ test and `_has_display_light_option`,
|
||||
which already treat token presence as sufficient across generations."""
|
||||
return lambda rep, resources: _option_token(rep, prefix) is not None
|
||||
|
||||
|
||||
def _reports_celsius(resources):
|
||||
"""Whether this subdevice's own /temperatures/vs/0 declares Celsius (or
|
||||
says nothing at all, `_temps_vs_unit`'s default).
|
||||
|
||||
Guards `OutdoorTemp_`'s -55 offset below: issue #367's field validation
|
||||
(48h against weather.forecast_home, r=0.92) ran on Celsius-locale boards
|
||||
only -- 13 of the 14 non-legacy fixtures that carry the token declare
|
||||
Celsius, and the offset's own calibration comment is a Celsius reading
|
||||
too. The one Fahrenheit-locale exception on record
|
||||
(`airconditioner_lnx_rac_heatpump`) has nothing to confirm the same
|
||||
additive constant, or degrees C rather than F, still hold -- so this
|
||||
stays off boards that declare anything else, rather than guess."""
|
||||
return _temps_vs_unit(resources.get(HREF_TEMPS_VS) or {}) == "°C"
|
||||
|
||||
|
||||
def _option_token_on(prefix):
|
||||
return lambda rep: _option_token(rep, prefix) == "On"
|
||||
|
||||
@@ -491,7 +526,68 @@ def _humidity(rep):
|
||||
return None
|
||||
|
||||
|
||||
def _climate_write(payload, rep, href=None):
|
||||
def _quantize_temperature(value, step):
|
||||
"""Quantize a temperature to the device's advertised step size.
|
||||
|
||||
Mirrors climate.py's `target_temperature_step`, which defaults to `1.0`
|
||||
when no increment is advertised anywhere (`step=None` or `<=0` here) --
|
||||
so a board with no increment still gets whole-degree writes instead of
|
||||
the raw value passed through unrounded. Returns `None` for a payload
|
||||
that isn't numeric, so the caller can reject the write instead of
|
||||
building a body around a null (coordinator.py's async_send_command
|
||||
already logs and drops a write_fn result of None).
|
||||
|
||||
Normalizes an integral result to `int` here, once, so both write
|
||||
branches serialize `24` rather than `24.0` -- `round(..., 2)` guards
|
||||
against float noise in the division (e.g. `21.7 / 0.1`).
|
||||
"""
|
||||
try:
|
||||
numeric = float(value)
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
if not math.isfinite(numeric):
|
||||
# float('nan')/float('inf') pass the try/except above (they're
|
||||
# valid floats) but round()/division on them raises ValueError/
|
||||
# OverflowError instead of returning -- reject here so a bad
|
||||
# payload always comes back as a clean None, not an exception
|
||||
# out of write_fn.
|
||||
return None
|
||||
step_value = _num(step) or 1.0
|
||||
if step_value <= 0:
|
||||
step_value = 1.0
|
||||
quantized = round(round(numeric / step_value) * step_value, 2)
|
||||
return int(quantized) if quantized.is_integer() else quantized
|
||||
|
||||
|
||||
def _temperature_step(resources):
|
||||
"""Device-reported temperature increment, read the same way and in the
|
||||
same order as climate.py's `target_temperature_step`: OCF
|
||||
`/temperature/control/vs/0`'s `increment` (or its vendor-prefixed
|
||||
twin), falling back to vendor `/temperatures/vs/0`. The increment on
|
||||
that second resource lives inside its `items[]` array like every other
|
||||
per-item field, not at the resource's top level -- unwrapped via
|
||||
`_temps_vs_item()`, the same helper `_temps_vs_current`/`_temps_vs_unit`
|
||||
use above, rather than read off `resource` directly.
|
||||
|
||||
`rep` (the bound entity's own resource, `/mode/vs/0` for ClimateDesc --
|
||||
see rep_fn=_first_mode below) never carries an increment, so it isn't a
|
||||
candidate here; only the coordinator's `resources` snapshot is."""
|
||||
if not isinstance(resources, dict):
|
||||
return None
|
||||
control = resources.get(HREF_TEMP_CONTROL)
|
||||
if isinstance(control, dict):
|
||||
step = _num(control.get("increment")) or _num(control.get("x.com.samsung.da.increment"))
|
||||
if step is not None:
|
||||
return step
|
||||
temps_vs = resources.get(HREF_TEMPS_VS)
|
||||
if isinstance(temps_vs, dict):
|
||||
step = _num(_temps_vs_item(temps_vs).get("x.com.samsung.da.increment"))
|
||||
if step is not None:
|
||||
return step
|
||||
return None
|
||||
|
||||
|
||||
def _climate_write(payload, rep, href=None, resources=None):
|
||||
"""Maps a (kind, value) command from the climate platform to the
|
||||
(path_segs, body) for that one sub-write; `value` is already the raw
|
||||
device code. Power always goes to vendor `/power/vs/0` (OCF `/power/0`
|
||||
@@ -504,9 +600,12 @@ def _climate_write(payload, rep, href=None):
|
||||
return (["power", "vs", "0"], {"x.com.samsung.da.power": "On" if value else "Off"})
|
||||
if kind == "mode":
|
||||
return (["mode", "vs", "0"], {"x.com.samsung.da.modes": [value]})
|
||||
if kind == "temperature_ocf":
|
||||
return (["temperature", "desired", "0"], {"temperature": round(float(value))})
|
||||
if kind == "temperature":
|
||||
if kind in ("temperature_ocf", "temperature"):
|
||||
quantized = _quantize_temperature(value, _temperature_step(resources))
|
||||
if quantized is None:
|
||||
return None
|
||||
if kind == "temperature_ocf":
|
||||
return (["temperature", "desired", "0"], {"temperature": quantized})
|
||||
# Vendor items[] array; only one item observed on every AC dump, id '0'.
|
||||
return (
|
||||
["temperatures", "vs", "0"],
|
||||
@@ -514,7 +613,7 @@ def _climate_write(payload, rep, href=None):
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.desired": str(round(float(value))),
|
||||
"x.com.samsung.da.desired": str(quantized),
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -710,13 +809,34 @@ CLIMATE = Capability(
|
||||
),
|
||||
# Outdoor temperature, offset by 55 -- calibrated against an
|
||||
# independent thermometer (token 75 while it read 20.3°C).
|
||||
#
|
||||
# exists_fn is token-presence-only (issue #367), not is_legacy_board:
|
||||
# gating it there dropped the sensor on every non-legacy board that
|
||||
# reports it -- 14 of 17 fixtures carrying the token in the issue's
|
||||
# own survey. A 48h/289-sample field capture correlated it against
|
||||
# weather.forecast_home at r=0.92, ruling out a firmware constant.
|
||||
# `_reports_celsius` keeps that presence check from also claiming
|
||||
# the -55 Celsius offset for board generations it was never
|
||||
# validated on -- see its own docstring.
|
||||
#
|
||||
# enabled_default=False: multi-split installs (multiple indoor heads
|
||||
# on one outdoor condenser) report the same token on every head, so
|
||||
# a fix here creates one identical sensor per head rather than one
|
||||
# per physical unit (same duplication as the shared energy/power
|
||||
# counters in issue #329). Left disabled so a user with several
|
||||
# heads can enable just one instead of getting N duplicates active
|
||||
# by default.
|
||||
SensorDesc(
|
||||
key="outdoor_temperature",
|
||||
rep_fn=_option_token_num("OutdoorTemp", offset=55),
|
||||
exists_fn=_has_option_token("OutdoorTemp"),
|
||||
exists_fn=lambda rep, resources: (
|
||||
_has_option_token_any_board("OutdoorTemp")(rep, resources)
|
||||
and _reports_celsius(resources)
|
||||
),
|
||||
device_class="temperature",
|
||||
state_class="measurement",
|
||||
unit="°C",
|
||||
enabled_default=False,
|
||||
icon="mdi:home-thermometer-outline",
|
||||
),
|
||||
# Filter time in tenths of an hour, counting UP since last filter
|
||||
@@ -854,16 +974,17 @@ AIR_FILTER = Capability(
|
||||
icon="mdi:air-filter",
|
||||
entity_category="diagnostic",
|
||||
),
|
||||
# Lifetime hour counter, resets only on filter replacement.
|
||||
# Lifetime hour counter, resets only on filter replacement. Derived
|
||||
# from the percentage and filterCapacity (issue #330) -- filterUsage
|
||||
# itself is not an hour count.
|
||||
SensorDesc(
|
||||
key="air_filter_usage_hours",
|
||||
field="x.com.samsung.da.filterUsage",
|
||||
rep_fn=filter_usage_hours,
|
||||
device_class="duration",
|
||||
state_class="total_increasing",
|
||||
unit_fn=_filter_unit,
|
||||
icon="mdi:air-filter",
|
||||
entity_category="diagnostic",
|
||||
value_fn=_int,
|
||||
),
|
||||
# Locally writable alarm threshold (see _threshold_write); only
|
||||
# surfaces where supportedFilterDesiredUsage is advertised.
|
||||
@@ -925,13 +1046,12 @@ AIR_FILTER_PM1 = Capability(
|
||||
),
|
||||
SensorDesc(
|
||||
key="air_filter_pm1_usage_hours",
|
||||
field="x.com.samsung.da.filterUsage",
|
||||
rep_fn=filter_usage_hours,
|
||||
device_class="duration",
|
||||
state_class="total_increasing",
|
||||
unit_fn=_filter_unit,
|
||||
icon="mdi:air-filter",
|
||||
entity_category="diagnostic",
|
||||
value_fn=_int,
|
||||
exists_fn=_has_filter_field("x.com.samsung.da.filterUsage"),
|
||||
),
|
||||
SelectDesc(
|
||||
@@ -1486,12 +1606,10 @@ AIR_QUALITY = Capability(
|
||||
# CO2 (PR #316, ACA-KR-TP2-21-AN9000) -- a type this file's other AC
|
||||
# families don't report. Same field/shape air_monitor.SENSORS
|
||||
# already models with device_class='carbon_dioxide'/unit='ppm', so
|
||||
# this matches that descriptor rather than guessing fresh -- unlike
|
||||
# the pm10/pm25/pm1 mapping air_monitor.py's own docstring
|
||||
# deliberately rejects for the three dust-type keys above (Samsung's
|
||||
# two-tier PM10/PM2.5 convention doesn't confirm where a third tier
|
||||
# or PM1 fits), ppm for a field literally named CO2 isn't a guess of
|
||||
# that kind.
|
||||
# this matches that descriptor rather than guessing fresh. The dust
|
||||
# keys above stay untyped for the reason in _sensor_item_value: the
|
||||
# pm10/pm25/pm1 mapping is confirmed for the purifier and monitor
|
||||
# families (issue #325), but no AC family has evidence of its own.
|
||||
SensorDesc(
|
||||
key="co2",
|
||||
field="x.com.samsung.da.items",
|
||||
|
||||
@@ -72,15 +72,25 @@ def epoch_to_utc(value):
|
||||
|
||||
|
||||
def filter_usage_percent(rep):
|
||||
"""Filter usage as a percentage of rated capacity. Several families
|
||||
report `filterUsage` as a raw count in `filterCapacityUnit` (e.g. 100 of
|
||||
a 500-hour capacity), so a plain value with a '%' unit would be wrong.
|
||||
Returns None when capacity is missing/zero."""
|
||||
used = _num(rep.get("x.com.samsung.da.filterUsage"))
|
||||
"""Filter usage as a percentage. `filterUsage` is already 0-100 on every
|
||||
family confirmed so far, including ARTIK051_PRAC (issue #330): its own
|
||||
fixture and three live heads all show `filterStatus == 'wash'` at
|
||||
`filterUsage == '100'` regardless of `filterCapacity` (60/224/500 across
|
||||
other families' fixtures), which only holds if `filterUsage` is already
|
||||
a percent -- dividing by capacity again would read that filter as fresh
|
||||
at 20%."""
|
||||
return int_or_none(rep.get("x.com.samsung.da.filterUsage"))
|
||||
|
||||
|
||||
def filter_usage_hours(rep):
|
||||
"""Elapsed filter hours, derived from the percentage and capacity rather
|
||||
than read off `filterUsage` directly -- `filterUsage` is a percent, not
|
||||
an hour count (issue #330). Returns None when capacity is missing/zero."""
|
||||
pct = filter_usage_percent(rep)
|
||||
cap = _num(rep.get("x.com.samsung.da.filterCapacity"))
|
||||
if used is None or not cap:
|
||||
if pct is None or not cap:
|
||||
return None
|
||||
return round(used / cap * 100)
|
||||
return round(pct / 100 * cap, 1)
|
||||
|
||||
|
||||
def normalize_temp_unit(raw, default="°F"):
|
||||
@@ -126,6 +136,28 @@ def _active_alarm_codes(items):
|
||||
return ", ".join(codes) if codes else "none"
|
||||
|
||||
|
||||
def hex_pairs(codes):
|
||||
"""'1C1D21...' -> ['1C', '1D', '21', ...]."""
|
||||
return [codes[i : i + 2] for i in range(0, len(codes) - 1, 2)]
|
||||
|
||||
|
||||
def option_value(options, prefix):
|
||||
"""Find `<prefix>_<value>` in an options[] array and return <value>.
|
||||
|
||||
Lives here rather than in laundry.py, which is where it grew, because
|
||||
cloudcourse.py needs it too and laundry.py imports *that* -- so the
|
||||
reverse import would be a module cycle. The coordinator already imports
|
||||
from this module, so nothing about the dependency direction is unusual;
|
||||
it is specifically the laundry/cloudcourse pair that can't reach each
|
||||
other. Anchored at position 0 so 'Course_' never matches
|
||||
'CloudCourse_'/'OneTimeCloudCourse_'.
|
||||
"""
|
||||
for o in options or []:
|
||||
if isinstance(o, str) and o.startswith(prefix + "_"):
|
||||
return o.split("_", 1)[1]
|
||||
return None
|
||||
|
||||
|
||||
def merge_options_field(cached, new_tokens):
|
||||
"""Merge freshly-written `<Prefix>_<Value>` tokens into a cached
|
||||
x.com.samsung.da.options[]-style array the same way the device itself
|
||||
@@ -217,12 +249,42 @@ def _power_sensor_exists(rep, resources):
|
||||
return not model_allows_power_on_off(resources)
|
||||
|
||||
|
||||
def diagnosis_status(value):
|
||||
"""'Ready' -> the catalog's 'ready'; anything else is left raw.
|
||||
|
||||
Shared by dishwasher and dryer, which report the same field.
|
||||
"""
|
||||
return "ready" if value == "Ready" else value
|
||||
|
||||
|
||||
def sensor_item_value(items, sensor_type, index=0):
|
||||
"""Pull one reading out of a `/sensors/vs/0`-style items[] list -- each
|
||||
item is `{type, value: [...]}`; `index` picks which slot to read
|
||||
(index 0 is the raw measurement on every family seen so far). Shared
|
||||
by range_hood.AIR_QUALITY, air_purifier.AIR_QUALITY, and
|
||||
air_monitor.SENSORS, which all read the same resource shape."""
|
||||
air_monitor.SENSORS, which all read the same resource shape.
|
||||
|
||||
value[] is 2-element on the fields that carry a magnitude
|
||||
(Dust/FineDust/SuperFineDust/CO2) and 1-element on Odor/CleanLevel.
|
||||
That asymmetry is what index 1 means: it is the device's own graded
|
||||
air-quality level for that reading -- the same kind of value Odor and
|
||||
CleanLevel already *are*, which is why those two have no second slot.
|
||||
It reads 0-2 against index 0's observed 0-31, tracks index 0 within a
|
||||
device, and CleanLevel equals the highest per-field grade on 9 of the
|
||||
11 fixtures reporting this resource (the range hood and one RAC report
|
||||
a higher CleanLevel than any dust grade, so they fold in something
|
||||
else).
|
||||
|
||||
Index 1 is deliberately left unbound rather than exposed as an entity:
|
||||
its floor is not portable. ARTIK051_TVTL grades good air as 0, while
|
||||
AVT-WW-TP1 / A-VTWW-TP2 / TP1X / ASM-KR-TP1 / AHD-WW-TP1 all grade it
|
||||
as 1, so a shared descriptor would need a per-family offset to mean
|
||||
anything, and CleanLevel already carries the aggregate. The grade is
|
||||
still load-bearing as *evidence*: it is what confirms the three dust
|
||||
fields are three different scales rather than one repeated reading --
|
||||
see air_purifier._AIR_QUALITY_SENSORS and
|
||||
tests/test_air_quality_grade_column.py.
|
||||
"""
|
||||
for item in items or ():
|
||||
if not isinstance(item, dict):
|
||||
continue
|
||||
|
||||
@@ -9,6 +9,7 @@ wash, auto release dry) are read locally here.
|
||||
|
||||
from ..capability import Capability
|
||||
from ..entities import ButtonDesc, SelectDesc, SensorDesc, SwitchDesc
|
||||
from .common import diagnosis_status
|
||||
from .laundry import bool_option_switch, cycle_select
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -76,6 +77,9 @@ DIAGNOSIS = Capability(
|
||||
field="x.com.samsung.da.diagnosisStart",
|
||||
icon="mdi:stethoscope",
|
||||
entity_category="diagnostic",
|
||||
device_class="enum",
|
||||
options=("ready",),
|
||||
value_fn=diagnosis_status,
|
||||
),
|
||||
ButtonDesc(
|
||||
key="diagnosis_start",
|
||||
|
||||
@@ -11,6 +11,7 @@ the /course/vs/0 cycle select -- lives in laundry.py.
|
||||
|
||||
from ..capability import Capability
|
||||
from ..entities import SensorDesc, SwitchDesc
|
||||
from .common import diagnosis_status
|
||||
from .laundry import cycle_select, drum_clean_cycles_remaining, drum_clean_last_cleaned
|
||||
|
||||
|
||||
@@ -26,7 +27,17 @@ DRYER_SETTINGS = Capability(
|
||||
entities=(
|
||||
SensorDesc(key="dry_level", field="x.com.samsung.da.dryLevel", icon="mdi:water-percent"),
|
||||
SensorDesc(key="dry_time", field="x.com.samsung.da.dryTime", icon="mdi:timer"),
|
||||
SensorDesc(key="dryer_type", field="x.com.samsung.da.dryerType", icon="mdi:tumble-dryer"),
|
||||
SensorDesc(
|
||||
key="dryer_type",
|
||||
field="x.com.samsung.da.dryerType",
|
||||
icon="mdi:tumble-dryer",
|
||||
device_class="enum",
|
||||
# Only 'Electricity' confirmed across shipped fixtures (#366); an
|
||||
# unrecognized value still passes through raw via sensor.py's
|
||||
# options property rather than breaking the entity.
|
||||
options=("electricity",),
|
||||
value_fn=lambda v: v.lower() if isinstance(v, str) else v,
|
||||
),
|
||||
SwitchDesc(
|
||||
key="wrinkle_prevent",
|
||||
field="x.com.samsung.da.wrinklePrevent",
|
||||
@@ -46,6 +57,13 @@ DRYER_SETTINGS = Capability(
|
||||
# (issue #244). /st/dryercourse/vs/0 re-encodes the same selected course
|
||||
# and is ignored (ignored.py), mirroring /st/washercourse/vs/0 for washers.
|
||||
#
|
||||
# dryer_cycle_table_00 is a separate, older course-code family reported by
|
||||
# a DVE45R6300W/A3 (issue #357), confirmed the same way: the reporter
|
||||
# selected each cycle on the appliance and read back the resulting raw
|
||||
# code. It shares no codes with Table_03 above -- 'a5' Bedding here and
|
||||
# '01' Normal are both table-scoped, so a Table_03 dryer never picks up a
|
||||
# Table_00 label or vice versa (see laundry.cycle_select's table_href).
|
||||
#
|
||||
# Drum Clean+ maintenance tracking (issue #258) reuses washer.py's
|
||||
# DrumCleanProposal_/WashingTimes_/DrumCleanLog_ tokens on this same
|
||||
# options[] array -- see laundry.drum_clean_cycles_remaining/
|
||||
@@ -84,7 +102,12 @@ DRYER_DIAGNOSIS = Capability(
|
||||
poll_tier="warm",
|
||||
entities=(
|
||||
SensorDesc(
|
||||
key="diagnosis", field="x.com.samsung.da.diagnosisStart", entity_category="diagnostic"
|
||||
key="diagnosis",
|
||||
field="x.com.samsung.da.diagnosisStart",
|
||||
entity_category="diagnostic",
|
||||
device_class="enum",
|
||||
options=("ready",),
|
||||
value_fn=diagnosis_status,
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -326,9 +326,154 @@ STATUS_LOCK = Capability(
|
||||
value_fn=lambda v: v == "On",
|
||||
write_fn=_status_lock_write("x.com.samsung.da.device.sound"),
|
||||
),
|
||||
# Auto Door Open's own voice/sound feedback toggles (issue #328,
|
||||
# TP1X_REF_21K family) -- siblings of auto_door_opener above, not
|
||||
# duplicates of fridge_sound (device.sound is the general appliance
|
||||
# beep, these two gate ado's own prompts). Only seen on the
|
||||
# auto-door-equipped variants (single/kimchi/winecellar), not the
|
||||
# earlier TP1X_REF_21K dumps that predate that feature -- gated on
|
||||
# each field's own presence rather than assumed universal.
|
||||
SwitchDesc(
|
||||
key="auto_door_voice_control",
|
||||
field="x.com.samsung.da.ado.voicecontrol",
|
||||
icon="mdi:microphone",
|
||||
entity_category="config",
|
||||
value_fn=lambda v: v == "On",
|
||||
write_fn=_status_lock_write("x.com.samsung.da.ado.voicecontrol"),
|
||||
exists_fn=lambda rep, resources: "x.com.samsung.da.ado.voicecontrol" in rep,
|
||||
),
|
||||
SwitchDesc(
|
||||
key="auto_door_sound_control",
|
||||
field="x.com.samsung.da.ado.soundcontrol",
|
||||
icon="mdi:volume-medium",
|
||||
entity_category="config",
|
||||
value_fn=lambda v: v == "On",
|
||||
write_fn=_status_lock_write("x.com.samsung.da.ado.soundcontrol"),
|
||||
exists_fn=lambda rep, resources: "x.com.samsung.da.ado.soundcontrol" in rep,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
# Auto Door Open's paired delay setting (issue #328, TP1X_REF_21K family):
|
||||
# how long the door stays held open before it re-closes, on/off itself is
|
||||
# STATUS_LOCK.auto_door_opener above. Same discrete-options-select shape as
|
||||
# DEFINITE_TEMPERATURE_COOLER/FREEZER. Unit unconfirmed -- no supportedList
|
||||
# field states it and the report carried no app screenshot -- so this is a
|
||||
# raw-code select rather than a guessed seconds/minutes NumberDesc.
|
||||
|
||||
|
||||
def _auto_door_timer_write(p, rep, href=None):
|
||||
return ["autodoor", "timer", "vs", "0"], {"x.com.samsung.da.time.desired": p}
|
||||
|
||||
|
||||
AUTO_DOOR_TIMER = Capability(
|
||||
href="/autodoor/timer/vs/0",
|
||||
poll_tier="warm",
|
||||
entities=(
|
||||
SelectDesc(
|
||||
key="auto_door_timer",
|
||||
field="x.com.samsung.da.time.desired",
|
||||
icon="mdi:timer-outline",
|
||||
translation_key="auto_door_timer",
|
||||
entity_category="config",
|
||||
options_field="x.com.samsung.da.time.supportedOptions",
|
||||
write_fn=_auto_door_timer_write,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
# /autodoor/<variant>/vs/0 -- one per fridge sub-type sharing the Auto Door
|
||||
# Open feature (single-door, kimchi, winecellar seen so far; issue #328).
|
||||
# Each reports only x.com.samsung.da.ado.openOptions, declaring which open
|
||||
# styles that variant supports -- every dump seen so far carries exactly
|
||||
# one option ('Single') with no paired desired/current field to make a
|
||||
# choice against, the same "no real choice to expose yet" shape as
|
||||
# ignored.py's /mode/0. Bound with no entities to record coverage; revisit
|
||||
# if a device ever reports more than one option.
|
||||
#
|
||||
# A pattern cap rather than one entry per variant: match_fn (not just the
|
||||
# prefix) is what actually gates this, so a future variant href needs no
|
||||
# code change to stay covered, and /autodoor/timer/vs/0's own exact-href
|
||||
# AUTO_DOOR_TIMER above always wins for that href regardless (discover()
|
||||
# only falls through to pattern caps when no exact cap matched). This is
|
||||
# registry-scoped, not global -- unlike ignored.IGNORED, the unknown-
|
||||
# device-type fallback never reaches it, so the prefix caveat in
|
||||
# ignored.py's own docstring doesn't apply here.
|
||||
AUTO_DOOR_VARIANT = Capability(
|
||||
href=None,
|
||||
href_prefix="/autodoor/",
|
||||
match_fn=lambda rep, resources: "x.com.samsung.da.ado.openOptions" in rep,
|
||||
)
|
||||
|
||||
# Wine-cellar variant (x.com.st.d.winecellar, issue #328) of the same
|
||||
# deodorizing filter AIR_FILTER models -- filterUsage/filterStatus at a
|
||||
# different href, same 0-100-percentage-already shape (see AIR_FILTER's own
|
||||
# comment). filterUsage reads '-1' on the only dump seen (filterStatus
|
||||
# 'normal'), relayed as-is rather than special-cased -- no second dump to
|
||||
# confirm whether that's a real sentinel or this unit just not tracking it.
|
||||
# Own 'deodor_'-prefixed keys rather than reusing AIR_FILTER.entities
|
||||
# verbatim -- same collision AIR_FILTER's own 'air_' prefix was chosen to
|
||||
# avoid against WATER_FILTER, and both filters are plausible on one unit
|
||||
# (this device's own board reports an internal air filter on other
|
||||
# TP1X_REF_21K variants).
|
||||
DEODOR_FILTER = Capability(
|
||||
href="/filter/deodorfilter/vs/0",
|
||||
poll_tier="cold",
|
||||
entities=(
|
||||
SensorDesc(
|
||||
key="deodor_filter_usage",
|
||||
field="x.com.samsung.da.filterUsage",
|
||||
unit="%",
|
||||
state_class="measurement",
|
||||
icon="mdi:air-filter",
|
||||
entity_category="diagnostic",
|
||||
value_fn=int_or_none,
|
||||
),
|
||||
SensorDesc(
|
||||
key="deodor_filter_status",
|
||||
field="x.com.samsung.da.filterStatus",
|
||||
device_class="enum",
|
||||
options=("normal", "wash", "replace"),
|
||||
translation_key="filter_status",
|
||||
icon="mdi:air-filter",
|
||||
entity_category="diagnostic",
|
||||
value_fn=lambda v: v.lower() if isinstance(v, str) else v,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
# Wine-cellar multi-compartment pantry select (issue #328): same
|
||||
# mode/supportedOptions shape as PANTRY_ZONE, at its own href with a 5-way
|
||||
# option set (Processed_Meat/Cheese/Nuts/Fruit/Wine) instead of PANTRY_ZONE's.
|
||||
# Only a "one" instance seen -- not generalized to a pattern cap, same
|
||||
# discipline as PANTRY_ZONE itself.
|
||||
|
||||
|
||||
def _winecellar_pantry_write(p, rep, href=None):
|
||||
return ["status", "winecellar", "pantry", "one", "vs", "0"], {"x.com.samsung.da.mode": p}
|
||||
|
||||
|
||||
WINECELLAR_PANTRY_ZONE = Capability(
|
||||
href="/status/winecellar/pantry/one/vs/0",
|
||||
poll_tier="warm",
|
||||
entities=(
|
||||
SelectDesc(
|
||||
key="winecellar_pantry_zone_mode",
|
||||
field="x.com.samsung.da.mode",
|
||||
icon="mdi:glass-wine",
|
||||
translation_key="winecellar_pantry_zone_mode",
|
||||
entity_category="config",
|
||||
options_field="x.com.samsung.da.supportedOptions",
|
||||
write_fn=_winecellar_pantry_write,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
# Wine-cellar internal table-revision marker (issue #328) -- versioning
|
||||
# metadata, not appliance state. Same treatment as ignored.py's
|
||||
# /wm/setinfo/vs/0.
|
||||
WINECELLAR_INFO = Capability(href="/information/winecellar/vs/0")
|
||||
|
||||
# /defrost/delay/vs/0 is the writable toggle to postpone a scheduled
|
||||
# defrost. /defrost/block/vs/0 is unrelated: despite the "block" naming,
|
||||
# live dumps confirm DEFROST_BLOCK_ON means the defrost cycle is actively
|
||||
|
||||
@@ -23,9 +23,11 @@ Door-LED keys use NO `x.com.samsung.da.` prefix -- `setBrightness` /
|
||||
from datetime import UTC, datetime
|
||||
from datetime import time as dt_time
|
||||
|
||||
from ... import cloudcourse
|
||||
from ...catalog import has_entity_translation
|
||||
from ..capability import Capability
|
||||
from ..entities import NumberDesc, SelectDesc, SensorDesc, SwitchDesc, TimeDesc
|
||||
from .common import hex_pairs, option_value
|
||||
|
||||
_LED_LEVELS = ("Low", "High")
|
||||
_SOUND_MODES = ("voice", "tone", "mute")
|
||||
@@ -198,11 +200,6 @@ BUZZER_SOUND = Capability(
|
||||
# boards expose the same /course/vs/0 options contract.
|
||||
|
||||
|
||||
def hex_pairs(codes):
|
||||
"""'1C1D21...' -> ['1C', '1D', '21', ...]."""
|
||||
return [codes[i : i + 2] for i in range(0, len(codes) - 1, 2)]
|
||||
|
||||
|
||||
def parse_edit_course_list(raw):
|
||||
"""'EditCourseList_1C1D21...' -> ['1C', '1D', '21', ...]."""
|
||||
if not isinstance(raw, str) or "_" not in raw:
|
||||
@@ -218,14 +215,6 @@ def cycle_options(resources):
|
||||
return _course_codes_from_supported_options(resources.get("/course/vs/0") or {})
|
||||
|
||||
|
||||
def option_value(options, prefix):
|
||||
"""Find `<prefix>_<value>` in the options array and return <value>."""
|
||||
for o in options or []:
|
||||
if isinstance(o, str) and o.startswith(prefix + "_"):
|
||||
return o.split("_", 1)[1]
|
||||
return None
|
||||
|
||||
|
||||
# Drum Clean+ maintenance tracking, from the same options[] array as the
|
||||
# selected course -- shared by washer.py (issue #9) and dryer.py (issue
|
||||
# #258), identical DrumCleanProposal_/WashingTimes_/DrumCleanLog_ tokens.
|
||||
@@ -309,26 +298,175 @@ def _course_codes_from_supported_options(course_rep):
|
||||
return []
|
||||
|
||||
|
||||
def option_tokens(*pairs):
|
||||
"""[(prefix, value), ...] -> ['<prefix>_<value>', ...] -- the general
|
||||
form of option_write, for the one write that needs two tokens to land in
|
||||
the same options[] array together (see cycle_write's cloud branch)."""
|
||||
return [f"{prefix}_{value}" for prefix, value in pairs]
|
||||
|
||||
|
||||
def option_write(prefix, new_value):
|
||||
"""A one-token x.com.samsung.da.options write -- see the module comment
|
||||
above for why this doesn't read/rewrite the whole array."""
|
||||
return [f"{prefix}_{new_value}"]
|
||||
return option_tokens((prefix, new_value))
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Cloud "Download" programs, folded into this same cycle select (issue #342).
|
||||
#
|
||||
# A device that has downloaded programs advertises them on the same
|
||||
# /course/vs/0 options array; cloudcourse.py owns the token shapes, the
|
||||
# learned store, and the reasoning for all of it. Everything below is just
|
||||
# how that store reaches the select: the coordinator merges it onto this
|
||||
# href's rep under cloudcourse.FIELD, so the option list, current value,
|
||||
# label, and write path each read it from the rep or snapshot they already
|
||||
# receive.
|
||||
#
|
||||
# They ride in the cycle select rather than a select of their own because
|
||||
# that is what they are to a user -- on the appliance's own controls,
|
||||
# "Download" occupies one position among the ordinary courses, and picking a
|
||||
# downloaded program is picking a cycle. Their raw values are namespaced
|
||||
# ('cloud:<slot>') so they can never be confused with, or collide with, a
|
||||
# two-hex-char local course code.
|
||||
#
|
||||
# Bound by whichever families declare it. Washers are where this was worked
|
||||
# out, but a DW5000C dishwasher advertises the same token (see
|
||||
# cloudcourse.py), so nothing below is washer-specific.
|
||||
#
|
||||
# Confirmed on hardware before any of this was written (issue #342): writing
|
||||
# the program token alone, while some other course is selected, is silently
|
||||
# ignored -- the course token has to switch to Download in the *same* write.
|
||||
# Hence the two-token write, the only one in this module.
|
||||
|
||||
|
||||
def _cloud_state(rep):
|
||||
return rep.get(cloudcourse.FIELD) or {}
|
||||
|
||||
|
||||
def cloud_options(rep):
|
||||
"""Namespaced raw values for every named, learned cloud program."""
|
||||
return [
|
||||
f"{cloudcourse.RAW_PREFIX}{slot}" for slot in sorted(_cloud_state(rep).get("programs", {}))
|
||||
]
|
||||
|
||||
|
||||
def cloud_label(value, resources):
|
||||
"""The user's own name for a 'cloud:<slot>' value.
|
||||
|
||||
Cloud program names are user-supplied, never translated: the appliance
|
||||
reports only an opaque slot id, and inventing an English label for one
|
||||
is exactly what this module refuses to do for unrecognized local course
|
||||
codes (see washer_cycle_fallback).
|
||||
"""
|
||||
if not isinstance(value, str) or not value.startswith(cloudcourse.RAW_PREFIX):
|
||||
return None
|
||||
slot = value[len(cloudcourse.RAW_PREFIX) :]
|
||||
rep = resources.get(cloudcourse.COURSE_HREF) or {}
|
||||
program = _cloud_state(rep).get("programs", {}).get(slot)
|
||||
return program["name"] if program else None
|
||||
|
||||
|
||||
def cloud_current(rep):
|
||||
"""'cloud:<slot>' when a named cloud program is the live selection.
|
||||
|
||||
Gated on the course actually being this device's confirmed Download
|
||||
course: tokens in this array are replaced by prefix and never evicted, so
|
||||
a one-time program token outlives the run it belonged to and would
|
||||
otherwise report "Jeans" while an ordinary cotton cycle runs.
|
||||
"""
|
||||
state = _cloud_state(rep)
|
||||
download = state.get("download_course")
|
||||
options = rep.get("x.com.samsung.da.options")
|
||||
if not download or option_value(options, "Course") != download:
|
||||
return None
|
||||
blob = option_value(options, cloudcourse.ONESHOT_PREFIX)
|
||||
slot = cloudcourse.slot_of(blob)
|
||||
if slot is None:
|
||||
# No one-time override loaded: the appliance falls back to whatever
|
||||
# the persisted default holds (confirmed with the issue #342
|
||||
# reporter -- leaving Download and returning to it re-selects the
|
||||
# saved program, not the last one-time one).
|
||||
slot = cloudcourse.slot_of(option_value(options, cloudcourse.DEFAULT_PREFIX))
|
||||
if slot is None or slot not in state.get("programs", {}):
|
||||
return None
|
||||
return f"{cloudcourse.RAW_PREFIX}{slot}"
|
||||
|
||||
|
||||
def cycle_write(p, rep, href=None):
|
||||
if not rep.get("x.com.samsung.da.options"):
|
||||
return None
|
||||
if isinstance(p, str) and p.startswith(cloudcourse.RAW_PREFIX):
|
||||
return _cloud_cycle_write(p, rep)
|
||||
return ["course", "vs", "0"], {
|
||||
"x.com.samsung.da.options": option_write("Course", p),
|
||||
}
|
||||
|
||||
|
||||
def _cloud_cycle_write(p, rep):
|
||||
state = _cloud_state(rep)
|
||||
download = state.get("download_course")
|
||||
program = state.get("programs", {}).get(p[len(cloudcourse.RAW_PREFIX) :])
|
||||
if not download or program is None:
|
||||
return None
|
||||
# Order matches what the appliance was confirmed to accept.
|
||||
return ["course", "vs", "0"], {
|
||||
"x.com.samsung.da.options": option_tokens(
|
||||
("Course", download), (cloudcourse.ONESHOT_PREFIX, program["blob"])
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def personal_course_labels(resources, href="/wm/personalcourse/vs/0"):
|
||||
"""Return device-provided personal course names keyed by course code.
|
||||
|
||||
Populated entries use a small TLV payload. The leading field is
|
||||
``01 <UTF-8-byte-length> <name>``; later fields contain a description and
|
||||
settings and are intentionally left uninterpreted. Empty slots are
|
||||
encoded as ``<code>_00``. Malformed or undecodable entries are ignored so
|
||||
opaque device data can never become a misleading label.
|
||||
"""
|
||||
rep = resources.get(href) or {}
|
||||
labels = {}
|
||||
for entry in rep.get("x.com.samsung.da.courses") or []:
|
||||
if not isinstance(entry, str) or "_" not in entry:
|
||||
continue
|
||||
code, encoded = entry.split("_", 1)
|
||||
try:
|
||||
payload = bytes.fromhex(encoded)
|
||||
except ValueError:
|
||||
continue
|
||||
if len(payload) < 3 or payload[0] != 0x01:
|
||||
continue
|
||||
name_length = payload[1]
|
||||
if name_length == 0 or len(payload) < 2 + name_length:
|
||||
continue
|
||||
try:
|
||||
name = payload[2 : 2 + name_length].decode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
continue
|
||||
if name.strip() and name.isprintable():
|
||||
labels[code.upper()] = name
|
||||
return labels
|
||||
|
||||
|
||||
def washer_cycle_fallback(value, resources):
|
||||
"""Label a personal washer course from its device-provided name.
|
||||
|
||||
No fallback for an unrecognized standard code -- an invented English
|
||||
label would defeat translation (PR #251 review); the raw code displays
|
||||
instead, same as before this function existed.
|
||||
"""
|
||||
if not isinstance(value, str):
|
||||
return None
|
||||
return personal_course_labels(resources).get(value.upper())
|
||||
|
||||
|
||||
def _table_id(resources, table_href):
|
||||
rep = resources.get(table_href) or {}
|
||||
return rep.get("x.com.samsung.da.st.courseTable")
|
||||
|
||||
|
||||
def cycle_select(*, translation_key, icon, table_href=None):
|
||||
def cycle_select(*, translation_key, icon, table_href=None, display_fn=None):
|
||||
"""A 'Cycle' select over /course/vs/0, labelled from `translation_key`.
|
||||
|
||||
The option list, current value, and write path are shared across
|
||||
@@ -346,9 +484,19 @@ def cycle_select(*, translation_key, icon, table_href=None):
|
||||
instead of borrowing a label from another board generation --
|
||||
translating a new table is a translations-only change.
|
||||
|
||||
The raw course code remains writable regardless; its display uses
|
||||
display_fn when supplied, otherwise it remains raw. display_fn is an
|
||||
optional family-specific fallback for untranslated raw values --
|
||||
select.py applies it after catalog lookup to both state and options.
|
||||
|
||||
Left at its default for dishwasher, which has no equivalent table-id
|
||||
resource and no evidence its codes vary by table the way washer/
|
||||
dryer's do.
|
||||
|
||||
Any cloud "Download" programs the user has discovered and named join the
|
||||
same option list, after the local courses -- see the cloud section above.
|
||||
A device with none (or one whose owner hasn't named any yet) gets exactly
|
||||
the list it got before they existed.
|
||||
"""
|
||||
key = translation_key
|
||||
if table_href is not None:
|
||||
@@ -360,13 +508,31 @@ def cycle_select(*, translation_key, icon, table_href=None):
|
||||
candidate = f"{translation_key}_{table.lower()}"
|
||||
return candidate if has_entity_translation("select", candidate) else "cycle"
|
||||
|
||||
def options(resources):
|
||||
rep = resources.get(cloudcourse.COURSE_HREF) or {}
|
||||
# Local courses first: a user-supplied cloud name that happens to
|
||||
# match a translated course name resolves back to the real local
|
||||
# course on write, which is the safer of the two. The options flow
|
||||
# rejects such a name outright, so this is a backstop, not the fix.
|
||||
return [*cycle_options(resources), *cloud_options(rep)]
|
||||
|
||||
def current(rep):
|
||||
return cloud_current(rep) or option_value(rep.get("x.com.samsung.da.options"), "Course")
|
||||
|
||||
def label(value, resources):
|
||||
cloud = cloud_label(value, resources)
|
||||
if cloud is not None:
|
||||
return cloud
|
||||
return display_fn(value, resources) if display_fn is not None else None
|
||||
|
||||
return SelectDesc(
|
||||
key="cycle",
|
||||
icon=icon,
|
||||
translation_key=key,
|
||||
options=cycle_options,
|
||||
exists_fn=lambda rep, resources: bool(cycle_options(resources)),
|
||||
rep_fn=lambda rep: option_value(rep.get("x.com.samsung.da.options"), "Course"),
|
||||
options=options,
|
||||
exists_fn=lambda rep, resources: bool(options(resources)),
|
||||
rep_fn=current,
|
||||
display_fn=label,
|
||||
write_fn=cycle_write,
|
||||
)
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ Shared by dryer/dishwasher/oven/washer families.
|
||||
import math
|
||||
from datetime import UTC, datetime, timedelta
|
||||
|
||||
from ...catalog import translated_states
|
||||
from ..capability import Capability
|
||||
from ..entities import BinarySensorDesc, ButtonDesc, NumberDesc, SensorDesc
|
||||
|
||||
@@ -25,7 +26,7 @@ def _to_ocf(v):
|
||||
|
||||
|
||||
def _progress(v):
|
||||
return "Idle" if v in (None, "None") else v
|
||||
return "idle" if v in (None, "None") else str(v).lower()
|
||||
|
||||
|
||||
def _int(v):
|
||||
@@ -35,12 +36,48 @@ def _int(v):
|
||||
return None
|
||||
|
||||
|
||||
def _state_is_active(rep):
|
||||
return _SAMSUNG_STATE_TO_OCF.get(rep.get("x.com.samsung.da.state")) == "active"
|
||||
|
||||
|
||||
def _is_active(rep):
|
||||
"""Check if appliance is actively running and cycle is not finished."""
|
||||
return (
|
||||
_SAMSUNG_STATE_TO_OCF.get(rep.get("x.com.samsung.da.state")) == "active"
|
||||
and rep.get("x.com.samsung.da.progress") != "Finish"
|
||||
)
|
||||
return _state_is_active(rep) and rep.get("x.com.samsung.da.progress") != "Finish"
|
||||
|
||||
|
||||
def _just_finished(rep):
|
||||
"""progress/progress_percentage's sticky_fn (issue #345, see sensor.py's
|
||||
_apply_sticky): arms their grace window the moment `progress` reads
|
||||
'Finish'.
|
||||
|
||||
Deliberately not also requiring `state == 'active'` in the same rep,
|
||||
unlike _is_active above: #345 reports a washer whose `state` can
|
||||
already read idle by the time `progress` is observed at 'Finish' --
|
||||
the same-family dryer's firmware apparently keeps `state` at 'active'
|
||||
longer, per the report -- so requiring both together risked the arm
|
||||
condition never actually firing on the one device this fixes.
|
||||
_apply_sticky's edge-triggering (only a fresh False->True transition
|
||||
(re)arms) is what keeps a `progress` stuck at 'Finish' indefinitely
|
||||
(the same class of quirk `_completion_minutes` below already works
|
||||
around) from holding this open forever instead."""
|
||||
return rep.get("x.com.samsung.da.progress") == "Finish"
|
||||
|
||||
|
||||
def _new_cycle_running(rep):
|
||||
"""progress/progress_percentage's sticky_bypass_fn: drop the #345 hold
|
||||
early once a new cycle is genuinely running.
|
||||
|
||||
Gated on `state == 'active'`, unlike _just_finished's arm condition
|
||||
above: issue #358's dryer resets `progress` to its course's first
|
||||
stage ('Drying') in the same moment `state` goes idle, ~4s before
|
||||
settling to 'None' -- confirmed by the reporter's machine_state
|
||||
history, which flips to idle on the exact second progress reads
|
||||
'Drying', in both captured cycles. A bypass keyed on the progress
|
||||
code alone read that as a new cycle and republished it. Releasing
|
||||
late costs nothing -- an unreleased hold still expires on its own --
|
||||
so this side takes the stronger signal."""
|
||||
v = rep.get("x.com.samsung.da.progress")
|
||||
return _state_is_active(rep) and v is not None and v not in ("None", "Finish")
|
||||
|
||||
|
||||
def _remaining_seconds(raw):
|
||||
@@ -75,7 +112,7 @@ def _delay_hours(v):
|
||||
def _format_delay(hours):
|
||||
total_minutes = round(max(float(hours), 0) * 60)
|
||||
h, m = divmod(total_minutes, 60)
|
||||
return f"{h}:{m:02d}:00"
|
||||
return f"{h:02d}:{m:02d}:00"
|
||||
|
||||
|
||||
def _delay_field(rep):
|
||||
@@ -153,19 +190,30 @@ OPERATIONAL_STATE = Capability(
|
||||
BinarySensorDesc(
|
||||
key="cycle_active",
|
||||
device_class="running",
|
||||
rep_fn=lambda rep: (
|
||||
_SAMSUNG_STATE_TO_OCF.get(rep.get("x.com.samsung.da.state")) == "active"
|
||||
and rep.get("x.com.samsung.da.progress") != "Finish"
|
||||
),
|
||||
rep_fn=_is_active,
|
||||
),
|
||||
# sticky_* (issue #345): once progress reads 'Finish', keep
|
||||
# showing Finish/100 for a grace window even after machine_state
|
||||
# reverts, rather than falling to Idle/0 the instant it does --
|
||||
# see sensor.py's _apply_sticky. rep_fn below is unchanged and
|
||||
# stays the only definition of a live value -- the hold decides
|
||||
# only *whether* to freeze. A second, ungated one here is what
|
||||
# let issue #358's post-Finish tail reach the entity.
|
||||
SensorDesc(
|
||||
key="progress",
|
||||
icon="mdi:progress-wrench",
|
||||
device_class="enum",
|
||||
options=tuple(sorted(translated_states("sensor", "progress"))),
|
||||
rep_fn=lambda rep: (
|
||||
"Idle"
|
||||
if _SAMSUNG_STATE_TO_OCF.get(rep.get("x.com.samsung.da.state")) != "active"
|
||||
"idle"
|
||||
if not _state_is_active(rep)
|
||||
else _progress(rep.get("x.com.samsung.da.progress"))
|
||||
),
|
||||
sticky_fn=_just_finished,
|
||||
# The catalog key, not the device's 'Finish': rep_fn is normalized
|
||||
# now, and a held value outside `options` is what HA rejects.
|
||||
sticky_value_fn=lambda rep: "finish",
|
||||
sticky_bypass_fn=_new_cycle_running,
|
||||
),
|
||||
SensorDesc(
|
||||
key="progress_percentage",
|
||||
@@ -173,9 +221,12 @@ OPERATIONAL_STATE = Capability(
|
||||
state_class="measurement",
|
||||
rep_fn=lambda rep: (
|
||||
0
|
||||
if _SAMSUNG_STATE_TO_OCF.get(rep.get("x.com.samsung.da.state")) != "active"
|
||||
if not _state_is_active(rep)
|
||||
else _int(rep.get("x.com.samsung.da.progressPercentage"))
|
||||
),
|
||||
sticky_fn=_just_finished,
|
||||
sticky_value_fn=lambda rep: 100,
|
||||
sticky_bypass_fn=_new_cycle_running,
|
||||
),
|
||||
# Only show finish time while actively running -- firmware leaves a
|
||||
# stale remainingTime after a cycle ends, frozen at '00:01:00'.
|
||||
|
||||
@@ -148,11 +148,13 @@ COOKTOP_STATUS = Capability(
|
||||
value_fn=lambda v: str(v).lower() == "on",
|
||||
),
|
||||
# Safe to write -- a lock toggle, not a heat control -- via a
|
||||
# direct single-field PUT, no RMW needed.
|
||||
# direct single-field PUT, no RMW needed. No device_class:
|
||||
# SwitchDeviceClass only has 'outlet'/'switch', not 'lock' --
|
||||
# passing it crashed switch platform setup for the whole device
|
||||
# (issue #349, same bug as water_purifier.py's lock switches).
|
||||
SwitchDesc(
|
||||
key="cooktop_child_lock",
|
||||
field="childLock",
|
||||
device_class="lock",
|
||||
entity_category="config",
|
||||
icon="mdi:lock",
|
||||
value_fn=lambda v: str(v).lower() == "on",
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
"""Capabilities for the Samsung stick-vacuum clean/auto-empty station
|
||||
(model A-VSKR-TP1-22-VS9500AL, "Bespoke Jet" clean station, issue #131).
|
||||
(models A-VSKR-TP1-22-VS9500AL / A-VSWW-TP1-23-VS9700, issues #131 / #219).
|
||||
|
||||
The reporter's diagnostics dump shows no vacuum-body state at all (no
|
||||
suction level, no battery, no cleaning-mode/room-mapping control, no
|
||||
docked/undocked status even) -- only the clean station's own dustbag,
|
||||
dustbin auto-empty settings, and UV-C sanitizing-cycle status. This
|
||||
strongly suggests the WiFi/DTLS module lives in the station, not the
|
||||
handheld stick: the station is the only "device" this integration's local
|
||||
API can see, and the wand's own controls are unrelated hardware not
|
||||
reachable this way. Modeled as its own device type -- these hrefs don't
|
||||
overlap with any existing family, so there's no shared-href ambiguity to
|
||||
resolve against another type (see registry/by_type/__init__.py's
|
||||
docstring for that rule).
|
||||
The WiFi/DTLS module lives in the clean station. Older VS9500 dumps
|
||||
(#131) exposed only dustbag/dustbin/UV-C station state. VS9700 dumps
|
||||
(#219) additionally expose `/status/stick/vs/0` with the wand's battery
|
||||
%, cleaning/charging status, and BLE link -- still no suction/room-map
|
||||
control. Modeled as its own device type -- these hrefs don't overlap with
|
||||
any existing family (see registry/by_type/__init__.py's docstring).
|
||||
|
||||
Resources verified against the issue #131 diagnostics dump.
|
||||
Resources verified against issue #131 and #219 diagnostics dumps.
|
||||
"""
|
||||
|
||||
from ..capability import Capability
|
||||
@@ -156,3 +151,43 @@ CLEANSTATION_STATUS = Capability(
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
# Wand body state reported through the station (VS9700 / issue #219). Absent
|
||||
# on the older VS9500 dump (#131) -- discovery drops entities when the href
|
||||
# is missing.
|
||||
STICK_BODY = Capability(
|
||||
href="/status/stick/vs/0",
|
||||
poll_tier="warm",
|
||||
entities=(
|
||||
SensorDesc(
|
||||
key="battery",
|
||||
field="x.com.samsung.da.stickbattery",
|
||||
device_class="battery",
|
||||
state_class="measurement",
|
||||
unit="%",
|
||||
value_fn=int_or_none,
|
||||
),
|
||||
BinarySensorDesc(
|
||||
key="battery_charging",
|
||||
field="x.com.samsung.da.stickcleaningstatus",
|
||||
device_class="battery_charging",
|
||||
value_fn=lambda v: v == "Charging",
|
||||
),
|
||||
SensorDesc(
|
||||
key="stick_cleaning_status",
|
||||
field="x.com.samsung.da.stickcleaningstatus",
|
||||
icon="mdi:vacuum",
|
||||
),
|
||||
SensorDesc(
|
||||
key="stick_operation_mode",
|
||||
field="x.com.samsung.da.stickoperationmode",
|
||||
icon="mdi:broom",
|
||||
),
|
||||
BinarySensorDesc(
|
||||
key="stick_ble_connected",
|
||||
field="x.com.samsung.da.stickbleconnection",
|
||||
device_class="connectivity",
|
||||
value_fn=lambda v: v == "On",
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -27,6 +27,7 @@ from .laundry import (
|
||||
hex_pairs,
|
||||
option_value,
|
||||
option_write,
|
||||
washer_cycle_fallback,
|
||||
)
|
||||
|
||||
# Course_XX hex code labels (translations/en.json,
|
||||
@@ -38,9 +39,12 @@ from .laundry import (
|
||||
# editCourseList and screenshots (issue #22, a combo's own course set, not
|
||||
# implying anything about a plain washer's '1F'); 3 more (Eco Cold, Towels,
|
||||
# Self Clean+) verified directly on a WF50A8600AV/US by reading back the raw
|
||||
# code after selecting each cycle on the appliance (issue #80). Two code
|
||||
# pairs ('21'/'65' Colors, '27'/'5E' Rinse+Spin, and '24'/'54' Towels)
|
||||
# legitimately share a label across different course tables -- not typos.
|
||||
# code after selecting each cycle on the appliance (issue #80). 2 more
|
||||
# ('0A' Towels, 'B0' Mixed Load) reported for a WW90DG5G34ABLE on the same
|
||||
# Table_02 family (issue #363). Several codes legitimately share a label
|
||||
# across different course tables -- '21'/'65' Colors, '27'/'5E'/'78'
|
||||
# Rinse+Spin, '0A'/'33'/'54'/'70' Towels -- not typos. (This list said
|
||||
# "'24' Towels" until issue #343 found 24/33 transposed; 24 is Bedding.)
|
||||
#
|
||||
# No static fallback list is kept here: other models have different actual
|
||||
# course sets, so hardcoding one device's list would show/hide the wrong
|
||||
@@ -50,6 +54,23 @@ from .laundry import (
|
||||
# options' MostUsed_* entry was considered as a fallback source (its first
|
||||
# byte matches the selected Course_XX on both dumps), but the remaining
|
||||
# bytes don't decode to any confirmed course code, so it isn't used.
|
||||
#
|
||||
# The owner of a Korean Table_02 washer confirmed the names for its newer
|
||||
# 69/6A-79/88 course-code family, including Course_69 as AI Wash. Those names
|
||||
# live only in the table-scoped translation catalog; a code not confirmed by
|
||||
# the owner or device metadata falls back to washer_cycle_fallback, which
|
||||
# surfaces a personal-course name only -- no invented English label for an
|
||||
# unrecognized standard code (PR #251 review).
|
||||
#
|
||||
# washer_cycle_table_00 (issue #357) is a separate, older course-code family
|
||||
# reported by a WF45R6300AW/US -- confirmed by the reporter selecting each
|
||||
# cycle on the appliance and reading back the raw code, the same method used
|
||||
# for Table_02's WF50A8600AV/US codes above. A device reporting Table_00 with
|
||||
# an unconfirmed code (FlexWash's washer_flexwash_device fixture, for
|
||||
# instance) still renders that code raw rather than borrowing a Table_02
|
||||
# label -- the two tables are unrelated code spaces despite a handful of
|
||||
# overlapping hex values.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# /washer/vs/0 -- wash temperature, spin speed, rinse cycle count.
|
||||
# Despite the shared href, this is unrelated to dryer.DRYER_SETTINGS (also
|
||||
@@ -250,6 +271,7 @@ WASHER_COURSE = Capability(
|
||||
translation_key="washer_cycle",
|
||||
icon="mdi:washing-machine",
|
||||
table_href="/st/washercourse/vs/0",
|
||||
display_fn=washer_cycle_fallback,
|
||||
),
|
||||
SensorDesc(
|
||||
key="drum_clean_cycles_remaining",
|
||||
|
||||
@@ -182,10 +182,15 @@ FAVORITE_HOTWATER = Capability(
|
||||
# adapter.flatten() only ever honors exists_fn, not entity.py's
|
||||
# implicit field-presence default -- without it, whichever
|
||||
# same-keyed descriptor is processed last would silently win.
|
||||
# No device_class: SwitchDeviceClass only has 'outlet'/'switch',
|
||||
# not 'lock' -- passing it crashed switch platform setup entirely
|
||||
# for the whole device (issue #349), same bug KIDS_LOCK_GENERIC
|
||||
# dodged by switching to BinarySensorDesc (issues #181/#183). This
|
||||
# entity stays a SwitchDesc since it's genuinely writable.
|
||||
SwitchDesc(
|
||||
key="hotwater_lock",
|
||||
field="x.com.samsung.da.switchHotwater",
|
||||
device_class="lock",
|
||||
icon="mdi:lock",
|
||||
entity_category="config",
|
||||
value_fn=lambda v: v != "Unlocked",
|
||||
exists_fn=lambda rep, resources: (
|
||||
@@ -354,11 +359,13 @@ LOCK = Capability(
|
||||
entities=(
|
||||
# Shares its key with FAVORITE_HOTWATER's switchHotwater fallback
|
||||
# above (issue #144); see the comment there. A stub rep ({}) still
|
||||
# counts as "present" here, matching entity.py's own default.
|
||||
# counts as "present" here, matching entity.py's own default. No
|
||||
# device_class on any of the three locks below -- see the
|
||||
# device_class note on FAVORITE_HOTWATER's hotwater_lock (issue #349).
|
||||
SwitchDesc(
|
||||
key="hotwater_lock",
|
||||
field="x.com.samsung.da.hotwaterLock",
|
||||
device_class="lock",
|
||||
icon="mdi:lock",
|
||||
entity_category="config",
|
||||
value_fn=lambda v: v != "Unlocked",
|
||||
exists_fn=lambda rep, resources: not rep or "x.com.samsung.da.hotwaterLock" in rep,
|
||||
@@ -370,7 +377,7 @@ LOCK = Capability(
|
||||
SwitchDesc(
|
||||
key="coldwater_lock",
|
||||
field="x.com.samsung.da.coldwaterLock",
|
||||
device_class="lock",
|
||||
icon="mdi:lock",
|
||||
entity_category="config",
|
||||
value_fn=lambda v: v != "Unlocked",
|
||||
write_fn=lambda p, rep, href=None: (
|
||||
@@ -381,7 +388,7 @@ LOCK = Capability(
|
||||
SwitchDesc(
|
||||
key="buzz_lock",
|
||||
field="x.com.samsung.da.buzzLock",
|
||||
device_class="lock",
|
||||
icon="mdi:lock",
|
||||
entity_category="config",
|
||||
value_fn=lambda v: v != "Unlocked",
|
||||
write_fn=lambda p, rep, href=None: (
|
||||
|
||||
@@ -19,6 +19,7 @@ WriteFn = Callable[[Any, dict], "tuple[list[str], dict] | None"] | None
|
||||
# cross-resource lookups exists_fn needs (e.g. reading a sibling href's live
|
||||
# option list).
|
||||
ValidateFn = Callable[[Any, dict, dict], "str | None"] | None
|
||||
DisplayFn = Callable[[Any, dict], Any] | None
|
||||
|
||||
|
||||
def _identity(v: Any) -> Any:
|
||||
@@ -63,6 +64,18 @@ class SensorDesc(SamsungEntityDescription):
|
||||
# (see sensor.py). Only for values expected to jitter between
|
||||
# device-side revisions -- not a general-purpose flag.
|
||||
hysteresis: bool = False
|
||||
# Opt-in, entity-instance-only hold -- see sensor.py's _apply_sticky
|
||||
# for the full contract (arm/value/bypass semantics, one window per
|
||||
# bypass, why this never touches the coordinator cache).
|
||||
# sticky_fn arms it; sticky_value_fn picks what to freeze at that
|
||||
# moment (defaults to rep_fn's own result); sticky_bypass_fn drops the
|
||||
# hold and lets rep_fn's own live result through; sticky_seconds
|
||||
# bounds how long it can hold. There is deliberately no hook for
|
||||
# computing a live value differently from rep_fn -- see issue #358.
|
||||
sticky_fn: Callable[[dict], bool] | None = None
|
||||
sticky_value_fn: Callable[[dict], Any] | None = None
|
||||
sticky_bypass_fn: Callable[[dict], bool] | None = None
|
||||
sticky_seconds: float = 300.0
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
@@ -77,6 +90,10 @@ class SelectDesc(SamsungEntityDescription):
|
||||
# snapshot (not just this entity's own href) and returns raw device
|
||||
# option values; see select.py's LocalThingsSelect._raw_options().
|
||||
options_field: str | None = None # resource field that contains the live options list
|
||||
# Optional device-specific fallback for values absent from the translation
|
||||
# catalog. Receives (raw_value, canonical_resources); select.py applies it
|
||||
# identically to the current state and every option.
|
||||
display_fn: DisplayFn = None
|
||||
write_fn: WriteFn = None
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ appliance's own bookkeeping, not evidence of a second indoor unit -- see
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import time
|
||||
from collections.abc import Callable, Sequence
|
||||
from dataclasses import dataclass
|
||||
|
||||
@@ -221,12 +222,12 @@ def _seed_href(path_segs: tuple[str, ...]) -> str:
|
||||
return "/" + "/".join(path_segs)
|
||||
|
||||
|
||||
def _get_raw(sess, path_segs: tuple[str, ...]):
|
||||
def _get_raw(sess, path_segs: tuple[str, ...], timeout: float = 10.0):
|
||||
"""GET `path_segs` and CBOR-decode the payload, or None on any
|
||||
missing/malformed response (a 4.04, a timeout, an empty payload) --
|
||||
shared tolerated-absence posture for both callers below."""
|
||||
try:
|
||||
code, pl = sess.get(list(path_segs), timeout=10.0)
|
||||
code, pl = sess.get(list(path_segs), timeout=timeout)
|
||||
if code == 0x45 and pl:
|
||||
return cbor2.loads(pl)
|
||||
except Exception:
|
||||
@@ -234,19 +235,29 @@ def _get_raw(sess, path_segs: tuple[str, ...]):
|
||||
return None
|
||||
|
||||
|
||||
def _get_batch(sess, path_segs: tuple[str, ...]) -> dict[str, dict]:
|
||||
def _get_batch(
|
||||
sess,
|
||||
path_segs: tuple[str, ...],
|
||||
timeout: float = 10.0,
|
||||
) -> dict[str, dict]:
|
||||
"""GET a Samsung Collection resource and parse it the same way
|
||||
/device/0 itself is parsed (parse_device0_batch): a [devcol-rep,
|
||||
{href, rep}, ...] CBOR list, not a bare Property map."""
|
||||
body = _get_raw(sess, path_segs)
|
||||
body = _get_raw(sess, path_segs, timeout)
|
||||
return parse_device0_batch(body) if isinstance(body, list) else {}
|
||||
|
||||
|
||||
def _get_property(sess, path_segs: tuple[str, ...]) -> dict:
|
||||
def _get_property(
|
||||
sess,
|
||||
path_segs: tuple[str, ...],
|
||||
timeout: float = 10.0,
|
||||
) -> dict:
|
||||
"""GET a plain OCF Property-map resource (a bare dict, not a Collection
|
||||
batch). Used for `/multidevice/vs/0`: listed in `/oic/res` but absent
|
||||
from `/device/0`'s batch, so it needs its own RETRIEVE."""
|
||||
body = _get_raw(sess, path_segs)
|
||||
batch). Used for `/multidevice/vs/0` (issue #177 follow-up): listed in
|
||||
`/oic/res` on the Pattern A reporter's board but absent from
|
||||
`/device/0`'s batch, so it needs its own RETRIEVE, and it answers a
|
||||
single Property map, not a [devcol-rep, ...] list."""
|
||||
body = _get_raw(sess, path_segs, timeout)
|
||||
return body if isinstance(body, dict) else {}
|
||||
|
||||
|
||||
@@ -255,6 +266,11 @@ def enumerate_subdevices(
|
||||
resources: dict[str, dict],
|
||||
oic_res_links,
|
||||
probe_log: Callable[[str, bool], None] | None = None,
|
||||
*,
|
||||
preferred_hrefs: Sequence[str] = (),
|
||||
time_budget: float | None = None,
|
||||
collection_timeout: float = 10.0,
|
||||
property_timeout: float = 10.0,
|
||||
) -> tuple[list[Subdevice], dict[str, dict]]:
|
||||
"""Discover every sibling indoor subdevice reachable over `sess`'s
|
||||
connection.
|
||||
@@ -269,6 +285,13 @@ def enumerate_subdevices(
|
||||
or not it answered, so diagnostics can tell "checked, nothing there"
|
||||
apart from "never checked".
|
||||
|
||||
`preferred_hrefs` only changes the order of the flat Property fallback;
|
||||
it never filters the device's resource surface. When `time_budget` is
|
||||
supplied, probes are bounded by one shared monotonic deadline and this
|
||||
returns every candidate/resource confirmed before it. This makes first
|
||||
setup finite even when firmware silently drops unknown paths instead of
|
||||
returning 4.04.
|
||||
|
||||
Every candidate whose seed answers with a non-empty batch is returned
|
||||
here -- this function can't tell a real sibling from an unused
|
||||
SmartThings slot that answers the same shape; that requires
|
||||
@@ -282,6 +305,30 @@ def enumerate_subdevices(
|
||||
# casing, and probing it twice would materialize the same physical
|
||||
# subdevice as two Subdevice candidates.
|
||||
probed_ids: set[str] = set()
|
||||
deadline = time.monotonic() + max(0.0, time_budget) if time_budget is not None else None
|
||||
budget_exhausted = False
|
||||
|
||||
def _next_timeout(maximum: float) -> float | None:
|
||||
"""Clamp one probe to the remaining enumeration wall-clock budget."""
|
||||
nonlocal budget_exhausted
|
||||
if deadline is None:
|
||||
return maximum
|
||||
remaining = deadline - time.monotonic()
|
||||
if remaining <= 0:
|
||||
budget_exhausted = True
|
||||
return None
|
||||
return min(maximum, remaining)
|
||||
|
||||
def _flat_probe_hrefs():
|
||||
"""Preferred live-state hrefs first, then every remaining master href."""
|
||||
seen = set()
|
||||
for href in preferred_hrefs:
|
||||
if href in resources and href not in seen:
|
||||
seen.add(href)
|
||||
yield href
|
||||
for href in sorted(resources):
|
||||
if href not in seen:
|
||||
yield href
|
||||
|
||||
def _probed(seed_href: str, batch: dict) -> None:
|
||||
if probe_log is not None:
|
||||
@@ -296,7 +343,10 @@ def enumerate_subdevices(
|
||||
return
|
||||
probed_ids.add(sub_id.lower())
|
||||
seed = (sub_id, "device", "0")
|
||||
batch = _get_batch(sess, seed)
|
||||
timeout = _next_timeout(collection_timeout)
|
||||
if timeout is None:
|
||||
return
|
||||
batch = _get_batch(sess, seed, timeout)
|
||||
_probed(_seed_href(seed), batch)
|
||||
if batch:
|
||||
subdevice = Subdevice(kind="prefixed", key=sub_id, seed_path=seed)
|
||||
@@ -307,10 +357,12 @@ def enumerate_subdevices(
|
||||
# doesn't always expose its own `/<uuid>/device/0` Collection. With
|
||||
# no Collection to seed from and no per-UUID entry in /oic/res to
|
||||
# enumerate hrefs from, the only signal left is that a composite
|
||||
# device's siblings share the master's own resource surface -- so
|
||||
# probe every href the master answered this cycle, individually,
|
||||
# under this UUID's prefix, and keep whichever answer. Each is a
|
||||
# plain tolerated-404 RETRIEVE.
|
||||
# device's siblings are the same physical board family as the
|
||||
# subdevice this config entry already talks to -- so probe every
|
||||
# href the master itself answered this cycle, individually, under
|
||||
# this UUID's prefix, and keep whichever ones answer before the
|
||||
# optional enumeration deadline. Each is a plain tolerated-404
|
||||
# RETRIEVE, same posture as every other probe in this function.
|
||||
#
|
||||
# Known gap: a firmware that echoes the master's own state back
|
||||
# under an unrecognized prefix, rather than 4.04ing, would pass
|
||||
@@ -321,12 +373,15 @@ def enumerate_subdevices(
|
||||
# reps against the master's own values for the same hrefs.
|
||||
flat_hrefs = []
|
||||
first = True
|
||||
for href in sorted(resources):
|
||||
for href in _flat_probe_hrefs():
|
||||
if not first:
|
||||
sess.pace()
|
||||
first = False
|
||||
timeout = _next_timeout(property_timeout)
|
||||
if timeout is None:
|
||||
break
|
||||
actual = f"/{sub_id}{href}"
|
||||
rep = _get_property(sess, tuple(actual.strip("/").split("/")))
|
||||
rep = _get_property(sess, tuple(actual.strip("/").split("/")), timeout)
|
||||
_probed(actual, rep)
|
||||
if rep:
|
||||
flat_hrefs.append(href)
|
||||
@@ -353,14 +408,20 @@ def enumerate_subdevices(
|
||||
listed = sorted(i for i in ids if isinstance(i, str) and i)
|
||||
for sub_id in listed:
|
||||
_probe_prefixed(sub_id)
|
||||
if budget_exhausted:
|
||||
break
|
||||
|
||||
# --- Pattern C: UUID prefix advertised only via /oic/res ----------------
|
||||
# (AWM-WW-AID-26-ONEBODY washer+dryer combo, issue #241.) No
|
||||
# /subdevices/vs/0 and /device/<n> 404s; the only trace of the sibling
|
||||
# is a UUID-prefixed link in /oic/res (the x.com.samsung.da.multidevice
|
||||
# link). Its own tree answers a full Collection at /<uuid>/device/0,
|
||||
# exactly Pattern B's transform, so every UUID path prefix seen in
|
||||
# /oic/res is treated as a candidate. _probe_prefixed's probed_ids
|
||||
# exactly Pattern B's transform, so a UUID prefix attached to that
|
||||
# resource type is treated as a candidate. Other UUID-prefixed links are
|
||||
# not evidence of a sibling: some single-unit AC boards advertise only
|
||||
# per-prefix file-transfer resources, and probing those prefixes against
|
||||
# every master href needlessly burns the setup timeout budget.
|
||||
# _probe_prefixed's probed_ids
|
||||
# guard (not a set difference against `listed`) is what keeps an id
|
||||
# already named by subdeviceIdList from being probed twice, since the
|
||||
# two sources can disagree on case.
|
||||
@@ -369,11 +430,13 @@ def enumerate_subdevices(
|
||||
m.group(1)
|
||||
for link in _iter_oic_res_hrefs(oic_res_links)
|
||||
for m in [_UUID_PREFIX_RE.match(link.get("href", ""))]
|
||||
if m
|
||||
if m and "x.com.samsung.da.multidevice" in (link.get("rt") or ())
|
||||
}
|
||||
)
|
||||
for sub_id in linked:
|
||||
_probe_prefixed(sub_id)
|
||||
if budget_exhausted:
|
||||
break
|
||||
|
||||
# --- Pattern A: indexed siblings (ARTIK051_DONGLE_FAC_18K) --------------
|
||||
indices = sorted(
|
||||
@@ -390,8 +453,11 @@ def enumerate_subdevices(
|
||||
# this replaces from identity.py.
|
||||
indices = list(_SPECULATIVE_DEVICE_INDICES)
|
||||
for n in indices:
|
||||
timeout = _next_timeout(collection_timeout)
|
||||
if timeout is None:
|
||||
break
|
||||
seed = ("device", str(n))
|
||||
batch = _get_batch(sess, seed)
|
||||
batch = _get_batch(sess, seed, timeout)
|
||||
_probed(_seed_href(seed), batch)
|
||||
if not batch:
|
||||
continue
|
||||
@@ -399,18 +465,26 @@ def enumerate_subdevices(
|
||||
fetched.update(batch) # already real /x/<n> hrefs, no normalization needed
|
||||
subdevices.append(subdevice)
|
||||
|
||||
# /multidevice/vs/0: listed in /oic/res on some boards but never in
|
||||
# /device/0's batch, so it needs its own RETRIEVE. A plain corroborating
|
||||
# count (numofsubdevice), confirmed read-only -- captured for
|
||||
# diagnostics only, folded into the merged resources dict like any
|
||||
# other href (see airconditioner._AC_IGNORED). Not a gate:
|
||||
# discover_partitioned's entity-level liveness check decides
|
||||
# materialization without it.
|
||||
# /multidevice/vs/0 (issue #177 follow-up): the Pattern A reporter's
|
||||
# board lists it in /oic/res but it never appears in /device/0's batch,
|
||||
# so it needs its own RETRIEVE. It's a plain corroborating count
|
||||
# (x.com.samsung.da.numofsubdevice), confirmed read-only (a write
|
||||
# attempt returned CoAP 4.00) -- captured for diagnostics only, folded
|
||||
# into the merged resources dict like any other href (see
|
||||
# airconditioner._AC_IGNORED, which is what keeps it from surfacing as
|
||||
# an unbound-href gap). NOT a gate: discover_partitioned's entity-level
|
||||
# liveness check decides materialization correctly without it, and only
|
||||
# this one board family is known to expose it at all. Whether it agrees
|
||||
# with the number of subdevices actually materialized is the
|
||||
# coordinator's call to log (it owns the logger; this module doesn't),
|
||||
# not this function's.
|
||||
multidevice_seed = ("multidevice", "vs", "0")
|
||||
multidevice = _get_property(sess, multidevice_seed)
|
||||
_probed(_seed_href(multidevice_seed), multidevice)
|
||||
if multidevice:
|
||||
fetched["/multidevice/vs/0"] = multidevice
|
||||
timeout = _next_timeout(property_timeout)
|
||||
if timeout is not None:
|
||||
multidevice = _get_property(sess, multidevice_seed, timeout)
|
||||
_probed(_seed_href(multidevice_seed), multidevice)
|
||||
if multidevice:
|
||||
fetched["/multidevice/vs/0"] = multidevice
|
||||
|
||||
return subdevices, fetched
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ def _translation_state(value: str, known: frozenset[str]) -> str | None:
|
||||
return snake if snake in known else None
|
||||
|
||||
|
||||
def _display(value, translation_key: str | None):
|
||||
def _display(value, translation_key: str | None, fallback_fn=None):
|
||||
"""Turn a raw device option/state value into what's shown in the UI.
|
||||
|
||||
`translation_key` is the entity's already-resolved key (it can itself
|
||||
@@ -67,14 +67,21 @@ def _display(value, translation_key: str | None):
|
||||
"""
|
||||
if not isinstance(value, str):
|
||||
return value
|
||||
if translation_key:
|
||||
known = translated_states("select", translation_key)
|
||||
if not known:
|
||||
# No state table for this key: either untranslated, or its
|
||||
# options deliberately aren't (an unrecognized course table).
|
||||
return value
|
||||
if translated := _translation_state(value, known):
|
||||
return translated
|
||||
known = translated_states("select", translation_key) if translation_key else frozenset()
|
||||
if translated := _translation_state(value, known):
|
||||
return translated
|
||||
if fallback_fn is not None and (fallback := fallback_fn(value)) is not None:
|
||||
return fallback
|
||||
if translation_key and not known:
|
||||
# No state table for this key: either the entity isn't translated at
|
||||
# all, or its name is translated but its options deliberately aren't
|
||||
# (an unrecognized course table, say). Nothing named this value, so
|
||||
# the raw device value is the best choice -- the cosmetic reshaping
|
||||
# below would only mangle an opaque code, turning a course '0E' into
|
||||
# '0 E'. Reached only when the fallback *declined* the value, not
|
||||
# merely when none was supplied: cycle_select always supplies one now
|
||||
# (it labels cloud programs) and returns None for everything else.
|
||||
return value
|
||||
if value.islower():
|
||||
return value.replace("_", " ").title()
|
||||
return _CAMEL_BOUNDARY_RE.sub(" ", value)
|
||||
@@ -85,7 +92,15 @@ class LocalThingsSelect(LocalThingsEntity, SelectEntity):
|
||||
super().__init__(coordinator, bound)
|
||||
desc = cast(SelectDesc, bound.desc)
|
||||
if not desc.options_field and not callable(desc.options):
|
||||
self._attr_options = [_display(o, self.translation_key) for o in desc.options]
|
||||
self._attr_options = [self._display_option(o) for o in desc.options]
|
||||
|
||||
def _display_option(self, value):
|
||||
"""Normalize both current state and options through one path."""
|
||||
display_fn = cast(SelectDesc, self._bound.desc).display_fn
|
||||
fallback_fn = (
|
||||
(lambda raw: display_fn(raw, self._resources)) if display_fn is not None else None
|
||||
)
|
||||
return _display(value, self.translation_key, fallback_fn)
|
||||
|
||||
def _raw_options(self) -> list[str]:
|
||||
desc = cast(SelectDesc, self._bound.desc)
|
||||
@@ -106,17 +121,17 @@ class LocalThingsSelect(LocalThingsEntity, SelectEntity):
|
||||
def options(self) -> list[str]:
|
||||
desc = cast(SelectDesc, self._bound.desc)
|
||||
if desc.options_field or callable(desc.options):
|
||||
return [_display(o, self.translation_key) for o in self._raw_options()]
|
||||
return [self._display_option(o) for o in self._raw_options()]
|
||||
return self._attr_options
|
||||
|
||||
@property
|
||||
def current_option(self):
|
||||
raw = (self.coordinator.data or {}).get(self._state_key)
|
||||
return _display(raw, self.translation_key)
|
||||
return self._display_option(raw)
|
||||
|
||||
async def async_select_option(self, option: str) -> None:
|
||||
raw = next(
|
||||
(o for o in self._raw_options() if _display(o, self.translation_key) == option),
|
||||
(o for o in self._raw_options() if self._display_option(o) == option),
|
||||
option,
|
||||
)
|
||||
await self.coordinator.async_send_command(self._bound, raw)
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from datetime import timedelta
|
||||
from typing import cast
|
||||
|
||||
@@ -48,9 +49,12 @@ class LocalThingsSensor(LocalThingsEntity, SensorEntity):
|
||||
SensorDeviceClass(desc.device_class) if desc.device_class else None
|
||||
)
|
||||
self._attr_state_class = SensorStateClass(desc.state_class) if desc.state_class else None
|
||||
if desc.options:
|
||||
self._attr_options = list(desc.options)
|
||||
# Always set, so the `options` property below can read it unguarded.
|
||||
self._attr_options = list(desc.options) if desc.options else None
|
||||
self._hysteresis_value = None
|
||||
self._sticky_value = None
|
||||
self._sticky_until: float | None = None
|
||||
self._sticky_spent = False
|
||||
|
||||
@property
|
||||
def native_unit_of_measurement(self):
|
||||
@@ -59,14 +63,86 @@ class LocalThingsSensor(LocalThingsEntity, SensorEntity):
|
||||
return desc.unit_fn(self.coordinator.resource(self._bound.href))
|
||||
return self._attr_native_unit_of_measurement
|
||||
|
||||
@property
|
||||
def options(self):
|
||||
"""Declared options, plus whatever this device is actually reporting.
|
||||
|
||||
HA raises for an enum state outside `options`, which would turn any
|
||||
device value we don't have a translation for into a broken entity --
|
||||
the opposite of this registry's rule that an unrecognized value
|
||||
renders raw. Admitting the live value keeps it displayable; it just
|
||||
shows untranslated (PR #341 review).
|
||||
"""
|
||||
if self._attr_options is None:
|
||||
return None
|
||||
value = self.native_value
|
||||
if not isinstance(value, str) or value in self._attr_options:
|
||||
return self._attr_options
|
||||
return [*self._attr_options, value]
|
||||
|
||||
@property
|
||||
def native_value(self):
|
||||
raw = (self.coordinator.data or {}).get(self._state_key)
|
||||
desc = cast(SensorDesc, self._bound.desc)
|
||||
if desc.sticky_fn is not None:
|
||||
raw = self._apply_sticky(raw, desc)
|
||||
if not desc.hysteresis:
|
||||
return raw
|
||||
return self._apply_hysteresis(raw)
|
||||
|
||||
def _apply_sticky(self, raw, desc: SensorDesc):
|
||||
"""Freeze this entity at a value for up to `desc.sticky_seconds`
|
||||
after `desc.sticky_fn` next stops matching this href's live rep
|
||||
(issue #345 -- see operational.py's `_just_finished` for the
|
||||
motivating case). Entity-instance state only, exactly like
|
||||
`_hysteresis_value` above -- never written back to the coordinator
|
||||
cache, so write_fn, diagnostics, and the observe-mode sweep
|
||||
comparison keep seeing real device data throughout.
|
||||
|
||||
`sticky_fn`/`sticky_bypass_fn` read this href's live rep rather
|
||||
than the already-computed `raw`, so they can key on fields rep_fn
|
||||
has collapsed away -- but they never compute a value. `raw` and
|
||||
the frozen `sticky_value` are the only things returned here, so a
|
||||
held entity and a free-running one agree on what "live" means; a
|
||||
hook that broke that rule caused issue #358.
|
||||
|
||||
At most one window per `sticky_bypass_fn` cycle: arming marks the
|
||||
hold spent, and only the bypass clears that. So a `sticky_fn` that
|
||||
keeps matching (firmware leaving the field stuck -- the quirk
|
||||
`_completion_minutes` works around) can't extend the window, and
|
||||
one flapping in and out can't restart it either, before or after
|
||||
expiry. Expiry alone doesn't re-open the door: without something
|
||||
the calibre of "a new cycle is actually running" in between, a
|
||||
second Finish is the same Finish, and re-arming on it would strobe
|
||||
the entity between held and live once per window -- exactly the
|
||||
repeated announcements #345 and #358 are about.
|
||||
|
||||
`sticky_bypass_fn` drops the hold and returns `raw`, for when "not
|
||||
sticky right now" is ambiguous between "went idle, honor the hold"
|
||||
and "genuinely moved on to new data". It is both the early release
|
||||
and the only re-arm, so it should demand positive evidence of that
|
||||
move; when unsure, letting the window run out is the cheaper
|
||||
mistake.
|
||||
"""
|
||||
assert desc.sticky_fn is not None # native_value only calls this when set
|
||||
rep = self.coordinator.resource(self._bound.href)
|
||||
now = time.monotonic()
|
||||
|
||||
if desc.sticky_fn(rep):
|
||||
if not self._sticky_spent:
|
||||
self._sticky_value = (
|
||||
desc.sticky_value_fn(rep) if desc.sticky_value_fn is not None else raw
|
||||
)
|
||||
self._sticky_until = now + desc.sticky_seconds
|
||||
self._sticky_spent = True
|
||||
elif desc.sticky_bypass_fn is not None and desc.sticky_bypass_fn(rep):
|
||||
self._sticky_until = None
|
||||
self._sticky_spent = False
|
||||
return raw
|
||||
|
||||
holding = self._sticky_until is not None and now < self._sticky_until
|
||||
return self._sticky_value if holding else raw
|
||||
|
||||
def _apply_hysteresis(self, raw):
|
||||
"""Hold the last value this entity actually reported until a new one
|
||||
differs by at least the configured threshold, regardless of how long
|
||||
|
||||
@@ -170,13 +170,16 @@ async def _async_read_resource(hass: HomeAssistant, call: ServiceCall) -> Servic
|
||||
# href: lets a user enumerate what exists without hammering the
|
||||
# device (see this module's docstring and the coordinator's
|
||||
# canonical_resources).
|
||||
snapshot: dict[str, Any] = {"resources": coordinator.canonical_resources(subdevice)}
|
||||
# device_resources, not canonical_resources: this response is what
|
||||
# the appliance reported, without the fields this integration merges
|
||||
# on for its own use (see coordinator.entity_resources).
|
||||
snapshot: dict[str, Any] = {"resources": coordinator.device_resources(subdevice)}
|
||||
return cast(ServiceResponse, snapshot)
|
||||
|
||||
# Same normalize-before-translate order as the write path above.
|
||||
canonical = normalize_href(href)
|
||||
actual_href = subdevice.to_actual(canonical)
|
||||
code, rep = await coordinator.async_raw_read(actual_href)
|
||||
code, rep, body = await coordinator.async_raw_read(actual_href)
|
||||
read_result: dict[str, Any] = {
|
||||
"href": canonical,
|
||||
"actual_href": actual_href,
|
||||
@@ -184,6 +187,13 @@ async def _async_read_resource(hass: HomeAssistant, call: ServiceCall) -> Servic
|
||||
"raw_code": code,
|
||||
"rep": rep,
|
||||
}
|
||||
# `body` only when it isn't the Property map already in `rep` -- a
|
||||
# Collection (`/device/0`, `/sec/devices`) answers a CBOR list, which
|
||||
# `rep` can't carry and which used to vanish into an empty-looking
|
||||
# 2.05 (issue #335). Omitted for the ordinary map case rather than
|
||||
# duplicating every rep in every response.
|
||||
if body is not None and not isinstance(body, dict):
|
||||
read_result["body"] = body
|
||||
return cast(ServiceResponse, read_result)
|
||||
|
||||
|
||||
|
||||
@@ -108,6 +108,9 @@
|
||||
},
|
||||
"softener_low": {
|
||||
"name": "Málo aviváže"
|
||||
},
|
||||
"stick_ble_connected": {
|
||||
"name": "Tyč připojena přes BLE"
|
||||
}
|
||||
},
|
||||
"button": {
|
||||
@@ -225,6 +228,9 @@
|
||||
"air_filter_threshold": {
|
||||
"name": "Práh upozornění na filtr"
|
||||
},
|
||||
"auto_door_timer": {
|
||||
"name": "Časovač automatického otevírání dvířek"
|
||||
},
|
||||
"beverage_zone_mode": {
|
||||
"name": "Režim zóny nápojů",
|
||||
"state": {
|
||||
@@ -255,7 +261,11 @@
|
||||
"name": "Zvuk bzučáku",
|
||||
"state": {
|
||||
"off": "Vypnuto",
|
||||
"on": "Zapnuto"
|
||||
"on": "Zapnuto",
|
||||
"volume_off": "Vypnuto",
|
||||
"volume_low": "Nízká",
|
||||
"volume_med": "Střední",
|
||||
"volume_high": "Vysoká"
|
||||
}
|
||||
},
|
||||
"discharging_time": {
|
||||
@@ -297,7 +307,16 @@
|
||||
"07": "Předoplach",
|
||||
"8d": "Hrnce a pánve",
|
||||
"8e": "Plast",
|
||||
"8f": "Dětské potřeby"
|
||||
"8f": "Dětské potřeby",
|
||||
"82": "Automatický",
|
||||
"8a": "Normální",
|
||||
"a7": "Intenzivní",
|
||||
"a8": "Expresní",
|
||||
"8c": "Extra tichý",
|
||||
"88": "Samočištění",
|
||||
"85": "Jemné",
|
||||
"0c": "Express",
|
||||
"0d": "Samočištění"
|
||||
}
|
||||
},
|
||||
"dispense_type": {
|
||||
@@ -312,6 +331,22 @@
|
||||
"4": "Alarm 4"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_00": {
|
||||
"name": "Cyklus",
|
||||
"state": {
|
||||
"01": "Normální",
|
||||
"9c": "Intenzivní",
|
||||
"a5": "Ložní prádlo",
|
||||
"9e": "Nežehlivé prádlo",
|
||||
"9b": "Parní dezinfekce+",
|
||||
"27": "Osvěžení",
|
||||
"a0": "Provětrání",
|
||||
"a4": "Časové sušení",
|
||||
"a6": "Rychlé sušení",
|
||||
"a3": "Sportovní oblečení",
|
||||
"a2": "Jemné prádlo"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_03": {
|
||||
"name": "Cyklus",
|
||||
"state": {
|
||||
@@ -339,7 +374,9 @@
|
||||
"4c": "Osvěžení vzduchem",
|
||||
"51": "Eko bavlna",
|
||||
"53": "AI sušení+",
|
||||
"4e": "Automatické sušení"
|
||||
"4e": "Automatické sušení",
|
||||
"26": "Provětrání",
|
||||
"2a": "Hygienické sušení+"
|
||||
}
|
||||
},
|
||||
"favorite_capacity": {
|
||||
@@ -461,9 +498,11 @@
|
||||
"kimchi_storage_crunfch": "Křupavé kimči",
|
||||
"kimchi_storage_buy": "Kupované kimči",
|
||||
"storage_fridge_normal": "Chlazení",
|
||||
"storage_fridge": "Chlazení",
|
||||
"storage_fridge_cold": "Chlazení, silné",
|
||||
"storage_fridge_warm": "Chlazení, slabé",
|
||||
"storage_freezer_normal": "Mražení",
|
||||
"storage_freezer": "Mražení",
|
||||
"storage_freezer_cold": "Mražení, silné",
|
||||
"storage_freezer_warm": "Mražení, slabé",
|
||||
"kimchi_ripe_low_temp": "Zrání kimči, nízká teplota",
|
||||
@@ -476,7 +515,8 @@
|
||||
"storage_fresh_cereal": "Obiloviny",
|
||||
"storage_fridge_drink": "Nápoje",
|
||||
"storage_fresh_wine": "Víno",
|
||||
"storage_fresh_potato_banana": "Brambory a banány"
|
||||
"storage_fresh_potato_banana": "Brambory a banány",
|
||||
"newmode_kimchi_0000": "Nový režim"
|
||||
}
|
||||
},
|
||||
"pantry_zone_mode": {
|
||||
@@ -487,6 +527,16 @@
|
||||
"fdr_drinks": "Nápoje"
|
||||
}
|
||||
},
|
||||
"winecellar_pantry_zone_mode": {
|
||||
"name": "Režim spíže",
|
||||
"state": {
|
||||
"processed_meat": "Zpracované maso",
|
||||
"cheese": "Sýr",
|
||||
"nuts": "Ořechy",
|
||||
"fruit": "Ovoce",
|
||||
"wine": "Víno"
|
||||
}
|
||||
},
|
||||
"range_burner_power_level": {
|
||||
"name": "Výkon hořáku {number}",
|
||||
"state": {
|
||||
@@ -577,11 +627,30 @@
|
||||
"extra_hot": "Extra horká"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_00": {
|
||||
"name": "Cyklus",
|
||||
"state": {
|
||||
"01": "Normální",
|
||||
"70": "Intenzivní",
|
||||
"55": "Bílé prádlo",
|
||||
"71": "Ložní prádlo",
|
||||
"72": "Dezinfekce",
|
||||
"77": "Nežehlivé prádlo",
|
||||
"57": "Samočištění+",
|
||||
"73": "Máchání + odstřeďování",
|
||||
"74": "Sportovní oblečení",
|
||||
"75": "Jemné prádlo",
|
||||
"78": "Rychlé praní"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_02": {
|
||||
"name": "Cyklus",
|
||||
"state": {
|
||||
"01": "Normální",
|
||||
"04": "Rychlé praní",
|
||||
"06": "XXL prádlo",
|
||||
"08": "Máchání+odstřeďování",
|
||||
"0a": "Ručníky",
|
||||
"17": "Stažený program",
|
||||
"1b": "Bavlna",
|
||||
"1c": "Eco 40-60",
|
||||
@@ -592,7 +661,7 @@
|
||||
"21": "Barevné prádlo",
|
||||
"22": "Vlna",
|
||||
"23": "Outdoor",
|
||||
"24": "Ručníky",
|
||||
"24": "Ložní prádlo",
|
||||
"25": "Syntetika",
|
||||
"26": "Jemné prádlo",
|
||||
"27": "Máchání+odstřeďování",
|
||||
@@ -605,7 +674,7 @@
|
||||
"2f": "Sportovní oblečení",
|
||||
"30": "Zataženo",
|
||||
"32": "Košile",
|
||||
"33": "Ložní prádlo",
|
||||
"33": "Ručníky",
|
||||
"34": "Smíšené",
|
||||
"36": "Praní+sušení",
|
||||
"37": "Sušení vzduchem",
|
||||
@@ -621,14 +690,35 @@
|
||||
"60": "Samočištění+",
|
||||
"65": "Barevné prádlo",
|
||||
"66": "Džíny",
|
||||
"69": "AI praní",
|
||||
"6a": "Vlna",
|
||||
"6b": "Džíny",
|
||||
"6c": "Halenky",
|
||||
"6d": "Jemné prádlo",
|
||||
"6e": "Sportovní oblečení",
|
||||
"6f": "Ložní prádlo",
|
||||
"70": "Ručníky",
|
||||
"71": "Rychlé praní",
|
||||
"72": "Košile",
|
||||
"73": "Dezinfekce",
|
||||
"74": "Čištění bubnu",
|
||||
"75": "Outdoor",
|
||||
"76": "Dětské potřeby",
|
||||
"77": "Bavlna",
|
||||
"78": "Máchání + odstřeďování",
|
||||
"79": "Pouze odstřeďování",
|
||||
"7c": "Bílé prádlo",
|
||||
"7d": "Ložní prádlo/nepromokavé",
|
||||
"7e": "Samočištění",
|
||||
"7f": "Vlna/jemné",
|
||||
"86": "Hloubkové praní",
|
||||
"87": "Stažený program",
|
||||
"88": "Péče o domácí mazlíčky",
|
||||
"8f": "Intenzivní studená",
|
||||
"96": "Méně mikrovláken"
|
||||
"96": "Méně mikrovláken",
|
||||
"a0": "15min rychlé praní",
|
||||
"b0": "Smíšená náplň",
|
||||
"35": "Eko bavlna"
|
||||
}
|
||||
},
|
||||
"washer_dry_level": {
|
||||
@@ -715,6 +805,9 @@
|
||||
"air_filter_usage_hours": {
|
||||
"name": "Hodiny využití filtru"
|
||||
},
|
||||
"deodor_filter_usage": {
|
||||
"name": "Využití filtru"
|
||||
},
|
||||
"air_quality_standard": {
|
||||
"name": "Norma kvality vzduchu"
|
||||
},
|
||||
@@ -788,6 +881,12 @@
|
||||
"stick_status": {
|
||||
"name": "Stav tyče"
|
||||
},
|
||||
"stick_operation_mode": {
|
||||
"name": "Provozní režim tyče"
|
||||
},
|
||||
"stick_cleaning_status": {
|
||||
"name": "Stav čištění tyče"
|
||||
},
|
||||
"uvc_operation_time": {
|
||||
"name": "Doba provozu UV-C"
|
||||
},
|
||||
@@ -835,10 +934,16 @@
|
||||
"name": "Teplota"
|
||||
},
|
||||
"diagnosis": {
|
||||
"name": "Diagnostika"
|
||||
"name": "Diagnostika",
|
||||
"state": {
|
||||
"ready": "Připraveno"
|
||||
}
|
||||
},
|
||||
"diagnosis_status": {
|
||||
"name": "Stav diagnostiky"
|
||||
"name": "Stav diagnostiky",
|
||||
"state": {
|
||||
"ready": "Připraveno"
|
||||
}
|
||||
},
|
||||
"drum_clean_cycles_remaining": {
|
||||
"name": "Čištění bubnu za"
|
||||
@@ -853,7 +958,10 @@
|
||||
"name": "Doba sušení"
|
||||
},
|
||||
"dryer_type": {
|
||||
"name": "Typ sušičky"
|
||||
"name": "Typ sušičky",
|
||||
"state": {
|
||||
"electricity": "Elektřina"
|
||||
}
|
||||
},
|
||||
"dust": {
|
||||
"name": "Prach"
|
||||
@@ -982,7 +1090,22 @@
|
||||
"name": "Teplota sondy"
|
||||
},
|
||||
"progress": {
|
||||
"name": "Průběh"
|
||||
"name": "Průběh",
|
||||
"state": {
|
||||
"idle": "Nečinný",
|
||||
"weightsensing": "Detekce náplně",
|
||||
"wash": "Praní",
|
||||
"rinse": "Máchání",
|
||||
"spin": "Odstřeďování",
|
||||
"finish": "Dokončeno",
|
||||
"steaming": "Napařování",
|
||||
"airwashing": "Osvěžení vzduchem",
|
||||
"drying": "Sušení",
|
||||
"dryingwithdooropen": "Větrání",
|
||||
"cooling": "Chlazení",
|
||||
"predrain": "Vypouštění",
|
||||
"prewash": "Předpírka"
|
||||
}
|
||||
},
|
||||
"progress_percentage": {
|
||||
"name": "Průběh v procentech"
|
||||
@@ -1117,6 +1240,12 @@
|
||||
"auto_door_opener": {
|
||||
"name": "Automatické otevírání dvířek"
|
||||
},
|
||||
"auto_door_sound_control": {
|
||||
"name": "Zvuk automatického otevírání dvířek"
|
||||
},
|
||||
"auto_door_voice_control": {
|
||||
"name": "Hlasové ovládání automatického otevírání dvířek"
|
||||
},
|
||||
"auto_release_dry": {
|
||||
"name": "Automatické uvolnění při sušení"
|
||||
},
|
||||
@@ -1348,6 +1477,7 @@
|
||||
"title": "Možnosti LocalThings",
|
||||
"menu_options": {
|
||||
"settings": "Nastavení zápisu pro dálkové ovládání",
|
||||
"cloud_courses": "Stažené cykly",
|
||||
"forget_learned_modes": "Zapomenout zapamatované režimy",
|
||||
"debug_write": "Ladění: zápis do prostředku"
|
||||
}
|
||||
@@ -1386,20 +1516,63 @@
|
||||
"debug_write": "Zapsat do dalšího prostředku",
|
||||
"finish": "Dokončit"
|
||||
}
|
||||
},
|
||||
"cloud_manual": {
|
||||
"title": "Stažené cykly",
|
||||
"description": "Toto zařízení hlásí {total} stažených cyklů; {found} jich bylo dosud zjištěno.\n\nNastavení staženého cyklu jsou viditelná pouze tehdy, když je daný cyklus právě načtený, a zařízení nikdy nehlásí jejich názvy. Chcete-li doplnit chybějící ({pending}): na zařízení vyberte Stažený program, poté postupně projděte jednotlivé stažené programy, u každého se na pár sekund zastavte, a vraťte se sem.\n\nKaždému z nich zadejte název, který chcete vidět v Home Assistant. Necháte-li název prázdný, daný cyklus zůstane mimo seznam cyklů. Názvy musí být jedinečné.\n\nStažený program je program na tomto zařízení, který spouští stažený cyklus. Rozpoznává se automaticky, ale před použitím jej zde potvrďte: výběrem staženého cyklu se do zařízení zapíše tento kód programu.",
|
||||
"data": {
|
||||
"download_course": "Kód programu „Stažený program“"
|
||||
}
|
||||
},
|
||||
"cloud_courses": {
|
||||
"title": "Stažené cykly",
|
||||
"description": "Průvodce nastavením vás provede zařízením: na zařízení vyberte stažený cyklus a jakmile je nalezen, pojmenujte ho – jeden po druhém.\n\nÚprava názvů zobrazí vše dosud nalezené najednou – použijte ji později k přejmenování nebo opravě.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "Průvodce nastavením",
|
||||
"cloud_manual": "Upravit názvy"
|
||||
}
|
||||
},
|
||||
"cloud_wait": {
|
||||
"title": "Stažené cykly"
|
||||
},
|
||||
"cloud_name": {
|
||||
"title": "Pojmenujte tento cyklus",
|
||||
"description": "Zařízení přepnulo na stažený cyklus (pozice {slot}) a hlásí zbývající čas {remaining}.\n\nZadejte název, který chcete vidět v Home Assistant, a poté na zařízení vyberte další cyklus. Necháte-li pole prázdné, tento cyklus zůstane mimo seznam.\n\nDosud pojmenováno ({named} z {total}): {named_list}\n\nNázvy musí být jedinečné. Toto okno můžete kdykoli zavřít – názvy se ukládají průběžně.",
|
||||
"data": {
|
||||
"name": "Název",
|
||||
"download_course": "Kód programu „Stažený program“"
|
||||
}
|
||||
},
|
||||
"cloud_timeout": {
|
||||
"title": "Nebyl vybrán žádný cyklus",
|
||||
"description": "Na zařízení nebylo nic vybráno. Ujistěte se, že je nastaveno na Stažený program, a poté postupně procházejte stažené programy.\n\nDosud pojmenováno ({named} z {total}): {named_list}\n\nVše dosud pojmenované je již uloženo.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "Počkat znovu",
|
||||
"cloud_finish": "Dokončit"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"empty_payload": "Zadejte alespoň jedno pole k zápisu.",
|
||||
"write_failed": "Zápis se nezdařil. Podrobnosti najdete v protokolech Home Assistant."
|
||||
"write_failed": "Zápis se nezdařil. Podrobnosti najdete v protokolech Home Assistant.",
|
||||
"cloud_course_name_duplicate": "Dva cykly mají stejný název. Názvy musí být jedinečné.",
|
||||
"cloud_course_unknown_course": "Tento program zařízení nenabízí. Vyberte jej ze seznamu."
|
||||
},
|
||||
"abort": {
|
||||
"not_loaded": "Toto zařízení ještě není připojeno. Zkuste to znovu, až se načte."
|
||||
},
|
||||
"progress": {
|
||||
"cloud_wait": "Nyní na zařízení vyberte stažený cyklus.\n\nDosud pojmenováno ({named} z {total}): {named_list}\n\nToto okno můžete kdykoli zavřít – názvy se ukládají průběžně."
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"device_gap": {
|
||||
"title": "Neúplné pokrytí funkcí pro {device_name}",
|
||||
"description": "Toto zařízení nemá úplné pokrytí funkcí. Buď nebyl rozpoznán jeho typ spotřebiče, nebo některé jím poskytované prostředky ještě nejsou namodelovány. Bude i nadále fungovat se vším, co je již podporováno. Podporu můžete pomoci rozšířit tak, že přejdete do Nastavení > Zařízení a služby > {device_name} > nabídka (vpravo nahoře) > Stáhnout diagnostiku a poté ji vložíte do odkazované šablony issue."
|
||||
},
|
||||
"cloud_courses_undiscovered": {
|
||||
"title": "Stažené cykly nejsou nastaveny pro {device_name}",
|
||||
"description": "{device_name} má {pending} z {total} stažených cyklů, které Home Assistant zatím nemůže nabídnout. Stažený cyklus lze použít až poté, co byl na zařízení zjištěn načtený a co jste mu dali název.\n\nChcete-li je nastavit, přejděte do Nastavení > Zařízení a služby > LocalThings > {device_name} > Konfigurovat > Stažené cykly a postupujte podle pokynů."
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
@@ -1424,6 +1597,9 @@
|
||||
"command_failed": {
|
||||
"message": "Příkaz pro {href} selhal i po opětovném připojení: {error}"
|
||||
},
|
||||
"debug_read_failed": {
|
||||
"message": "Čtení z {href} selhalo: {error}"
|
||||
},
|
||||
"debug_too_many_writes": {
|
||||
"message": "Zadejte 1 až 10 zápisů."
|
||||
},
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -108,6 +108,9 @@
|
||||
},
|
||||
"softener_low": {
|
||||
"name": "Softener low"
|
||||
},
|
||||
"stick_ble_connected": {
|
||||
"name": "Stick BLE connected"
|
||||
}
|
||||
},
|
||||
"button": {
|
||||
@@ -225,6 +228,9 @@
|
||||
"air_filter_threshold": {
|
||||
"name": "Filter alarm threshold"
|
||||
},
|
||||
"auto_door_timer": {
|
||||
"name": "Auto door open timer"
|
||||
},
|
||||
"beverage_zone_mode": {
|
||||
"name": "Beverage zone mode",
|
||||
"state": {
|
||||
@@ -255,7 +261,11 @@
|
||||
"name": "Buzzer sound",
|
||||
"state": {
|
||||
"off": "Off",
|
||||
"on": "On"
|
||||
"on": "On",
|
||||
"volume_off": "Off",
|
||||
"volume_low": "Low",
|
||||
"volume_med": "Medium",
|
||||
"volume_high": "High"
|
||||
}
|
||||
},
|
||||
"discharging_time": {
|
||||
@@ -296,8 +306,17 @@
|
||||
"0e": "AI Wash",
|
||||
"07": "Pre blast",
|
||||
"8d": "Pots and pans",
|
||||
"85": "Delicate",
|
||||
"0c": "Express",
|
||||
"0d": "Self clean",
|
||||
"8e": "Plastic",
|
||||
"8f": "Baby Care"
|
||||
"8f": "Baby Care",
|
||||
"82": "Auto",
|
||||
"8a": "Normal",
|
||||
"a7": "Heavy",
|
||||
"a8": "Express",
|
||||
"8c": "Extra Silence",
|
||||
"88": "Self Clean"
|
||||
}
|
||||
},
|
||||
"dispense_type": {
|
||||
@@ -312,6 +331,22 @@
|
||||
"4": "Alarm 4"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_00": {
|
||||
"name": "Cycle",
|
||||
"state": {
|
||||
"01": "Normal",
|
||||
"9c": "Heavy Duty",
|
||||
"a5": "Bedding",
|
||||
"9e": "Perm Press",
|
||||
"9b": "Steam Sanitize+",
|
||||
"27": "Refresh",
|
||||
"a0": "Air Fluff",
|
||||
"a4": "Time Dry",
|
||||
"a6": "Quick Dry",
|
||||
"a3": "Active Wear",
|
||||
"a2": "Delicates"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_03": {
|
||||
"name": "Cycle",
|
||||
"state": {
|
||||
@@ -327,8 +362,10 @@
|
||||
"23": "Quick Dry 35'",
|
||||
"24": "Cool air",
|
||||
"25": "Warm air",
|
||||
"26": "Air wash",
|
||||
"27": "Time dry",
|
||||
"29": "AI Dry",
|
||||
"2a": "Hygiene Care+",
|
||||
"1a": "Wool",
|
||||
"1b": "Bedding",
|
||||
"1c": "Shirts",
|
||||
@@ -463,9 +500,11 @@
|
||||
"storage_fridge_normal": "Fridge",
|
||||
"storage_fridge_cold": "Fridge, strong",
|
||||
"storage_fridge_warm": "Fridge, weak",
|
||||
"storage_fridge": "Fridge",
|
||||
"storage_freezer_normal": "Freezer",
|
||||
"storage_freezer_cold": "Freezer, strong",
|
||||
"storage_freezer_warm": "Freezer, weak",
|
||||
"storage_freezer": "Freezer",
|
||||
"kimchi_ripe_low_temp": "Kimchi ripening, low temperature",
|
||||
"kimchi_ripe_normal_temp": "Kimchi ripening, room temperature",
|
||||
"kimchi_ripe_kkakdugi": "Kkakdugi ripening",
|
||||
@@ -476,7 +515,8 @@
|
||||
"storage_fresh_cereal": "Grains",
|
||||
"storage_fridge_drink": "Beverages",
|
||||
"storage_fresh_wine": "Wine",
|
||||
"storage_fresh_potato_banana": "Potato & banana"
|
||||
"storage_fresh_potato_banana": "Potato & banana",
|
||||
"newmode_kimchi_0000": "New mode"
|
||||
}
|
||||
},
|
||||
"pantry_zone_mode": {
|
||||
@@ -487,6 +527,16 @@
|
||||
"fdr_drinks": "Drinks"
|
||||
}
|
||||
},
|
||||
"winecellar_pantry_zone_mode": {
|
||||
"name": "Pantry zone mode",
|
||||
"state": {
|
||||
"processed_meat": "Processed meat",
|
||||
"cheese": "Cheese",
|
||||
"nuts": "Nuts",
|
||||
"fruit": "Fruit",
|
||||
"wine": "Wine"
|
||||
}
|
||||
},
|
||||
"range_burner_power_level": {
|
||||
"name": "Burner {number} power level",
|
||||
"state": {
|
||||
@@ -577,11 +627,30 @@
|
||||
"extra_hot": "Extra hot"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_00": {
|
||||
"name": "Cycle",
|
||||
"state": {
|
||||
"01": "Normal",
|
||||
"70": "Heavy Duty",
|
||||
"55": "Whites",
|
||||
"71": "Bedding",
|
||||
"72": "Sanitize",
|
||||
"77": "Perm Press",
|
||||
"57": "Self Clean+",
|
||||
"73": "Rinse + Spin",
|
||||
"74": "Active Wear",
|
||||
"75": "Delicates",
|
||||
"78": "Quick Wash"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_02": {
|
||||
"name": "Cycle",
|
||||
"state": {
|
||||
"01": "Normal",
|
||||
"04": "Quick Wash",
|
||||
"06": "XXL Laundry",
|
||||
"08": "Rinse+Spin",
|
||||
"0a": "Towels",
|
||||
"17": "Downloaded",
|
||||
"1b": "Cotton",
|
||||
"1c": "Eco 40-60",
|
||||
@@ -592,7 +661,7 @@
|
||||
"21": "Colors",
|
||||
"22": "Wool",
|
||||
"23": "Outdoor",
|
||||
"24": "Towels",
|
||||
"24": "Bedding",
|
||||
"25": "Synthetics",
|
||||
"26": "Delicates",
|
||||
"27": "Rinse+Spin",
|
||||
@@ -605,8 +674,9 @@
|
||||
"2f": "Activewear",
|
||||
"30": "Cloudy Day",
|
||||
"32": "Shirts",
|
||||
"33": "Bedding",
|
||||
"33": "Towels",
|
||||
"34": "Mixed",
|
||||
"35": "E Cotton",
|
||||
"36": "Wash+Dry",
|
||||
"37": "Air Wash",
|
||||
"38": "Cotton Dry",
|
||||
@@ -621,14 +691,34 @@
|
||||
"60": "Self Clean+",
|
||||
"65": "Colors",
|
||||
"66": "Denim",
|
||||
"69": "AI Wash",
|
||||
"6a": "Wool",
|
||||
"6b": "Denim",
|
||||
"6c": "Blouses",
|
||||
"6d": "Delicates",
|
||||
"6e": "Active Wear",
|
||||
"6f": "Bedding",
|
||||
"70": "Towels",
|
||||
"71": "Quick Wash",
|
||||
"72": "Shirts",
|
||||
"73": "Sanitize",
|
||||
"74": "Drum Clean",
|
||||
"75": "Outdoor",
|
||||
"76": "Baby Care",
|
||||
"77": "Cottons",
|
||||
"78": "Rinse + Spin",
|
||||
"79": "Spin Only",
|
||||
"7c": "Whites",
|
||||
"7d": "Bedding/Waterproof",
|
||||
"7e": "Self-Clean",
|
||||
"7f": "Wool/Delicate",
|
||||
"86": "Deep Wash",
|
||||
"87": "Download",
|
||||
"88": "Pet Care",
|
||||
"8f": "Intense Cold",
|
||||
"96": "Less Microfiber"
|
||||
"96": "Less Microfiber",
|
||||
"a0": "15' Quick Wash",
|
||||
"b0": "Mixed Load"
|
||||
}
|
||||
},
|
||||
"washer_dry_level": {
|
||||
@@ -715,6 +805,9 @@
|
||||
"air_filter_usage_hours": {
|
||||
"name": "Filter usage hours"
|
||||
},
|
||||
"deodor_filter_usage": {
|
||||
"name": "Filter usage"
|
||||
},
|
||||
"air_quality_standard": {
|
||||
"name": "Air quality standard"
|
||||
},
|
||||
@@ -788,6 +881,12 @@
|
||||
"stick_status": {
|
||||
"name": "Stick status"
|
||||
},
|
||||
"stick_operation_mode": {
|
||||
"name": "Stick operation mode"
|
||||
},
|
||||
"stick_cleaning_status": {
|
||||
"name": "Stick cleaning status"
|
||||
},
|
||||
"uvc_operation_time": {
|
||||
"name": "UV-C operation time"
|
||||
},
|
||||
@@ -835,10 +934,16 @@
|
||||
"name": "Temperature"
|
||||
},
|
||||
"diagnosis": {
|
||||
"name": "Diagnosis"
|
||||
"name": "Diagnosis",
|
||||
"state": {
|
||||
"ready": "Ready"
|
||||
}
|
||||
},
|
||||
"diagnosis_status": {
|
||||
"name": "Diagnosis status"
|
||||
"name": "Diagnosis status",
|
||||
"state": {
|
||||
"ready": "Ready"
|
||||
}
|
||||
},
|
||||
"drum_clean_cycles_remaining": {
|
||||
"name": "Drum clean due in"
|
||||
@@ -853,7 +958,10 @@
|
||||
"name": "Dry time"
|
||||
},
|
||||
"dryer_type": {
|
||||
"name": "Dryer type"
|
||||
"name": "Dryer type",
|
||||
"state": {
|
||||
"electricity": "Electricity"
|
||||
}
|
||||
},
|
||||
"dust": {
|
||||
"name": "Dust"
|
||||
@@ -982,7 +1090,22 @@
|
||||
"name": "Probe temperature"
|
||||
},
|
||||
"progress": {
|
||||
"name": "Progress"
|
||||
"name": "Progress",
|
||||
"state": {
|
||||
"idle": "Idle",
|
||||
"weightsensing": "Weight sensing",
|
||||
"wash": "Washing",
|
||||
"rinse": "Rinsing",
|
||||
"spin": "Spinning",
|
||||
"finish": "Finished",
|
||||
"steaming": "Steaming",
|
||||
"airwashing": "Air washing",
|
||||
"drying": "Drying",
|
||||
"dryingwithdooropen": "Venting",
|
||||
"cooling": "Cooling",
|
||||
"predrain": "Pre-drain",
|
||||
"prewash": "Pre-wash"
|
||||
}
|
||||
},
|
||||
"progress_percentage": {
|
||||
"name": "Progress percent"
|
||||
@@ -1117,6 +1240,12 @@
|
||||
"auto_door_opener": {
|
||||
"name": "Auto door opener"
|
||||
},
|
||||
"auto_door_sound_control": {
|
||||
"name": "Auto door sound"
|
||||
},
|
||||
"auto_door_voice_control": {
|
||||
"name": "Auto door voice control"
|
||||
},
|
||||
"auto_release_dry": {
|
||||
"name": "Auto release dry"
|
||||
},
|
||||
@@ -1348,6 +1477,7 @@
|
||||
"title": "LocalThings options",
|
||||
"menu_options": {
|
||||
"settings": "Device settings",
|
||||
"cloud_courses": "Download cycles",
|
||||
"forget_learned_modes": "Forget remembered modes",
|
||||
"debug_write": "Debug: write to a resource"
|
||||
}
|
||||
@@ -1386,20 +1516,63 @@
|
||||
"debug_write": "Write another resource",
|
||||
"finish": "Finish"
|
||||
}
|
||||
},
|
||||
"cloud_manual": {
|
||||
"title": "Download cycles",
|
||||
"description": "This appliance reports {total} downloaded cycle(s); {found} have been seen so far.\n\nA downloaded cycle's settings are only visible while that cycle is loaded, and the appliance never reports their names. To add the missing ones ({pending}): on the appliance, select the Download cycle, then step through each downloaded program in turn, pausing a few seconds on each, and come back here.\n\nGive each one the name you want to see in Home Assistant. Leave a name blank to keep that cycle out of the cycle list. Names must be unique.\n\nThe Download cycle is the course on this appliance that runs a downloaded program. It is detected automatically, but confirm it here before use: selecting a downloaded cycle writes this course code to the appliance.",
|
||||
"data": {
|
||||
"download_course": "Download cycle course code"
|
||||
}
|
||||
},
|
||||
"cloud_courses": {
|
||||
"title": "Download cycles",
|
||||
"description": "Guided setup walks the appliance with you: select a downloaded cycle on the appliance and name it as it's found, one at a time.\n\nEdit names shows everything found so far at once — use it to rename or correct something later.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "Guided setup",
|
||||
"cloud_manual": "Edit names"
|
||||
}
|
||||
},
|
||||
"cloud_wait": {
|
||||
"title": "Download cycles"
|
||||
},
|
||||
"cloud_name": {
|
||||
"title": "Name this cycle",
|
||||
"description": "The appliance switched to a downloaded cycle (slot {slot}) and reports {remaining} remaining.\n\nGive it the name you want to see in Home Assistant, then select the next one on the appliance. Leave it blank to keep this cycle out of the list.\n\nNamed so far ({named} of {total}): {named_list}\n\nNames must be unique. You can close this dialog whenever you like — names are saved as you go.",
|
||||
"data": {
|
||||
"name": "Name",
|
||||
"download_course": "Download cycle course code"
|
||||
}
|
||||
},
|
||||
"cloud_timeout": {
|
||||
"title": "No cycle selected",
|
||||
"description": "Nothing was selected on the appliance. Make sure it's set to the Download cycle, then step through the downloaded programs.\n\nNamed so far ({named} of {total}): {named_list}\n\nEverything named so far is already saved.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "Wait again",
|
||||
"cloud_finish": "Finish"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"empty_payload": "Enter at least one field to write.",
|
||||
"write_failed": "The write failed. Check the Home Assistant logs for details."
|
||||
"write_failed": "The write failed. Check the Home Assistant logs for details.",
|
||||
"cloud_course_name_duplicate": "Two cycles have the same name. Names must be unique.",
|
||||
"cloud_course_unknown_course": "That course isn't one this appliance offers. Pick one from the list."
|
||||
},
|
||||
"abort": {
|
||||
"not_loaded": "This device isn't connected yet. Try again once it has loaded."
|
||||
},
|
||||
"progress": {
|
||||
"cloud_wait": "Select a downloaded cycle on the appliance now.\n\nNamed so far ({named} of {total}): {named_list}\n\nYou can close this dialog at any time — names are saved as you go."
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"device_gap": {
|
||||
"title": "Incomplete capability coverage for {device_name}",
|
||||
"description": "This device is missing full capability coverage. Either its appliance type wasn't recognized, or some of the resources it exposes aren't modeled yet. It'll keep working with whatever is already supported. You can help expand support by going to Settings > Devices & Services > {device_name} > the menu (top right) > Download diagnostics, then filing it with the linked issue template."
|
||||
},
|
||||
"cloud_courses_undiscovered": {
|
||||
"title": "Downloaded cycles not set up for {device_name}",
|
||||
"description": "{device_name} has {pending} of {total} downloaded cycle(s) that Home Assistant can't offer yet. A downloaded cycle can only be used once the appliance has been seen with it loaded and you've given it a name.\n\nTo set them up, go to Settings > Devices & Services > LocalThings > {device_name} > Configure > Download cycles and follow the instructions there."
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
@@ -1424,6 +1597,9 @@
|
||||
"command_failed": {
|
||||
"message": "The command to {href} failed even after reconnecting: {error}"
|
||||
},
|
||||
"debug_read_failed": {
|
||||
"message": "The read from {href} failed: {error}"
|
||||
},
|
||||
"debug_too_many_writes": {
|
||||
"message": "Provide between 1 and 10 writes."
|
||||
},
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
"title": "Opciones de LocalThings",
|
||||
"menu_options": {
|
||||
"settings": "Ajustes del dispositivo",
|
||||
"cloud_courses": "Ciclos descargados",
|
||||
"forget_learned_modes": "Olvidar los modos recordados",
|
||||
"debug_write": "Depuración: escribir en un recurso"
|
||||
}
|
||||
@@ -91,20 +92,63 @@
|
||||
"debug_write": "Escribir otro recurso",
|
||||
"finish": "Finalizar"
|
||||
}
|
||||
},
|
||||
"cloud_manual": {
|
||||
"title": "Ciclos descargados",
|
||||
"description": "Este dispositivo informa de {total} ciclos descargados; se han detectado {found} hasta ahora.\n\nLos ajustes de un ciclo descargado solo son visibles mientras ese ciclo está cargado, y el dispositivo nunca informa de sus nombres. Para añadir los que faltan ({pending}): en el dispositivo, selecciona Descarga de Programas y ve pasando por cada programa descargado uno a uno, deteniéndote unos segundos en cada uno, y vuelve aquí.\n\nDa a cada uno el nombre que quieras ver en Home Assistant. Deja un nombre en blanco para mantener ese ciclo fuera de la lista de ciclos. Los nombres deben ser únicos.\n\nDescarga de Programas es el programa de este dispositivo que ejecuta un ciclo descargado. Se detecta automáticamente, pero confírmalo aquí antes de usarlo: seleccionar un ciclo descargado escribe este código de programa en el dispositivo.",
|
||||
"data": {
|
||||
"download_course": "Código de programa de Descarga de Programas"
|
||||
}
|
||||
},
|
||||
"cloud_courses": {
|
||||
"title": "Ciclos descargados",
|
||||
"description": "La configuración guiada te acompaña con el dispositivo: selecciona un ciclo descargado en el dispositivo y ponle nombre en cuanto se detecte, uno por uno.\n\nEditar nombres muestra todo lo encontrado hasta ahora de una vez — úsalo más adelante para renombrar o corregir algo.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "Configuración guiada",
|
||||
"cloud_manual": "Editar nombres"
|
||||
}
|
||||
},
|
||||
"cloud_wait": {
|
||||
"title": "Ciclos descargados"
|
||||
},
|
||||
"cloud_name": {
|
||||
"title": "Nombra este ciclo",
|
||||
"description": "El dispositivo cambió a un ciclo descargado (ranura {slot}) e informa de {remaining} restantes.\n\nDale el nombre que quieras ver en Home Assistant y luego selecciona el siguiente en el dispositivo. Déjalo en blanco para mantener este ciclo fuera de la lista.\n\nNombrados hasta ahora ({named} de {total}): {named_list}\n\nLos nombres deben ser únicos. Puedes cerrar este cuadro de diálogo cuando quieras — los nombres se guardan sobre la marcha.",
|
||||
"data": {
|
||||
"name": "Nombre",
|
||||
"download_course": "Código de programa de Descarga de Programas"
|
||||
}
|
||||
},
|
||||
"cloud_timeout": {
|
||||
"title": "No se seleccionó ningún ciclo",
|
||||
"description": "No se seleccionó nada en el dispositivo. Asegúrate de que esté puesto en Descarga de Programas y luego ve pasando por los programas descargados.\n\nNombrados hasta ahora ({named} de {total}): {named_list}\n\nTodo lo nombrado hasta ahora ya está guardado.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "Esperar de nuevo",
|
||||
"cloud_finish": "Finalizar"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"empty_payload": "Introduce al menos un campo para escribir.",
|
||||
"write_failed": "La escritura falló. Consulta los registros de Home Assistant para más detalles."
|
||||
"write_failed": "La escritura falló. Consulta los registros de Home Assistant para más detalles.",
|
||||
"cloud_course_name_duplicate": "Dos ciclos tienen el mismo nombre. Los nombres deben ser únicos.",
|
||||
"cloud_course_unknown_course": "Ese programa no es uno que ofrezca este dispositivo. Elige uno de la lista."
|
||||
},
|
||||
"abort": {
|
||||
"not_loaded": "Este dispositivo aún no está conectado. Inténtalo de nuevo cuando se haya cargado."
|
||||
},
|
||||
"progress": {
|
||||
"cloud_wait": "Selecciona ahora un ciclo descargado en el dispositivo.\n\nNombrados hasta ahora ({named} de {total}): {named_list}\n\nPuedes cerrar este cuadro de diálogo en cualquier momento — los nombres se guardan sobre la marcha."
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"device_gap": {
|
||||
"title": "Cobertura de capacidades incompleta para {device_name}",
|
||||
"description": "A este dispositivo le falta cobertura completa de capacidades. O su tipo de electrodoméstico no fue reconocido, o algunos de los recursos que expone aún no están modelados. Seguirá funcionando con lo que ya está soportado. Puedes ayudar a ampliar el soporte yendo a Ajustes > Dispositivos y servicios > {device_name} > el menú (arriba a la derecha) > Descargar diagnósticos, y reportándolo con la plantilla de incidencia enlazada."
|
||||
},
|
||||
"cloud_courses_undiscovered": {
|
||||
"title": "Ciclos descargados sin configurar para {device_name}",
|
||||
"description": "{device_name} tiene {pending} de {total} ciclos descargados que Home Assistant todavía no puede ofrecer. Un ciclo descargado solo se puede usar una vez que el dispositivo se ha visto con él cargado y le has dado un nombre.\n\nPara configurarlos, ve a Ajustes > Dispositivos y servicios > LocalThings > {device_name} > Configurar > Ciclos descargados y sigue las instrucciones que aparecen allí."
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
@@ -129,6 +173,9 @@
|
||||
"command_failed": {
|
||||
"message": "El comando para {href} falló incluso después de reconectar: {error}"
|
||||
},
|
||||
"debug_read_failed": {
|
||||
"message": "La lectura desde {href} falló: {error}"
|
||||
},
|
||||
"debug_too_many_writes": {
|
||||
"message": "Proporciona entre 1 y 10 escrituras."
|
||||
},
|
||||
@@ -257,6 +304,9 @@
|
||||
},
|
||||
"auto_clean_running": {
|
||||
"name": "Limpieza automática en curso"
|
||||
},
|
||||
"stick_ble_connected": {
|
||||
"name": "Aspiradora conectada por BLE"
|
||||
}
|
||||
},
|
||||
"button": {
|
||||
@@ -374,6 +424,9 @@
|
||||
"air_filter_threshold": {
|
||||
"name": "Umbral de alarma del filtro"
|
||||
},
|
||||
"auto_door_timer": {
|
||||
"name": "Temporizador de apertura automática de puerta"
|
||||
},
|
||||
"beverage_zone_mode": {
|
||||
"name": "Modo de zona de bebidas",
|
||||
"state": {
|
||||
@@ -404,7 +457,11 @@
|
||||
"name": "Volumen",
|
||||
"state": {
|
||||
"off": "Apagado",
|
||||
"on": "Encendido"
|
||||
"on": "Encendido",
|
||||
"volume_off": "Apagado",
|
||||
"volume_low": "Bajo",
|
||||
"volume_med": "Medio",
|
||||
"volume_high": "Alto"
|
||||
}
|
||||
},
|
||||
"discharging_time": {
|
||||
@@ -446,7 +503,16 @@
|
||||
"07": "Prelavado intenso",
|
||||
"8d": "Ollas y sartenes",
|
||||
"8e": "Plástico",
|
||||
"8f": "Cuidado del bebé"
|
||||
"8f": "Cuidado del bebé",
|
||||
"82": "Automático",
|
||||
"8a": "Normal",
|
||||
"a7": "Intenso",
|
||||
"a8": "Express",
|
||||
"8c": "Extra silencioso",
|
||||
"88": "Autolimpieza",
|
||||
"85": "Delicado",
|
||||
"0c": "Express",
|
||||
"0d": "Autolimpieza"
|
||||
}
|
||||
},
|
||||
"dispense_type": {
|
||||
@@ -461,6 +527,22 @@
|
||||
"4": "Alarma 4"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_00": {
|
||||
"name": "Ciclo",
|
||||
"state": {
|
||||
"01": "Normal",
|
||||
"9c": "Servicio intensivo",
|
||||
"a5": "Ropa de cama",
|
||||
"9e": "Planchado fácil",
|
||||
"9b": "Desinfección por vapor+",
|
||||
"27": "Renovar",
|
||||
"a0": "Aireación",
|
||||
"a4": "Secado por tiempo",
|
||||
"a6": "Secado rápido",
|
||||
"a3": "Ropa deportiva",
|
||||
"a2": "Delicados"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_03": {
|
||||
"name": "Ciclo",
|
||||
"state": {
|
||||
@@ -488,7 +570,9 @@
|
||||
"4c": "Renovación de aire",
|
||||
"51": "Eco algodón",
|
||||
"53": "Secado IA+",
|
||||
"4e": "Autosecado"
|
||||
"4e": "Autosecado",
|
||||
"26": "Aireación",
|
||||
"2a": "Cuidado higiénico+"
|
||||
}
|
||||
},
|
||||
"favorite_capacity": {
|
||||
@@ -610,9 +694,11 @@
|
||||
"kimchi_storage_crunfch": "Kimchi crujiente",
|
||||
"kimchi_storage_buy": "Kimchi comprado",
|
||||
"storage_fridge_normal": "Frigorífico",
|
||||
"storage_fridge": "Frigorífico",
|
||||
"storage_fridge_cold": "Frigorífico, fuerte",
|
||||
"storage_fridge_warm": "Frigorífico, suave",
|
||||
"storage_freezer_normal": "Congelador",
|
||||
"storage_freezer": "Congelador",
|
||||
"storage_freezer_cold": "Congelador, fuerte",
|
||||
"storage_freezer_warm": "Congelador, suave",
|
||||
"kimchi_ripe_low_temp": "Maduración kimchi, baja temperatura",
|
||||
@@ -625,7 +711,8 @@
|
||||
"storage_fresh_cereal": "Cereales",
|
||||
"storage_fridge_drink": "Bebidas",
|
||||
"storage_fresh_wine": "Vino",
|
||||
"storage_fresh_potato_banana": "Patata y plátano"
|
||||
"storage_fresh_potato_banana": "Patata y plátano",
|
||||
"newmode_kimchi_0000": "Modo nuevo"
|
||||
}
|
||||
},
|
||||
"pantry_zone_mode": {
|
||||
@@ -636,6 +723,16 @@
|
||||
"fdr_drinks": "Bebidas"
|
||||
}
|
||||
},
|
||||
"winecellar_pantry_zone_mode": {
|
||||
"name": "Modo de zona de despensa",
|
||||
"state": {
|
||||
"processed_meat": "Embutidos",
|
||||
"cheese": "Queso",
|
||||
"nuts": "Frutos secos",
|
||||
"fruit": "Fruta",
|
||||
"wine": "Vino"
|
||||
}
|
||||
},
|
||||
"range_burner_power_level": {
|
||||
"name": "Nivel de potencia del fuego {number}",
|
||||
"state": {
|
||||
@@ -726,11 +823,30 @@
|
||||
"extra_hot": "Muy caliente"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_00": {
|
||||
"name": "Ciclo",
|
||||
"state": {
|
||||
"01": "Normal",
|
||||
"70": "Servicio intensivo",
|
||||
"55": "Blancos",
|
||||
"71": "Ropa de cama",
|
||||
"72": "Desinfección",
|
||||
"77": "Planchado fácil",
|
||||
"57": "Autolimpieza+",
|
||||
"73": "Aclarar + Centrifugar",
|
||||
"74": "Ropa deportiva",
|
||||
"75": "Delicados",
|
||||
"78": "Lavado rápido"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_02": {
|
||||
"name": "Ciclo",
|
||||
"state": {
|
||||
"01": "Normal",
|
||||
"04": "Lavado rápido",
|
||||
"06": "Colada XXL",
|
||||
"08": "Aclarar + Centrifugar",
|
||||
"0a": "Toallas",
|
||||
"17": "Descargado",
|
||||
"1b": "Algodón",
|
||||
"1c": "Eco 40-60",
|
||||
@@ -741,7 +857,7 @@
|
||||
"21": "Color",
|
||||
"22": "Lana",
|
||||
"23": "Exterior",
|
||||
"24": "Toallas",
|
||||
"24": "Ropa de cama",
|
||||
"25": "Sintéticos",
|
||||
"26": "Delicados",
|
||||
"27": "Aclarar + Centrifugar",
|
||||
@@ -754,7 +870,7 @@
|
||||
"2f": "Ropa deportiva",
|
||||
"30": "Día nublado",
|
||||
"32": "Camisas",
|
||||
"33": "Ropa de cama",
|
||||
"33": "Toallas",
|
||||
"34": "Mezcla",
|
||||
"36": "Lavado + Secado",
|
||||
"37": "Lavado con aire",
|
||||
@@ -777,7 +893,28 @@
|
||||
"86": "Lavado profundo",
|
||||
"87": "Descarga de Programas",
|
||||
"8f": "Lavado en frío",
|
||||
"96": "Menos microfibras"
|
||||
"96": "Menos microfibras",
|
||||
"a0": "Lavado rápido 15'",
|
||||
"b0": "Carga mixta",
|
||||
"69": "Lavado IA",
|
||||
"6a": "Lana",
|
||||
"6b": "Denim",
|
||||
"6c": "Blusas",
|
||||
"6d": "Delicados",
|
||||
"6e": "Ropa deportiva",
|
||||
"6f": "Ropa de cama",
|
||||
"70": "Toallas",
|
||||
"71": "Lavado rápido",
|
||||
"72": "Camisas",
|
||||
"73": "Desinfección",
|
||||
"74": "Limpieza de Tambor",
|
||||
"75": "Exterior",
|
||||
"76": "Cuidado del bebé",
|
||||
"77": "Algodón",
|
||||
"78": "Aclarar + Centrifugar",
|
||||
"79": "Solo centrifugar",
|
||||
"88": "Cuidado de mascotas",
|
||||
"35": "Algodón E"
|
||||
}
|
||||
},
|
||||
"washer_dry_level": {
|
||||
@@ -861,6 +998,9 @@
|
||||
"air_filter_usage_hours": {
|
||||
"name": "Horas de uso del filtro"
|
||||
},
|
||||
"deodor_filter_usage": {
|
||||
"name": "Uso del filtro"
|
||||
},
|
||||
"air_quality_standard": {
|
||||
"name": "Estándar de calidad del aire"
|
||||
},
|
||||
@@ -934,6 +1074,12 @@
|
||||
"stick_status": {
|
||||
"name": "Estado de la aspiradora"
|
||||
},
|
||||
"stick_operation_mode": {
|
||||
"name": "Modo de funcionamiento de la aspiradora"
|
||||
},
|
||||
"stick_cleaning_status": {
|
||||
"name": "Estado de limpieza de la aspiradora"
|
||||
},
|
||||
"uvc_operation_time": {
|
||||
"name": "Tiempo de funcionamiento UV-C"
|
||||
},
|
||||
@@ -981,10 +1127,16 @@
|
||||
"name": "Temperatura"
|
||||
},
|
||||
"diagnosis": {
|
||||
"name": "Diagnóstico"
|
||||
"name": "Diagnóstico",
|
||||
"state": {
|
||||
"ready": "Listo"
|
||||
}
|
||||
},
|
||||
"diagnosis_status": {
|
||||
"name": "Estado del diagnóstico"
|
||||
"name": "Estado del diagnóstico",
|
||||
"state": {
|
||||
"ready": "Listo"
|
||||
}
|
||||
},
|
||||
"drum_clean_cycles_remaining": {
|
||||
"name": "Limpieza de tambor en"
|
||||
@@ -999,7 +1151,10 @@
|
||||
"name": "Tiempo de secado"
|
||||
},
|
||||
"dryer_type": {
|
||||
"name": "Tipo de secadora"
|
||||
"name": "Tipo de secadora",
|
||||
"state": {
|
||||
"electricity": "Electricidad"
|
||||
}
|
||||
},
|
||||
"dust": {
|
||||
"name": "Polvo"
|
||||
@@ -1128,7 +1283,22 @@
|
||||
"name": "Temperatura de la sonda"
|
||||
},
|
||||
"progress": {
|
||||
"name": "Progreso"
|
||||
"name": "Progreso",
|
||||
"state": {
|
||||
"idle": "Inactiva",
|
||||
"weightsensing": "Detección de carga",
|
||||
"wash": "Lavado",
|
||||
"rinse": "Aclarado",
|
||||
"spin": "Centrifugado",
|
||||
"finish": "Finalizado",
|
||||
"steaming": "Vaporización",
|
||||
"airwashing": "Lavado con aire",
|
||||
"drying": "Secado",
|
||||
"dryingwithdooropen": "Ventilación",
|
||||
"cooling": "Enfriamiento",
|
||||
"predrain": "Drenaje previo",
|
||||
"prewash": "Prelavado"
|
||||
}
|
||||
},
|
||||
"progress_percentage": {
|
||||
"name": "Porcentaje de progreso"
|
||||
@@ -1266,6 +1436,12 @@
|
||||
"auto_door_opener": {
|
||||
"name": "Apertura automática de puerta"
|
||||
},
|
||||
"auto_door_sound_control": {
|
||||
"name": "Sonido de apertura automática de puerta"
|
||||
},
|
||||
"auto_door_voice_control": {
|
||||
"name": "Control por voz de apertura automática de puerta"
|
||||
},
|
||||
"auto_release_dry": {
|
||||
"name": "Liberación automática de secado"
|
||||
},
|
||||
|
||||
@@ -108,6 +108,9 @@
|
||||
},
|
||||
"softener_low": {
|
||||
"name": "Aggiungi ammorbidente"
|
||||
},
|
||||
"stick_ble_connected": {
|
||||
"name": "Scopa elettrica connessa via BLE"
|
||||
}
|
||||
},
|
||||
"button": {
|
||||
@@ -225,6 +228,9 @@
|
||||
"air_filter_threshold": {
|
||||
"name": "Soglia allarme filtro"
|
||||
},
|
||||
"auto_door_timer": {
|
||||
"name": "Timer apertura automatica sportello"
|
||||
},
|
||||
"beverage_zone_mode": {
|
||||
"name": "Modalità zona bevande",
|
||||
"state": {
|
||||
@@ -255,7 +261,11 @@
|
||||
"name": "Suono cicalino",
|
||||
"state": {
|
||||
"off": "Spento",
|
||||
"on": "Acceso"
|
||||
"on": "Acceso",
|
||||
"volume_off": "Spento",
|
||||
"volume_low": "Basso",
|
||||
"volume_med": "Medio",
|
||||
"volume_high": "Alto"
|
||||
}
|
||||
},
|
||||
"discharging_time": {
|
||||
@@ -297,7 +307,16 @@
|
||||
"07": "Prelavaggio intenso",
|
||||
"8d": "Pentole e padelle",
|
||||
"8e": "Plastica",
|
||||
"8f": "Bambini"
|
||||
"8f": "Bambini",
|
||||
"82": "Automatico",
|
||||
"8a": "Normale",
|
||||
"a7": "Intenso",
|
||||
"a8": "Express",
|
||||
"8c": "Extra silenzioso",
|
||||
"88": "Autopulizia",
|
||||
"85": "Delicato",
|
||||
"0c": "Express",
|
||||
"0d": "Autopulizia"
|
||||
}
|
||||
},
|
||||
"dispense_type": {
|
||||
@@ -312,6 +331,22 @@
|
||||
"4": "Allarme 4"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_00": {
|
||||
"name": "Ciclo",
|
||||
"state": {
|
||||
"01": "Normale",
|
||||
"9c": "Intenso",
|
||||
"a5": "Biancheria da letto",
|
||||
"9e": "Pronto da stirare",
|
||||
"9b": "Igienizzante a vapore+",
|
||||
"27": "Rinfresca",
|
||||
"a0": "Arieggiatura",
|
||||
"a4": "Asciugatura a tempo",
|
||||
"a6": "Asciugatura rapida",
|
||||
"a3": "Abbigliamento sportivo",
|
||||
"a2": "Delicati"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_03": {
|
||||
"name": "Ciclo",
|
||||
"state": {
|
||||
@@ -339,7 +374,9 @@
|
||||
"4c": "Rinfresca",
|
||||
"51": "Eco cotone",
|
||||
"53": "Asciugatura AI+",
|
||||
"4e": "Autoasciugatura"
|
||||
"4e": "Autoasciugatura",
|
||||
"26": "Arieggiatura",
|
||||
"2a": "Cura igienica+"
|
||||
}
|
||||
},
|
||||
"favorite_capacity": {
|
||||
@@ -461,9 +498,11 @@
|
||||
"kimchi_storage_crunfch": "Kimchi croccante",
|
||||
"kimchi_storage_buy": "Kimchi acquistato",
|
||||
"storage_fridge_normal": "Frigorifero",
|
||||
"storage_fridge": "Frigorifero",
|
||||
"storage_fridge_cold": "Frigorifero, forte",
|
||||
"storage_fridge_warm": "Frigorifero, debole",
|
||||
"storage_freezer_normal": "Congelatore",
|
||||
"storage_freezer": "Congelatore",
|
||||
"storage_freezer_cold": "Congelatore, forte",
|
||||
"storage_freezer_warm": "Congelatore, debole",
|
||||
"kimchi_ripe_low_temp": "Maturazione kimchi, bassa temperatura",
|
||||
@@ -476,7 +515,8 @@
|
||||
"storage_fresh_cereal": "Cereali",
|
||||
"storage_fridge_drink": "Bevande",
|
||||
"storage_fresh_wine": "Vino",
|
||||
"storage_fresh_potato_banana": "Patate e banane"
|
||||
"storage_fresh_potato_banana": "Patate e banane",
|
||||
"newmode_kimchi_0000": "Nuova modalità"
|
||||
}
|
||||
},
|
||||
"pantry_zone_mode": {
|
||||
@@ -487,6 +527,16 @@
|
||||
"fdr_drinks": "Bevande"
|
||||
}
|
||||
},
|
||||
"winecellar_pantry_zone_mode": {
|
||||
"name": "Modalità zona dispensa",
|
||||
"state": {
|
||||
"processed_meat": "Salumi",
|
||||
"cheese": "Formaggio",
|
||||
"nuts": "Frutta secca",
|
||||
"fruit": "Frutta",
|
||||
"wine": "Vino"
|
||||
}
|
||||
},
|
||||
"range_burner_power_level": {
|
||||
"name": "Livello potenza fornello {number}",
|
||||
"state": {
|
||||
@@ -577,11 +627,30 @@
|
||||
"extra_hot": "Extra caldo"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_00": {
|
||||
"name": "Ciclo",
|
||||
"state": {
|
||||
"01": "Normale",
|
||||
"70": "Intenso",
|
||||
"55": "Bianchi",
|
||||
"71": "Biancheria da letto",
|
||||
"72": "Igienizzante",
|
||||
"77": "Pronto da stirare",
|
||||
"57": "Self Clean+",
|
||||
"73": "Risciacquo+Centrifuga",
|
||||
"74": "Abbigliamento sportivo",
|
||||
"75": "Delicati",
|
||||
"78": "Lavaggio rapido"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_02": {
|
||||
"name": "Ciclo",
|
||||
"state": {
|
||||
"01": "Normale",
|
||||
"04": "Lavaggio rapido",
|
||||
"06": "Bucato XXL",
|
||||
"08": "Risciacquo+Centrifuga",
|
||||
"0a": "Asciugamani",
|
||||
"17": "Scaricato",
|
||||
"1b": "Cotone",
|
||||
"1c": "Eco 40-60",
|
||||
@@ -592,7 +661,7 @@
|
||||
"21": "Colorati",
|
||||
"22": "Lana",
|
||||
"23": "Capi outdoor",
|
||||
"24": "Asciugamani",
|
||||
"24": "Biancheria da letto",
|
||||
"25": "Sintetici",
|
||||
"26": "Delicati",
|
||||
"27": "Risciacquo+Centrifuga",
|
||||
@@ -605,7 +674,7 @@
|
||||
"2f": "Abbigliamento sportivo",
|
||||
"30": "Giornata nuvolosa",
|
||||
"32": "Camicie",
|
||||
"33": "Biancheria da letto",
|
||||
"33": "Asciugamani",
|
||||
"34": "Misti",
|
||||
"36": "Lavaggio+Asciugatura",
|
||||
"37": "Lavaggio ad aria",
|
||||
@@ -628,7 +697,28 @@
|
||||
"86": "Lavaggio profondo",
|
||||
"87": "Scaricato",
|
||||
"8f": "Intenso a freddo",
|
||||
"96": "Riduci microfibre"
|
||||
"96": "Riduci microfibre",
|
||||
"69": "Lavaggio AI",
|
||||
"6a": "Lana",
|
||||
"6b": "Jeans",
|
||||
"6c": "Camicette",
|
||||
"6d": "Delicati",
|
||||
"6e": "Abbigliamento sportivo",
|
||||
"6f": "Biancheria da letto",
|
||||
"70": "Asciugamani",
|
||||
"71": "Lavaggio rapido",
|
||||
"72": "Camicie",
|
||||
"73": "Igienizzante",
|
||||
"74": "Pulizia cestello",
|
||||
"75": "Capi outdoor",
|
||||
"76": "Bambini",
|
||||
"77": "Cotone",
|
||||
"78": "Risciacquo+Centrifuga",
|
||||
"79": "Solo centrifuga",
|
||||
"88": "Cura animali",
|
||||
"35": "Cotone E",
|
||||
"a0": "Rapido 15'",
|
||||
"b0": "Carico misto"
|
||||
}
|
||||
},
|
||||
"washer_dry_level": {
|
||||
@@ -715,6 +805,9 @@
|
||||
"air_filter_usage_hours": {
|
||||
"name": "Ore di utilizzo filtro"
|
||||
},
|
||||
"deodor_filter_usage": {
|
||||
"name": "Utilizzo filtro"
|
||||
},
|
||||
"air_quality_standard": {
|
||||
"name": "Standard qualità aria"
|
||||
},
|
||||
@@ -788,6 +881,12 @@
|
||||
"stick_status": {
|
||||
"name": "Stato scopa elettrica"
|
||||
},
|
||||
"stick_operation_mode": {
|
||||
"name": "Modalità operativa scopa elettrica"
|
||||
},
|
||||
"stick_cleaning_status": {
|
||||
"name": "Stato pulizia scopa elettrica"
|
||||
},
|
||||
"uvc_operation_time": {
|
||||
"name": "Tempo funzionamento UV-C"
|
||||
},
|
||||
@@ -835,10 +934,16 @@
|
||||
"name": "Temperatura"
|
||||
},
|
||||
"diagnosis": {
|
||||
"name": "Diagnosi"
|
||||
"name": "Diagnosi",
|
||||
"state": {
|
||||
"ready": "Pronto"
|
||||
}
|
||||
},
|
||||
"diagnosis_status": {
|
||||
"name": "Stato diagnosi"
|
||||
"name": "Stato diagnosi",
|
||||
"state": {
|
||||
"ready": "Pronto"
|
||||
}
|
||||
},
|
||||
"drum_clean_cycles_remaining": {
|
||||
"name": "Pulizia cestello fra"
|
||||
@@ -853,7 +958,10 @@
|
||||
"name": "Tempo di asciugatura"
|
||||
},
|
||||
"dryer_type": {
|
||||
"name": "Tipo di asciugatrice"
|
||||
"name": "Tipo di asciugatrice",
|
||||
"state": {
|
||||
"electricity": "Elettricità"
|
||||
}
|
||||
},
|
||||
"dust": {
|
||||
"name": "Polvere"
|
||||
@@ -982,7 +1090,22 @@
|
||||
"name": "Temperatura sonda"
|
||||
},
|
||||
"progress": {
|
||||
"name": "Avanzamento"
|
||||
"name": "Avanzamento",
|
||||
"state": {
|
||||
"idle": "Inattivo",
|
||||
"weightsensing": "Rilevamento del carico",
|
||||
"wash": "Lavaggio",
|
||||
"rinse": "Risciacquo",
|
||||
"spin": "Centrifuga",
|
||||
"finish": "Completato",
|
||||
"steaming": "Vapore",
|
||||
"airwashing": "Lavaggio ad aria",
|
||||
"drying": "Asciugatura",
|
||||
"dryingwithdooropen": "Ventilazione",
|
||||
"cooling": "Raffreddamento",
|
||||
"predrain": "Scarico preliminare",
|
||||
"prewash": "Prelavaggio"
|
||||
}
|
||||
},
|
||||
"progress_percentage": {
|
||||
"name": "Avanzamento percentuale"
|
||||
@@ -1117,6 +1240,12 @@
|
||||
"auto_door_opener": {
|
||||
"name": "Apertura automatica sportello"
|
||||
},
|
||||
"auto_door_sound_control": {
|
||||
"name": "Suono apertura automatica sportello"
|
||||
},
|
||||
"auto_door_voice_control": {
|
||||
"name": "Controllo vocale apertura automatica sportello"
|
||||
},
|
||||
"auto_release_dry": {
|
||||
"name": "Apertura automatica per asciugatura"
|
||||
},
|
||||
@@ -1348,6 +1477,7 @@
|
||||
"title": "Opzioni LocalThings",
|
||||
"menu_options": {
|
||||
"settings": "Impostazioni dispositivo",
|
||||
"cloud_courses": "Cicli scaricati",
|
||||
"forget_learned_modes": "Dimentica le modalità memorizzate",
|
||||
"debug_write": "Debug: scrivi su una risorsa"
|
||||
}
|
||||
@@ -1386,20 +1516,63 @@
|
||||
"debug_write": "Scrivi un'altra risorsa",
|
||||
"finish": "Fine"
|
||||
}
|
||||
},
|
||||
"cloud_manual": {
|
||||
"title": "Cicli scaricati",
|
||||
"description": "Questo dispositivo segnala {total} cicli scaricati; finora ne sono stati rilevati {found}.\n\nLe impostazioni di un ciclo scaricato sono visibili solo mentre quel ciclo è caricato, e il dispositivo non ne segnala mai il nome. Per aggiungere quelli mancanti ({pending}): sul dispositivo selezionare il ciclo Scaricato, quindi scorrere ciascun programma scaricato uno alla volta, sostando qualche secondo su ognuno, e tornare qui.\n\nAssegnare a ciascuno il nome che si desidera vedere in Home Assistant. Lasciare un nome vuoto per escludere quel ciclo dall'elenco dei cicli. I nomi devono essere univoci.\n\nIl ciclo Scaricato è il programma su questo dispositivo che esegue un programma scaricato. Viene rilevato automaticamente, ma confermarlo qui prima dell'uso: selezionare un ciclo scaricato scrive questo codice di programma sul dispositivo.",
|
||||
"data": {
|
||||
"download_course": "Codice programma del ciclo Scaricato"
|
||||
}
|
||||
},
|
||||
"cloud_courses": {
|
||||
"title": "Cicli scaricati",
|
||||
"description": "La configurazione guidata accompagna l'utente al dispositivo: selezionare un ciclo scaricato sul dispositivo e assegnargli un nome non appena viene rilevato, uno alla volta.\n\nModifica nomi mostra tutto ciò che è stato trovato finora in una sola volta — usarla in seguito per rinominare o correggere qualcosa.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "Configurazione guidata",
|
||||
"cloud_manual": "Modifica nomi"
|
||||
}
|
||||
},
|
||||
"cloud_wait": {
|
||||
"title": "Cicli scaricati"
|
||||
},
|
||||
"cloud_name": {
|
||||
"title": "Assegna un nome a questo ciclo",
|
||||
"description": "Il dispositivo è passato a un ciclo scaricato (slot {slot}) e segnala {remaining} rimanenti.\n\nAssegnargli il nome che si desidera vedere in Home Assistant, quindi selezionare il successivo sul dispositivo. Lasciare vuoto per escludere questo ciclo dall'elenco.\n\nAssegnati finora ({named} di {total}): {named_list}\n\nI nomi devono essere univoci. È possibile chiudere questa finestra in qualsiasi momento — i nomi vengono salvati man mano.",
|
||||
"data": {
|
||||
"name": "Nome",
|
||||
"download_course": "Codice programma del ciclo Scaricato"
|
||||
}
|
||||
},
|
||||
"cloud_timeout": {
|
||||
"title": "Nessun ciclo selezionato",
|
||||
"description": "Non è stato selezionato nulla sul dispositivo. Assicurarsi che sia impostato sul ciclo Scaricato, quindi scorrere i programmi scaricati.\n\nAssegnati finora ({named} di {total}): {named_list}\n\nTutto ciò che è stato assegnato finora è già salvato.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "Attendi di nuovo",
|
||||
"cloud_finish": "Fine"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"empty_payload": "Inserisci almeno un campo da scrivere.",
|
||||
"write_failed": "Operazione di scrittura non riuscita. Controlla i registri di Home Assistant per i dettagli."
|
||||
"write_failed": "Operazione di scrittura non riuscita. Controlla i registri di Home Assistant per i dettagli.",
|
||||
"cloud_course_name_duplicate": "Due cicli hanno lo stesso nome. I nomi devono essere univoci.",
|
||||
"cloud_course_unknown_course": "Quel programma non è tra quelli offerti da questo dispositivo. Selezionarne uno dall'elenco."
|
||||
},
|
||||
"abort": {
|
||||
"not_loaded": "Questo dispositivo non è ancora connesso. Riprova dopo il caricamento."
|
||||
},
|
||||
"progress": {
|
||||
"cloud_wait": "Selezionare ora un ciclo scaricato sul dispositivo.\n\nAssegnati finora ({named} di {total}): {named_list}\n\nÈ possibile chiudere questa finestra in qualsiasi momento — i nomi vengono salvati man mano."
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"device_gap": {
|
||||
"title": "Copertura delle funzionalità incompleta per {device_name}",
|
||||
"description": "Questo dispositivo non è completamente supportato. Il tipo di dispositivo non è stato riconosciuto oppure alcune delle risorse che espone non sono ancora state modellate. Continuerò a funzionare con le funzionalità già supportate. Puoi contribuire ad ampliare il supporto andando su Impostazioni > Dispositivi e servizi > {device_name} > il menu (in alto a destra) > Scarica diagnostica, quindi inviando una segnalazione tramite il modulo di segnalazione collegato."
|
||||
},
|
||||
"cloud_courses_undiscovered": {
|
||||
"title": "Cicli scaricati non configurati per {device_name}",
|
||||
"description": "{device_name} ha {pending} cicli scaricati su {total} che Home Assistant non può ancora offrire. Un ciclo scaricato può essere usato solo dopo che il dispositivo è stato rilevato con quel ciclo caricato ed è stato assegnato un nome.\n\nPer configurarli, andare su Impostazioni > Dispositivi e servizi > LocalThings > {device_name} > Configura > Cicli scaricati e seguire le istruzioni presenti lì."
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
@@ -1424,6 +1597,9 @@
|
||||
"command_failed": {
|
||||
"message": "Il comando per {href} è fallito anche dopo la riconnessione: {error}"
|
||||
},
|
||||
"debug_read_failed": {
|
||||
"message": "La lettura da {href} è fallita: {error}"
|
||||
},
|
||||
"debug_too_many_writes": {
|
||||
"message": "Specificare da 1 a 10 scritture."
|
||||
},
|
||||
|
||||
@@ -108,6 +108,9 @@
|
||||
},
|
||||
"softener_low": {
|
||||
"name": "섬유유연제 부족"
|
||||
},
|
||||
"stick_ble_connected": {
|
||||
"name": "스틱 BLE 연결됨"
|
||||
}
|
||||
},
|
||||
"button": {
|
||||
@@ -225,6 +228,9 @@
|
||||
"air_filter_threshold": {
|
||||
"name": "필터 알림 기준"
|
||||
},
|
||||
"auto_door_timer": {
|
||||
"name": "오토 오픈 도어 타이머"
|
||||
},
|
||||
"beverage_zone_mode": {
|
||||
"name": "음료 보관 모드",
|
||||
"state": {
|
||||
@@ -255,7 +261,11 @@
|
||||
"name": "부저음",
|
||||
"state": {
|
||||
"off": "끄기",
|
||||
"on": "켜기"
|
||||
"on": "켜기",
|
||||
"volume_off": "끔",
|
||||
"volume_low": "낮음",
|
||||
"volume_med": "중간",
|
||||
"volume_high": "높음"
|
||||
}
|
||||
},
|
||||
"discharging_time": {
|
||||
@@ -297,7 +307,16 @@
|
||||
"07": "애벌 세척",
|
||||
"8d": "냄비 및 팬",
|
||||
"8e": "플라스틱",
|
||||
"8f": "젖병 살균"
|
||||
"8f": "젖병 살균",
|
||||
"82": "자동",
|
||||
"8a": "표준",
|
||||
"a7": "강력",
|
||||
"a8": "급속",
|
||||
"8c": "저소음",
|
||||
"88": "내부 세척",
|
||||
"85": "섬세",
|
||||
"0c": "급속",
|
||||
"0d": "내부 세척"
|
||||
}
|
||||
},
|
||||
"dispense_type": {
|
||||
@@ -312,6 +331,22 @@
|
||||
"4": "알림음 4"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_00": {
|
||||
"name": "코스",
|
||||
"state": {
|
||||
"01": "표준건조",
|
||||
"9c": "강력건조",
|
||||
"a5": "이불",
|
||||
"9e": "구김방지",
|
||||
"9b": "스팀살균+",
|
||||
"27": "리프레시",
|
||||
"a0": "송풍",
|
||||
"a4": "시간건조",
|
||||
"a6": "쾌속건조",
|
||||
"a3": "운동복",
|
||||
"a2": "섬세의류"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_03": {
|
||||
"name": "코스",
|
||||
"state": {
|
||||
@@ -339,7 +374,9 @@
|
||||
"4c": "에어 리프레시",
|
||||
"51": "에코 면",
|
||||
"53": "AI 맞춤건조+",
|
||||
"4e": "자체 건조"
|
||||
"4e": "자체 건조",
|
||||
"26": "송풍",
|
||||
"2a": "살균건조+"
|
||||
}
|
||||
},
|
||||
"favorite_capacity": {
|
||||
@@ -461,9 +498,11 @@
|
||||
"kimchi_storage_crunfch": "아삭 김치",
|
||||
"kimchi_storage_buy": "구입 김치",
|
||||
"storage_fridge_normal": "냉장",
|
||||
"storage_fridge": "냉장",
|
||||
"storage_fridge_cold": "냉장 강",
|
||||
"storage_fridge_warm": "냉장 약",
|
||||
"storage_freezer_normal": "냉동",
|
||||
"storage_freezer": "냉동",
|
||||
"storage_freezer_cold": "냉동 강",
|
||||
"storage_freezer_warm": "냉동 약",
|
||||
"kimchi_ripe_low_temp": "김치 저온 숙성",
|
||||
@@ -476,7 +515,8 @@
|
||||
"storage_fresh_cereal": "곡류",
|
||||
"storage_fridge_drink": "음료",
|
||||
"storage_fresh_wine": "와인",
|
||||
"storage_fresh_potato_banana": "감자 및 바나나"
|
||||
"storage_fresh_potato_banana": "감자 및 바나나",
|
||||
"newmode_kimchi_0000": "새 모드"
|
||||
}
|
||||
},
|
||||
"pantry_zone_mode": {
|
||||
@@ -487,6 +527,16 @@
|
||||
"fdr_drinks": "음료"
|
||||
}
|
||||
},
|
||||
"winecellar_pantry_zone_mode": {
|
||||
"name": "팬트리실 모드",
|
||||
"state": {
|
||||
"processed_meat": "가공육",
|
||||
"cheese": "치즈",
|
||||
"nuts": "견과류",
|
||||
"fruit": "과일",
|
||||
"wine": "와인"
|
||||
}
|
||||
},
|
||||
"range_burner_power_level": {
|
||||
"name": "{number}번 화구 화력",
|
||||
"state": {
|
||||
@@ -577,11 +627,30 @@
|
||||
"extra_hot": "고온수"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_00": {
|
||||
"name": "코스",
|
||||
"state": {
|
||||
"01": "표준세탁",
|
||||
"70": "강력세탁",
|
||||
"55": "흰옷",
|
||||
"71": "이불",
|
||||
"72": "살균",
|
||||
"77": "구김방지",
|
||||
"57": "통세척+",
|
||||
"73": "헹굼+탈수",
|
||||
"74": "운동복",
|
||||
"75": "섬세의류",
|
||||
"78": "쾌속세탁"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_02": {
|
||||
"name": "코스",
|
||||
"state": {
|
||||
"01": "표준세탁",
|
||||
"04": "쾌속세탁",
|
||||
"06": "XXL 세탁",
|
||||
"08": "헹굼+탈수",
|
||||
"0a": "타월",
|
||||
"17": "다운로드 코스",
|
||||
"1b": "면",
|
||||
"1c": "에코 40-60",
|
||||
@@ -592,7 +661,7 @@
|
||||
"21": "컬러 의류",
|
||||
"22": "울",
|
||||
"23": "아웃도어",
|
||||
"24": "타월",
|
||||
"24": "이불",
|
||||
"25": "합성섬유",
|
||||
"26": "섬세의류",
|
||||
"27": "헹굼+탈수",
|
||||
@@ -605,7 +674,7 @@
|
||||
"2f": "피트니스",
|
||||
"30": "흐린 날",
|
||||
"32": "셔츠",
|
||||
"33": "이불",
|
||||
"33": "타월",
|
||||
"34": "혼합",
|
||||
"36": "세탁+건조",
|
||||
"37": "에어워시",
|
||||
@@ -628,7 +697,28 @@
|
||||
"86": "찌든 때 세탁",
|
||||
"87": "다운로드",
|
||||
"8f": "강력 냉수 세탁",
|
||||
"96": "미세플라스틱저감"
|
||||
"96": "미세플라스틱저감",
|
||||
"a0": "15분 쾌속세탁",
|
||||
"b0": "혼합 세탁",
|
||||
"69": "AI 맞춤세탁",
|
||||
"6a": "울",
|
||||
"6b": "데님",
|
||||
"6c": "블라우스",
|
||||
"6d": "섬세의류",
|
||||
"6e": "운동복",
|
||||
"6f": "이불",
|
||||
"70": "타월",
|
||||
"71": "쾌속세탁",
|
||||
"72": "셔츠",
|
||||
"73": "살균",
|
||||
"74": "무세제통세척",
|
||||
"75": "아웃도어",
|
||||
"76": "아기옷",
|
||||
"77": "면",
|
||||
"78": "헹굼+탈수",
|
||||
"79": "탈수만",
|
||||
"88": "펫케어",
|
||||
"35": "에코 면"
|
||||
}
|
||||
},
|
||||
"washer_dry_level": {
|
||||
@@ -715,6 +805,9 @@
|
||||
"air_filter_usage_hours": {
|
||||
"name": "필터 사용 시간"
|
||||
},
|
||||
"deodor_filter_usage": {
|
||||
"name": "필터 사용량"
|
||||
},
|
||||
"air_quality_standard": {
|
||||
"name": "공기질 기준"
|
||||
},
|
||||
@@ -788,6 +881,12 @@
|
||||
"stick_status": {
|
||||
"name": "스틱 청소기 상태"
|
||||
},
|
||||
"stick_operation_mode": {
|
||||
"name": "스틱 작동 모드"
|
||||
},
|
||||
"stick_cleaning_status": {
|
||||
"name": "스틱 청소 상태"
|
||||
},
|
||||
"uvc_operation_time": {
|
||||
"name": "UV-C 작동 시간"
|
||||
},
|
||||
@@ -835,10 +934,16 @@
|
||||
"name": "온도"
|
||||
},
|
||||
"diagnosis": {
|
||||
"name": "진단"
|
||||
"name": "진단",
|
||||
"state": {
|
||||
"ready": "준비됨"
|
||||
}
|
||||
},
|
||||
"diagnosis_status": {
|
||||
"name": "진단 상태"
|
||||
"name": "진단 상태",
|
||||
"state": {
|
||||
"ready": "준비됨"
|
||||
}
|
||||
},
|
||||
"drum_clean_cycles_remaining": {
|
||||
"name": "통세척까지 남은 횟수"
|
||||
@@ -853,7 +958,10 @@
|
||||
"name": "건조 시간"
|
||||
},
|
||||
"dryer_type": {
|
||||
"name": "건조기 유형"
|
||||
"name": "건조기 유형",
|
||||
"state": {
|
||||
"electricity": "전기"
|
||||
}
|
||||
},
|
||||
"dust": {
|
||||
"name": "미세먼지"
|
||||
@@ -982,7 +1090,22 @@
|
||||
"name": "탐침 온도계 현재 온도"
|
||||
},
|
||||
"progress": {
|
||||
"name": "진행률"
|
||||
"name": "진행률",
|
||||
"state": {
|
||||
"idle": "대기",
|
||||
"weightsensing": "세탁물 감지",
|
||||
"wash": "세탁",
|
||||
"rinse": "헹굼",
|
||||
"spin": "탈수",
|
||||
"finish": "완료",
|
||||
"steaming": "스팀",
|
||||
"airwashing": "에어워시",
|
||||
"drying": "건조",
|
||||
"dryingwithdooropen": "환기",
|
||||
"cooling": "냉각",
|
||||
"predrain": "사전 배수",
|
||||
"prewash": "애벌빨래"
|
||||
}
|
||||
},
|
||||
"progress_percentage": {
|
||||
"name": "진행률"
|
||||
@@ -1117,6 +1240,12 @@
|
||||
"auto_door_opener": {
|
||||
"name": "오토 오픈 도어"
|
||||
},
|
||||
"auto_door_sound_control": {
|
||||
"name": "오토 오픈 도어 소리"
|
||||
},
|
||||
"auto_door_voice_control": {
|
||||
"name": "오토 오픈 도어 음성 안내"
|
||||
},
|
||||
"auto_release_dry": {
|
||||
"name": "자동 문 열림 건조"
|
||||
},
|
||||
@@ -1348,6 +1477,7 @@
|
||||
"title": "LocalThings 옵션",
|
||||
"menu_options": {
|
||||
"settings": "기기 설정",
|
||||
"cloud_courses": "다운로드 코스",
|
||||
"forget_learned_modes": "기억된 모드 지우기",
|
||||
"debug_write": "디버그: 리소스에 쓰기"
|
||||
}
|
||||
@@ -1386,20 +1516,63 @@
|
||||
"debug_write": "다른 리소스에 쓰기",
|
||||
"finish": "완료"
|
||||
}
|
||||
},
|
||||
"cloud_manual": {
|
||||
"title": "다운로드 코스",
|
||||
"description": "이 기기는 다운로드한 코스를 {total}개 보고하며, 지금까지 {found}개를 확인했습니다.\n\n다운로드한 코스의 설정은 해당 코스가 로드되어 있는 동안에만 확인할 수 있고, 기기는 그 이름을 전달하지 않습니다. 누락된 항목({pending}개)을 추가하려면 기기에서 다운로드 코스를 선택한 다음, 다운로드된 프로그램을 하나씩 차례로 실행하면서 몇 초씩 머무른 뒤 이 화면으로 돌아오세요.\n\n각 코스에 Home Assistant에서 보고 싶은 이름을 입력하세요. 이름을 비워 두면 해당 코스는 코스 목록에서 제외됩니다. 이름은 서로 달라야 합니다.\n\n다운로드 코스는 이 기기에서 다운로드된 프로그램을 실행하는 코스입니다. 자동으로 감지되지만 사용하기 전에 여기서 확인하세요. 다운로드한 코스를 선택하면 이 코스 코드가 기기에 기록됩니다.",
|
||||
"data": {
|
||||
"download_course": "다운로드 코스 코드"
|
||||
}
|
||||
},
|
||||
"cloud_courses": {
|
||||
"title": "다운로드 코스",
|
||||
"description": "안내 설정은 기기와 함께 진행됩니다. 기기에서 다운로드한 코스를 선택하고, 코스가 확인될 때마다 하나씩 이름을 지정하세요.\n\n이름 편집은 지금까지 찾은 모든 코스를 한 번에 보여줍니다. 나중에 이름을 바꾸거나 수정할 때 사용하세요.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "안내 설정",
|
||||
"cloud_manual": "이름 편집"
|
||||
}
|
||||
},
|
||||
"cloud_wait": {
|
||||
"title": "다운로드 코스"
|
||||
},
|
||||
"cloud_name": {
|
||||
"title": "이 코스 이름 지정",
|
||||
"description": "기기가 다운로드한 코스(슬롯 {slot})로 전환되었으며 {remaining} 남았다고 표시됩니다.\n\nHome Assistant에서 보고 싶은 이름을 입력한 다음, 기기에서 다음 코스를 선택하세요. 비워 두면 이 코스는 목록에서 제외됩니다.\n\n지금까지 이름 지정됨 ({named}/{total}개): {named_list}\n\n이름은 서로 달라야 합니다. 이 창은 언제든지 닫을 수 있습니다. 이름은 진행하는 대로 저장됩니다.",
|
||||
"data": {
|
||||
"name": "이름",
|
||||
"download_course": "다운로드 코스 코드"
|
||||
}
|
||||
},
|
||||
"cloud_timeout": {
|
||||
"title": "선택된 코스 없음",
|
||||
"description": "기기에서 아무것도 선택되지 않았습니다. 다운로드 코스로 설정되어 있는지 확인한 다음, 다운로드된 프로그램을 하나씩 실행해 보세요.\n\n지금까지 이름 지정됨 ({named}/{total}개): {named_list}\n\n지금까지 이름을 지정한 항목은 이미 저장되었습니다.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "다시 대기",
|
||||
"cloud_finish": "완료"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"empty_payload": "쓸 필드를 하나 이상 입력하세요.",
|
||||
"write_failed": "쓰기에 실패했습니다. 자세한 내용은 Home Assistant 로그에서 확인하세요."
|
||||
"write_failed": "쓰기에 실패했습니다. 자세한 내용은 Home Assistant 로그에서 확인하세요.",
|
||||
"cloud_course_name_duplicate": "두 코스의 이름이 같습니다. 이름은 서로 달라야 합니다.",
|
||||
"cloud_course_unknown_course": "이 기기가 제공하지 않는 코스입니다. 목록에서 선택하세요."
|
||||
},
|
||||
"abort": {
|
||||
"not_loaded": "이 기기는 아직 연결되지 않았습니다. 기기를 불러온 후 다시 시도하세요."
|
||||
},
|
||||
"progress": {
|
||||
"cloud_wait": "지금 기기에서 다운로드한 코스를 선택하세요.\n\n지금까지 이름 지정됨 ({named}/{total}개): {named_list}\n\n이 창은 언제든지 닫을 수 있습니다. 이름은 진행하는 대로 저장됩니다."
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"device_gap": {
|
||||
"title": "{device_name}의 기능 지원이 완전하지 않음",
|
||||
"description": "이 기기의 일부 기능이 아직 완전히 지원되지 않습니다. 가전제품 유형이 인식되지 않았거나, 기기가 제공하는 일부 리소스가 아직 구현되지 않았습니다. 현재 지원되는 기능은 계속 사용할 수 있습니다. 설정 > 기기 및 서비스 > {device_name} > 오른쪽 위 메뉴 > 진단 정보 다운로드로 이동하여 진단 정보를 내려받은 뒤, 연결된 이슈 양식에 첨부하면 지원 범위를 넓히는 데 도움을 줄 수 있습니다."
|
||||
},
|
||||
"cloud_courses_undiscovered": {
|
||||
"title": "{device_name}의 다운로드 코스가 설정되지 않음",
|
||||
"description": "{device_name}에는 Home Assistant가 아직 제공할 수 없는 다운로드한 코스가 {total}개 중 {pending}개 있습니다. 다운로드한 코스는 기기에서 해당 코스가 로드된 상태로 확인되고 이름을 지정한 후에만 사용할 수 있습니다.\n\n설정하려면 설정 > 기기 및 서비스 > LocalThings > {device_name} > 구성 > 다운로드 코스로 이동하여 안내를 따르세요."
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
@@ -1424,6 +1597,9 @@
|
||||
"command_failed": {
|
||||
"message": "재연결 후에도 {href} 명령이 실패했습니다: {error}"
|
||||
},
|
||||
"debug_read_failed": {
|
||||
"message": "{href}에서 읽기가 실패했습니다: {error}"
|
||||
},
|
||||
"debug_too_many_writes": {
|
||||
"message": "1~10개의 쓰기를 지정하세요."
|
||||
},
|
||||
|
||||
@@ -108,6 +108,9 @@
|
||||
},
|
||||
"softener_low": {
|
||||
"name": "Wasverzachter bijna op"
|
||||
},
|
||||
"stick_ble_connected": {
|
||||
"name": "Steel via BLE verbonden"
|
||||
}
|
||||
},
|
||||
"button": {
|
||||
@@ -225,6 +228,9 @@
|
||||
"air_filter_threshold": {
|
||||
"name": "Filteralarmdrempel"
|
||||
},
|
||||
"auto_door_timer": {
|
||||
"name": "Timer automatische deuropener"
|
||||
},
|
||||
"beverage_zone_mode": {
|
||||
"name": "Modus drankenzone",
|
||||
"state": {
|
||||
@@ -255,7 +261,11 @@
|
||||
"name": "Zoemergeluid",
|
||||
"state": {
|
||||
"off": "Uit",
|
||||
"on": "Aan"
|
||||
"on": "Aan",
|
||||
"volume_off": "Uit",
|
||||
"volume_low": "Laag",
|
||||
"volume_med": "Gemiddeld",
|
||||
"volume_high": "Hoog"
|
||||
}
|
||||
},
|
||||
"discharging_time": {
|
||||
@@ -297,7 +307,16 @@
|
||||
"07": "Voorspoelen",
|
||||
"8d": "Potten en pannen",
|
||||
"8e": "Kunststof",
|
||||
"8f": "Babyverzorging"
|
||||
"8f": "Babyverzorging",
|
||||
"82": "Auto",
|
||||
"8a": "Normaal",
|
||||
"a7": "Intensief",
|
||||
"a8": "Express",
|
||||
"8c": "Extra stil",
|
||||
"88": "Zelfreiniging",
|
||||
"85": "Delicaat",
|
||||
"0c": "Express",
|
||||
"0d": "Zelfreiniging"
|
||||
}
|
||||
},
|
||||
"dispense_type": {
|
||||
@@ -312,6 +331,22 @@
|
||||
"4": "Alarm 4"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_00": {
|
||||
"name": "Programma",
|
||||
"state": {
|
||||
"01": "Normaal",
|
||||
"9c": "Intensief",
|
||||
"a5": "Beddengoed",
|
||||
"9e": "Strijkvrij",
|
||||
"9b": "Stoomhygiëne+",
|
||||
"27": "Opfrissen",
|
||||
"a0": "Luchtdrogen",
|
||||
"a4": "Tijdprogramma",
|
||||
"a6": "Snel drogen",
|
||||
"a3": "Sportkleding",
|
||||
"a2": "Fijne was"
|
||||
}
|
||||
},
|
||||
"dryer_cycle_table_03": {
|
||||
"name": "Programma",
|
||||
"state": {
|
||||
@@ -339,7 +374,9 @@
|
||||
"4c": "Opfrissen",
|
||||
"51": "Eco katoen",
|
||||
"53": "AI drogen+",
|
||||
"4e": "Zelf drogen"
|
||||
"4e": "Zelf drogen",
|
||||
"26": "Luchtverfrissing",
|
||||
"2a": "Hygiënische verzorging+"
|
||||
}
|
||||
},
|
||||
"favorite_capacity": {
|
||||
@@ -461,9 +498,11 @@
|
||||
"kimchi_storage_crunfch": "Knapperige kimchi",
|
||||
"kimchi_storage_buy": "Gekochte kimchi",
|
||||
"storage_fridge_normal": "Koelkast",
|
||||
"storage_fridge": "Koelkast",
|
||||
"storage_fridge_cold": "Koelkast, sterk",
|
||||
"storage_fridge_warm": "Koelkast, zwak",
|
||||
"storage_freezer_normal": "Vriezer",
|
||||
"storage_freezer": "Vriezer",
|
||||
"storage_freezer_cold": "Vriezer, sterk",
|
||||
"storage_freezer_warm": "Vriezer, zwak",
|
||||
"kimchi_ripe_low_temp": "Kimchi rijpen, lage temperatuur",
|
||||
@@ -476,7 +515,8 @@
|
||||
"storage_fresh_cereal": "Granen",
|
||||
"storage_fridge_drink": "Dranken",
|
||||
"storage_fresh_wine": "Wijn",
|
||||
"storage_fresh_potato_banana": "Aardappelen en bananen"
|
||||
"storage_fresh_potato_banana": "Aardappelen en bananen",
|
||||
"newmode_kimchi_0000": "Nieuwe modus"
|
||||
}
|
||||
},
|
||||
"pantry_zone_mode": {
|
||||
@@ -487,6 +527,16 @@
|
||||
"fdr_drinks": "Dranken"
|
||||
}
|
||||
},
|
||||
"winecellar_pantry_zone_mode": {
|
||||
"name": "Modus voorraadzone",
|
||||
"state": {
|
||||
"processed_meat": "Vleeswaren",
|
||||
"cheese": "Kaas",
|
||||
"nuts": "Noten",
|
||||
"fruit": "Fruit",
|
||||
"wine": "Wijn"
|
||||
}
|
||||
},
|
||||
"range_burner_power_level": {
|
||||
"name": "Vermogensniveau brander {number}",
|
||||
"state": {
|
||||
@@ -577,11 +627,30 @@
|
||||
"extra_hot": "Extra heet"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_00": {
|
||||
"name": "Programma",
|
||||
"state": {
|
||||
"01": "Normaal",
|
||||
"70": "Intensief",
|
||||
"55": "Witte was",
|
||||
"71": "Beddengoed",
|
||||
"72": "Hygiëne",
|
||||
"77": "Strijkvrij",
|
||||
"57": "Self Clean+",
|
||||
"73": "Spoelen + centrifugeren",
|
||||
"74": "Sportkleding",
|
||||
"75": "Fijne was",
|
||||
"78": "Snelle was"
|
||||
}
|
||||
},
|
||||
"washer_cycle_table_02": {
|
||||
"name": "Programma",
|
||||
"state": {
|
||||
"01": "Normaal",
|
||||
"04": "Snelle was",
|
||||
"06": "XXL was",
|
||||
"08": "Spoelen+centrifugeren",
|
||||
"0a": "Handdoeken",
|
||||
"17": "Gedownload",
|
||||
"1b": "Katoen",
|
||||
"1c": "Eco 40-60",
|
||||
@@ -592,7 +661,7 @@
|
||||
"21": "Bonte was",
|
||||
"22": "Wol",
|
||||
"23": "Outdoor",
|
||||
"24": "Handdoeken",
|
||||
"24": "Beddengoed",
|
||||
"25": "Synthetisch",
|
||||
"26": "Fijne was",
|
||||
"27": "Spoelen+centrifugeren",
|
||||
@@ -605,7 +674,7 @@
|
||||
"2f": "Sportkleding",
|
||||
"30": "Bewolkte dag",
|
||||
"32": "Overhemden",
|
||||
"33": "Beddengoed",
|
||||
"33": "Handdoeken",
|
||||
"34": "Gemengd",
|
||||
"36": "Wassen+drogen",
|
||||
"37": "Air Wash",
|
||||
@@ -621,14 +690,35 @@
|
||||
"60": "Self Clean+",
|
||||
"65": "Bonte was",
|
||||
"66": "Spijkergoed",
|
||||
"69": "AI wassen",
|
||||
"6a": "Wol",
|
||||
"6b": "Spijkergoed",
|
||||
"6c": "Blouses",
|
||||
"6d": "Fijne was",
|
||||
"6e": "Sportkleding",
|
||||
"6f": "Beddengoed",
|
||||
"70": "Handdoeken",
|
||||
"71": "Snelle was",
|
||||
"72": "Overhemden",
|
||||
"73": "Hygiëne",
|
||||
"74": "Trommel reinigen",
|
||||
"75": "Outdoor",
|
||||
"76": "Babyverzorging",
|
||||
"77": "Katoen",
|
||||
"78": "Spoelen + centrifugeren",
|
||||
"79": "Alleen centrifugeren",
|
||||
"7c": "Witte was",
|
||||
"7d": "Beddengoed/waterdicht",
|
||||
"7e": "Self Clean",
|
||||
"7f": "Wol/fijne was",
|
||||
"86": "Diep wassen",
|
||||
"87": "Gedownload",
|
||||
"88": "Huisdierverzorging",
|
||||
"8f": "Intensief koud",
|
||||
"96": "Minder microvezels"
|
||||
"96": "Minder microvezels",
|
||||
"a0": "15' Snelle was",
|
||||
"b0": "Gemengde was",
|
||||
"35": "Eco katoen"
|
||||
}
|
||||
},
|
||||
"washer_dry_level": {
|
||||
@@ -715,6 +805,9 @@
|
||||
"air_filter_usage_hours": {
|
||||
"name": "Filterverbruik (uren)"
|
||||
},
|
||||
"deodor_filter_usage": {
|
||||
"name": "Filterverbruik"
|
||||
},
|
||||
"air_quality_standard": {
|
||||
"name": "Luchtkwaliteitsnorm"
|
||||
},
|
||||
@@ -788,6 +881,12 @@
|
||||
"stick_status": {
|
||||
"name": "Status steel"
|
||||
},
|
||||
"stick_operation_mode": {
|
||||
"name": "Bedieningsmodus steel"
|
||||
},
|
||||
"stick_cleaning_status": {
|
||||
"name": "Schoonmaakstatus steel"
|
||||
},
|
||||
"uvc_operation_time": {
|
||||
"name": "UV-C-bedrijfstijd"
|
||||
},
|
||||
@@ -835,10 +934,16 @@
|
||||
"name": "Temperatuur"
|
||||
},
|
||||
"diagnosis": {
|
||||
"name": "Diagnose"
|
||||
"name": "Diagnose",
|
||||
"state": {
|
||||
"ready": "Gereed"
|
||||
}
|
||||
},
|
||||
"diagnosis_status": {
|
||||
"name": "Diagnosestatus"
|
||||
"name": "Diagnosestatus",
|
||||
"state": {
|
||||
"ready": "Gereed"
|
||||
}
|
||||
},
|
||||
"drum_clean_cycles_remaining": {
|
||||
"name": "Trommelreiniging over"
|
||||
@@ -853,7 +958,10 @@
|
||||
"name": "Droogtijd"
|
||||
},
|
||||
"dryer_type": {
|
||||
"name": "Type droger"
|
||||
"name": "Type droger",
|
||||
"state": {
|
||||
"electricity": "Elektriciteit"
|
||||
}
|
||||
},
|
||||
"dust": {
|
||||
"name": "Stof"
|
||||
@@ -982,7 +1090,22 @@
|
||||
"name": "Sondetemperatuur"
|
||||
},
|
||||
"progress": {
|
||||
"name": "Voortgang"
|
||||
"name": "Voortgang",
|
||||
"state": {
|
||||
"idle": "Inactief",
|
||||
"weightsensing": "Beladingsdetectie",
|
||||
"wash": "Wassen",
|
||||
"rinse": "Spoelen",
|
||||
"spin": "Centrifugeren",
|
||||
"finish": "Voltooid",
|
||||
"steaming": "Stomen",
|
||||
"airwashing": "Luchtreiniging",
|
||||
"drying": "Drogen",
|
||||
"dryingwithdooropen": "Ventileren",
|
||||
"cooling": "Koelen",
|
||||
"predrain": "Vooraf afpompen",
|
||||
"prewash": "Voorwas"
|
||||
}
|
||||
},
|
||||
"progress_percentage": {
|
||||
"name": "Voortgangspercentage"
|
||||
@@ -1117,6 +1240,12 @@
|
||||
"auto_door_opener": {
|
||||
"name": "Automatische deuropener"
|
||||
},
|
||||
"auto_door_sound_control": {
|
||||
"name": "Geluid automatische deuropener"
|
||||
},
|
||||
"auto_door_voice_control": {
|
||||
"name": "Spraakbediening automatische deuropener"
|
||||
},
|
||||
"auto_release_dry": {
|
||||
"name": "Auto Release Dry"
|
||||
},
|
||||
@@ -1348,6 +1477,7 @@
|
||||
"title": "LocalThings-opties",
|
||||
"menu_options": {
|
||||
"settings": "Apparaatinstellingen",
|
||||
"cloud_courses": "Gedownloade programma's",
|
||||
"forget_learned_modes": "Onthouden modi vergeten",
|
||||
"debug_write": "Foutopsporing: naar een resource schrijven"
|
||||
}
|
||||
@@ -1386,20 +1516,63 @@
|
||||
"debug_write": "Naar een andere resource schrijven",
|
||||
"finish": "Voltooien"
|
||||
}
|
||||
},
|
||||
"cloud_manual": {
|
||||
"title": "Gedownloade programma's",
|
||||
"description": "Dit apparaat meldt {total} gedownloade programma's; {found} daarvan zijn tot nu toe gezien.\n\nDe instellingen van een gedownload programma zijn alleen zichtbaar zolang dat programma geladen is, en het apparaat meldt nooit de naam ervan. Om de ontbrekende ({pending}) toe te voegen: selecteer op het apparaat het programma \"Gedownload\", doorloop dan elk gedownload programma na elkaar, pauzeer bij elk een paar seconden, en kom hierna terug.\n\nGeef elk programma de naam die je in Home Assistant wilt zien. Laat een naam leeg om dat programma buiten de programmalijst te houden. Namen moeten uniek zijn.\n\nHet programma \"Gedownload\" is het programma op dit apparaat dat een gedownload programma uitvoert. Het wordt automatisch gedetecteerd, maar bevestig dit hier voor gebruik: als je een gedownload programma selecteert, wordt deze programmacode naar het apparaat geschreven.",
|
||||
"data": {
|
||||
"download_course": "Programmacode van \"Gedownload\""
|
||||
}
|
||||
},
|
||||
"cloud_courses": {
|
||||
"title": "Gedownloade programma's",
|
||||
"description": "Begeleide installatie loodst je stap voor stap langs het apparaat: selecteer op het apparaat een gedownload programma en geef het een naam zodra het gevonden is, één voor één.\n\nNamen bewerken toont in één keer alles wat tot nu toe is gevonden — gebruik dit later om iets te hernoemen of te corrigeren.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "Begeleide installatie",
|
||||
"cloud_manual": "Namen bewerken"
|
||||
}
|
||||
},
|
||||
"cloud_wait": {
|
||||
"title": "Gedownloade programma's"
|
||||
},
|
||||
"cloud_name": {
|
||||
"title": "Geef dit programma een naam",
|
||||
"description": "Het apparaat is overgeschakeld naar een gedownload programma (slot {slot}) en meldt nog {remaining} resterend.\n\nGeef het de naam die je in Home Assistant wilt zien en selecteer daarna het volgende op het apparaat. Laat het veld leeg om dit programma buiten de lijst te houden.\n\nTot nu toe benoemd ({named} van {total}): {named_list}\n\nNamen moeten uniek zijn. Je kunt dit venster op elk moment sluiten — namen worden onderweg opgeslagen.",
|
||||
"data": {
|
||||
"name": "Naam",
|
||||
"download_course": "Programmacode van \"Gedownload\""
|
||||
}
|
||||
},
|
||||
"cloud_timeout": {
|
||||
"title": "Geen programma geselecteerd",
|
||||
"description": "Er is niets geselecteerd op het apparaat. Zorg dat het is ingesteld op het programma \"Gedownload\" en doorloop dan de gedownloade programma's.\n\nTot nu toe benoemd ({named} van {total}): {named_list}\n\nAlles wat tot nu toe benoemd is, is al opgeslagen.",
|
||||
"menu_options": {
|
||||
"cloud_guided": "Opnieuw wachten",
|
||||
"cloud_finish": "Voltooien"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"empty_payload": "Voer ten minste één veld in om te schrijven.",
|
||||
"write_failed": "De schrijfbewerking is mislukt. Raadpleeg de Home Assistant-logboeken voor meer informatie."
|
||||
"write_failed": "De schrijfbewerking is mislukt. Raadpleeg de Home Assistant-logboeken voor meer informatie.",
|
||||
"cloud_course_name_duplicate": "Twee programma's hebben dezelfde naam. Namen moeten uniek zijn.",
|
||||
"cloud_course_unknown_course": "Dat programma biedt dit apparaat niet aan. Kies er een uit de lijst."
|
||||
},
|
||||
"abort": {
|
||||
"not_loaded": "Dit apparaat is nog niet verbonden. Probeer het opnieuw zodra het is geladen."
|
||||
},
|
||||
"progress": {
|
||||
"cloud_wait": "Selecteer nu een gedownload programma op het apparaat.\n\nTot nu toe benoemd ({named} van {total}): {named_list}\n\nJe kunt dit venster op elk moment sluiten — namen worden onderweg opgeslagen."
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"device_gap": {
|
||||
"title": "Onvolledige ondersteuning van mogelijkheden voor {device_name}",
|
||||
"description": "Niet alle mogelijkheden van dit apparaat worden ondersteund. Het apparaattype is niet herkend of sommige beschikbare resources zijn nog niet gemodelleerd. Het apparaat blijft werken met de mogelijkheden die al worden ondersteund. Je kunt helpen de ondersteuning uit te breiden: ga naar Instellingen > Apparaten & diensten > {device_name} > het menu (rechtsboven) > Diagnostische gegevens downloaden en voeg het bestand daarna bij via de gekoppelde issue-template."
|
||||
},
|
||||
"cloud_courses_undiscovered": {
|
||||
"title": "Gedownloade programma's niet ingesteld voor {device_name}",
|
||||
"description": "{device_name} heeft {pending} van de {total} gedownloade programma's die Home Assistant nog niet kan aanbieden. Een gedownload programma kan pas worden gebruikt zodra het apparaat ermee geladen is gezien en je het een naam hebt gegeven.\n\nGa om ze in te stellen naar Instellingen > Apparaten & diensten > LocalThings > {device_name} > Configureren > Gedownloade programma's en volg de instructies daar."
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
@@ -1424,6 +1597,9 @@
|
||||
"command_failed": {
|
||||
"message": "Het commando naar {href} is ook na opnieuw verbinden mislukt: {error}"
|
||||
},
|
||||
"debug_read_failed": {
|
||||
"message": "Het lezen van {href} is mislukt: {error}"
|
||||
},
|
||||
"debug_too_many_writes": {
|
||||
"message": "Geef tussen de 1 en 10 schrijfacties op."
|
||||
},
|
||||
|
||||
@@ -15,6 +15,12 @@ that follows them explains why the reset looked cloud-only for as long as it
|
||||
did — a genuine trap worth knowing about before the next reset-adjacent
|
||||
mystery on this board family.
|
||||
|
||||
Scope: all of the above applies to boards that carry the counter as a
|
||||
`FilterTime_<N>` option token on `/mode/vs/0`. Not every AC does. See
|
||||
"Boards with no `FilterTime` token" at the end for an `ARTIK051_PRAC_20K`
|
||||
that keeps the counter in its own resource, rejects both the token and a
|
||||
direct write, and has no local reset at all.
|
||||
|
||||
## What the reset actually is
|
||||
|
||||
A **command**, not a value write. Samsung's cloud models it as capability
|
||||
@@ -92,3 +98,72 @@ on every unit on record).
|
||||
The entity key stays `filter_time` rather than `filter_time_elapsed`:
|
||||
renaming it would change every existing unit's `entity_id`/`unique_id` for a
|
||||
wording improvement only.
|
||||
|
||||
## Boards with no `FilterTime` token (`ARTIK051_PRAC_20K`)
|
||||
|
||||
Negative result, measured 2026-08-11 on integration v0.21.0 / HA 2026.8.1,
|
||||
against one head of a three-head multi-split (`OptionCode_35880`,
|
||||
`ExtendOptionCode_199181`). **There is no local reset on this board**, by
|
||||
either route. Reset appears to be panel-only.
|
||||
|
||||
This generation does not put the counter in `/mode/vs/0` at all. Its
|
||||
options blob carries no `FilterTime`, no `FilterAlarmTime` and no
|
||||
`FilterCleanAlarm`:
|
||||
|
||||
```json
|
||||
["Sleep_0", "ArtificialWorking_Off", "ComfortAICooling_Off",
|
||||
"AiTempChanged_Off", "AiTemp_240", "OutdoorTemp_77", "CoolCapa_25",
|
||||
"WarmCapa_32", "Light_Off", "Volume_100", "OptionCode_35880",
|
||||
"ExtendOptionCode_199181", "RacInfo_None", "UpdateAllow_NotAllowed",
|
||||
"DurationOn_0", "WelcomeCoolingState_Off"]
|
||||
```
|
||||
|
||||
The counter lives in its own resource instead, as a **percentage** of a
|
||||
500-hour interval rather than tenths of an hour —
|
||||
`/filter/airdustfilter/vs/0`:
|
||||
|
||||
```json
|
||||
{
|
||||
"x.com.samsung.da.filterUsage": "96",
|
||||
"x.com.samsung.da.filterUsageResolution": "1",
|
||||
"x.com.samsung.da.filterDesiredUsage": "500",
|
||||
"x.com.samsung.da.filterStatus": "normal",
|
||||
"x.com.samsung.da.filterCapacity": "500",
|
||||
"x.com.samsung.da.filterCapacityUnit": "Hour",
|
||||
"x.com.samsung.da.filterResetType": ["replaceable", "washable"]
|
||||
}
|
||||
```
|
||||
|
||||
Three attempts, all against a live unit deliberately put in `fan_only`
|
||||
first — writes to a powered-off head on this board are dropped silently
|
||||
with no error, which would otherwise be indistinguishable from a rejected
|
||||
write:
|
||||
|
||||
| Target | Payload | Result |
|
||||
|---|---|---|
|
||||
| `/mode/vs/0` | `{"x.com.samsung.da.options": ["FilterCleanAlarm_Clear"]}` | 4.00, options blob byte-identical |
|
||||
| `/filter/airdustfilter/vs/0` | `{"x.com.samsung.da.filterUsage": "0"}` | 4.00 |
|
||||
| `/filter/airdustfilter/vs/0` | `{"x.com.samsung.da.filterUsage": 0}` (integer) | 5.00 |
|
||||
|
||||
`filterUsage` stayed at `96` throughout, verified by a live re-read after
|
||||
each write rather than by the integration's optimistic state.
|
||||
|
||||
The last two rows are the informative pair. They differ only in JSON type
|
||||
and return *different* codes, which rules out both boring explanations: an
|
||||
unresolved href or an unrecognised field name would fail identically. The
|
||||
board parses the field, faults on the wrong type, and still refuses the
|
||||
value when typed as the string its own rep uses. The resource is
|
||||
**read-only**, not mis-addressed.
|
||||
|
||||
One trap worth stating plainly: `filterResetType:
|
||||
["replaceable","washable"]` describes what the filter *is*, not a reset
|
||||
command that exists. It reads like a hint that a reset write is available
|
||||
somewhere. It is not.
|
||||
|
||||
Since the integration cannot perform the reset here, it can still observe
|
||||
it. The counter only climbs in normal use, so a downward crossing is
|
||||
unambiguous: a `numeric_state` trigger with `below: 10` on
|
||||
`sensor.<name>_filter_usage`, stamping an `input_datetime`, keeps an
|
||||
honest "last cleaned" date without pretending a reset entity exists. The
|
||||
blind spot is a reset performed while HA is down or the entry is
|
||||
unloaded — no state transition, so that stamp has to be set by hand.
|
||||
@@ -0,0 +1,184 @@
|
||||
# Composite AC subdevices: where else a sibling's hrefs could live
|
||||
|
||||
Open question behind issue #335 (`ARTIK051_FAC_BORA_19K`, a 2-in-1 floor +
|
||||
wall AC): the board reports a sibling in `/subdevices/vs/0`'s
|
||||
`subdeviceIdList`, but every seed `registry/subdevices.enumerate_subdevices`
|
||||
tries comes back 4.04, so `subdevices` and `subdevices_skipped` are both
|
||||
empty and the wall unit never becomes an entity.
|
||||
|
||||
This file records what that actually rules out (less than it looks like),
|
||||
why, and which hrefs are worth reading next.
|
||||
|
||||
## `/oic/res` does not enumerate the resource tree on modern firmware
|
||||
|
||||
This is the finding that reopens the question. Across every fixture that
|
||||
carries a captured `/oic/res`:
|
||||
|
||||
| board | links | `sec:true` | lists `/device/0`? |
|
||||
| --- | --- | --- | --- |
|
||||
| `ARTIK051_DONGLE_FAC_18K` | 91 | 78 | yes |
|
||||
| `TP2X_FAC_BORA_21K` (2-in-1) | 17 | 6 | no |
|
||||
| `TP2X_FAC_BORA_21K` (#205 flat) | 17 | 6 | no |
|
||||
| `TP1X_DA_KS_RANGE_0101X` | 10 | 6 | no |
|
||||
| `AWM-WW-AID-26-ONEBODY` | 15 | 9 | no |
|
||||
| `ARTIK051_FAC_BORA_19K` (#335) | 18 | 6 | no |
|
||||
|
||||
The `ARTIK051_DONGLE_FAC_18K` board — the one Pattern A was built against —
|
||||
is the outlier, not the model. Everywhere else `/oic/res` lists the
|
||||
onboarding surface and nothing else: `/oic/d`, `/oic/p`, the security and
|
||||
EasySetup/WiFiConf/CoapCloudConf/DevConf resources, file transfer, and the
|
||||
`sec/*` pair. On issue #335's board the six `sec:true` links are exactly
|
||||
doxm, pstat and the four setup URIs; every other listed link is `sec:false`.
|
||||
The entire secure operational tree — `/device/0` included, which
|
||||
demonstrably answers, since the dump comes from it — is absent.
|
||||
|
||||
Two consequences, both load-bearing:
|
||||
|
||||
1. **Nothing is learned from an href's absence in `/oic/res`.** On the range
|
||||
board (issue #324) `/oic/res` lists ten onboarding links and no
|
||||
`/device/0`, yet `/device/1` answers a full indexed dual-cavity sibling.
|
||||
It was found only by `_SPECULATIVE_DEVICE_INDICES`, never by enumeration
|
||||
of the links.
|
||||
2. **Pattern A's `/oic/res` index scan is dead weight on these boards.** It
|
||||
contributes nothing anywhere except the dongle board, so in practice
|
||||
indexed siblings are found by the speculative `/device/1`, `/device/2`
|
||||
probe alone.
|
||||
|
||||
## What issue #335 has actually ruled out
|
||||
|
||||
All 26 probes in the report returned false. Twenty-three of them are the
|
||||
issue #205 flat fallback walking the master's own href list under the
|
||||
sibling's UUID prefix, plus `/<uuid>/device/0`, `/device/1`, `/device/2`
|
||||
and `/multidevice/vs/0`. Four more were read by hand from the issue thread
|
||||
(`/<uuid>/information/vs/{1,2}`, `/<uuid>/device/{1,2}`), all 4.04.
|
||||
|
||||
So what is ruled out is: the UUID-prefixed namespace (Pattern B/C), and the
|
||||
indexed **Collection** (`/device/<n>`). What has never been read on this
|
||||
board — or on any `FAC_BORA` board — is **a bare indexed leaf**:
|
||||
`/mode/vs/1`, `/temperatures/vs/1`, and friends. Every indexed href ever
|
||||
probed by this project arrived via a `/device/<n>` batch; none was ever
|
||||
GETed directly.
|
||||
|
||||
That gap matters because the "leaves exist, their Collection does not" shape
|
||||
is already confirmed on this exact product family, just in the other
|
||||
namespace: issue #205's `TP2X_FAC_BORA_21K` answers
|
||||
`/<uuid>/information/vs/0` while `/<uuid>/device/0` comes back empty. A
|
||||
board that mounts sibling leaves without mounting a sibling Collection is
|
||||
the documented BORA behavior, so `/device/1`'s 4.04 is evidence about the
|
||||
Collection and not about `/mode/vs/1`.
|
||||
|
||||
## What the OCF spec says about composite devices
|
||||
|
||||
The Core/Device specifications model this as a *Composite Device*: one
|
||||
Platform representing the whole appliance, `/oic/d` carrying the Device
|
||||
Types of every constituent Device, and — the relevant part — a **Collection
|
||||
per distinct Device in the composition**, each Collection's `rt` including
|
||||
the Device Type it represents.
|
||||
|
||||
Issue #335's `/oic/d` reports `["oic.wk.d", "oic.d.airconditioner"]`, which
|
||||
is consistent with a two-indoor-unit composite (both constituents are air
|
||||
conditioners, so the type appears once) and equally consistent with a single
|
||||
unit. It does not discriminate.
|
||||
|
||||
The Collection half does suggest something untried. `x.com.samsung.devcol`
|
||||
is Samsung's Collection type, carried by `/device/0` — and on the dongle
|
||||
board `/oic/res` advertises a second resource with the same
|
||||
`["x.com.samsung.devcol", "oic.wk.col"]` pair: **`/sec/devices`**. A
|
||||
collection of devices, sitting alongside `/device/0`, never read by this
|
||||
project or by any issue thread. If the composite enumeration is exposed
|
||||
anywhere as a first-class resource, that is the shape it would take.
|
||||
|
||||
## Results of the second probe round
|
||||
|
||||
The reporter ran these live. Three answers, all informative.
|
||||
|
||||
**Indexed leaves do not exist.** `/information/vs/1`, `/power/vs/1`,
|
||||
`/mode/vs/1` → 4.04. Pattern A is ruled out on this board properly now:
|
||||
not just the `/device/1` Collection, but the leaf namespace it would have
|
||||
carried.
|
||||
|
||||
**The UUID prefix routes, and is empty of operational resources.** The
|
||||
control pair settles it:
|
||||
|
||||
/c24e25e9-.../file/list/vs/0 → 2.05, two items
|
||||
/file/list/vs/0 → 2.05, the same two items
|
||||
(/opt/data/energy.db, /opt/data/hass.db)
|
||||
|
||||
So the sibling's prefix is a live, routed namespace — the 23 flat-fallback
|
||||
4.04s under it are the firmware answering "no such resource", not a dead
|
||||
prefix swallowing everything. Pattern B/C is ruled out on this board on
|
||||
positive evidence rather than on absence. That the two listings are
|
||||
identical is expected either way: one board, one flash, one filesystem.
|
||||
|
||||
**`/sec/devices` exists — and this project could not see what's in it.**
|
||||
It answered `2.05` with `rep: {}`, which reads as "the resource is there and
|
||||
has nothing in it". It is not. `coordinator._raw_read_blocking` decoded the
|
||||
CBOR body and then kept it *only if it was a Property map*:
|
||||
|
||||
```python
|
||||
if isinstance(body, dict):
|
||||
rep = body
|
||||
```
|
||||
|
||||
A Collection answers a **list** — the `[devcol rep, {href, rep}, ...]` batch
|
||||
`parse_device0_batch` reads. `/device/0` itself would have rendered exactly
|
||||
the same accepted-but-empty `2.05 {}` through `read_resource`. Fixed: the
|
||||
read path now returns the decoded body alongside `rep`, and the service
|
||||
response carries it as `body` whenever it isn't the map already in `rep`.
|
||||
|
||||
`/sec/devices` therefore remains the one open lead, and needs one re-read on
|
||||
a build carrying that fix.
|
||||
|
||||
## Still worth reading
|
||||
|
||||
**1 — `/sec/devices`, again.** Same `x.com.samsung.devcol` + `oic.wk.col`
|
||||
pair as `/device/0`, so its body should be a batch naming its members. If a
|
||||
composite enumeration is exposed anywhere, it is here.
|
||||
|
||||
**2 — the file-transfer pair.** `/oic/res` advertises
|
||||
`/c24e25e9-.../file/transfer/vs/0` alongside the master's, and the prefix is
|
||||
now known to route. Issue #301 documents the shape: a baseline GET returns
|
||||
one item, `x.com.samsung.name` plus `x.com.samsung.blob`, no write needed to
|
||||
see whatever it currently serves. If the prefixed endpoint serves *different
|
||||
bytes* than the master's, that is the first hard local evidence the wall
|
||||
unit exists as a data producer, and `/opt/data/energy.db` would be where its
|
||||
runtime history lives.
|
||||
|
||||
/file/transfer/vs/0
|
||||
/c24e25e9-55dd-ba18-d567-000000000001/file/transfer/vs/0
|
||||
|
||||
Mind the blob: #301 measured 2172 B on a `KRAC_18K`, and a raw `bytes` value
|
||||
in a service response is not guaranteed to survive rendering in Developer
|
||||
Tools. Ask for `x.com.samsung.name` and whether a blob field appears, not
|
||||
for the blob pasted into a comment.
|
||||
|
||||
## Dead ends, so they aren't re-tried
|
||||
|
||||
- `/hass/state/vs/0`, `/hass/command/vs/0` — advertised in `/oic/res` on
|
||||
every board here, and indexed per subdevice on the dongle board
|
||||
(`/hass/state/vs/{0,1,2}`), which makes them look like a subdevice-aware
|
||||
state channel. They are not: 4.04 on every interface on
|
||||
`ARTIK051_KRAC_18K` (see `ac-filter-reset.md`). Cheap enough to retry once
|
||||
on #335's newer build, but expect nothing.
|
||||
- `/multidevice/vs/0` — probed, 4.04. Absent on this board; only the dongle
|
||||
family exposes it.
|
||||
- `/actions/vs/0` — GET returns `{}` on baseline and `oic.if.a`; publishes
|
||||
no schema (`ac-filter-reset.md`).
|
||||
|
||||
## Where this lands if `/sec/devices` is empty too
|
||||
|
||||
Then the sibling is named in `subdeviceIdList` for the cloud's benefit and
|
||||
has no local operational surface at all on this firmware — every namespace
|
||||
it could occupy has now been read directly, and the UUID one was confirmed
|
||||
routable first, so the negatives mean what they say. That closes issue #335
|
||||
as a firmware limitation rather than leaving it open against a probe
|
||||
strategy that was never actually exercised.
|
||||
|
||||
Worth keeping in view for the enumeration code either way: both remaining
|
||||
patterns hinge on a Collection, and this board answers neither `/device/1`
|
||||
nor a prefixed `/device/0`. An indexed flat-probe fallback — the mirror of
|
||||
issue #205's prefixed one, gated on a board that claims a sibling but
|
||||
materialized nothing — would have cost 8 round trips here and returned the
|
||||
same 4.04s the reporter got by hand. It is worth building only if some
|
||||
other board turns out to serve indexed leaves without their Collection;
|
||||
this one does not.
|
||||
@@ -0,0 +1,279 @@
|
||||
# Laundry cloud "Download" cycles: solved, with one dead end
|
||||
|
||||
`registry/capabilities/laundry.py`'s cycle select offers a washer's
|
||||
downloaded ("Download" / "Downloaded") programs alongside its ordinary
|
||||
courses now, driven by the store in `cloudcourse.py` (issue #342). This file
|
||||
records the byte-level work behind it, including a decode that fit one
|
||||
device perfectly and collapsed on the second — the reason nothing in the
|
||||
shipped code interprets a program payload at all.
|
||||
|
||||
Four devices in the corpus carry these tokens (a survey of every laundry
|
||||
diagnostics dump attached to an issue turned up 14 devices; the other 10 have
|
||||
no cloud tokens at all, so this is a minority feature):
|
||||
|
||||
| dump | model | slots advertised | payloads seen | blob width |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `washer_ww5000c_cloud` | WW5000C `_B06C`, `DA_WM_TP1_21_COMMON`, Table_02 | 9 | 2 | 20 bytes |
|
||||
| `washer_wa55a7700av` | WA55A7700AV, `DA_WM_TP1_21_COMMON`, Table_02 | 2 | 1 | 16 bytes |
|
||||
| `dishwasher_dw5000c_cloud` | DW5000C, `DA_DW_TP1_21_COMMON` | 4 (but see below) | **0** | — |
|
||||
| (not fixtured) | WW5000C `_B048`, issues #259/#343, Table_02 | 9 | 1 | 20 bytes |
|
||||
|
||||
Three things follow immediately from that table:
|
||||
|
||||
- **`CloudExtraCourse_` does not mean the same thing on every family.** On
|
||||
the DW5000C all four of its bytes (`8E 8D 8F 02`) are course codes in that
|
||||
dishwasher's *own* course list, three already translated (Plastic, Pots and
|
||||
pans, Baby Care). There it tags which ordinary courses came from the cloud;
|
||||
they select with a plain `Course_` write and need no payload — consistent
|
||||
with it carrying no payload token at all. It also has a
|
||||
`DownloadCourseList_8F` token the washers lack.
|
||||
On both washers the slots share **zero** overlap with the course list and a
|
||||
payload is required. Subtracting the course list is what tells the two
|
||||
apart (`cloudcourse.cloud_slots`), so the feature engages on the washers
|
||||
and correctly does nothing on the dishwasher.
|
||||
- **A device can advertise a slot it has never loaded.** True on the washers
|
||||
too — nothing about a program is learnable until its owner runs it, which
|
||||
is what the Repairs issue exists to explain.
|
||||
- **Both WW5000C units advertise the byte-identical slot list**
|
||||
(`0A5C286B2D0C55301A`, same nine slots in the same order) despite different
|
||||
firmware builds. Either the set is a factory/regional default rather than
|
||||
something each owner curates, or the two dumps share an owner — unresolved,
|
||||
but worth knowing before assuming a user picked their own programs.
|
||||
|
||||
## The three tokens
|
||||
|
||||
All on `/course/vs/0`'s `x.com.samsung.da.options` array, same
|
||||
prefix-match/replace merge as every other token there.
|
||||
|
||||
- `CloudExtraCourse_<slot><slot>…` — the device's own list of downloaded
|
||||
program slots, one byte each. The cloud counterpart of `EditCourseList_`.
|
||||
- `CloudCourse_<blob>` — the persisted default program.
|
||||
- `OneTimeCloudCourse_<blob>` — a this-run-only override.
|
||||
|
||||
### `CloudExtraCourse_` is an enumeration, and byte 2 of a blob is its slot
|
||||
|
||||
The WW5000C reports `CloudExtraCourse_0A5C286B2D0C55301A` — nine bytes for
|
||||
its nine downloaded programs. Byte 2 of each of the nine blobs its owner
|
||||
captured is exactly one of those nine, no repeats, sets equal:
|
||||
|
||||
```
|
||||
blob byte2 program
|
||||
00 21 55 04 49 28 4D 13 4A A0 4C 00 … 55 Sports
|
||||
00 20 28 04 49 00 4D 00 4A B8 4C 00 … 28 Spin only
|
||||
00 02 5C 04 49 28 4D 13 4A B0 4C 00 … 5C Outdoor
|
||||
00 1F 6B 04 49 28 4D 13 4A A0 4C 00 … 6B Jeans
|
||||
00 2E 2D 04 49 30 4D 12 4A A0 4C 00 … 2D Super quiet
|
||||
00 2F 0C 04 49 58 4D 14 4A B8 4C 00 … 0C Baby care intensive
|
||||
00 0D 30 04 49 30 4D 12 4A B8 4C 00 … 30 Cloudy heaven
|
||||
00 30 1A 04 49 28 4D 12 4A A0 4C 00 … 1A Shirts
|
||||
00 04 0A 04 49 40 4D 13 4A B8 4C 00 … 0A Towels
|
||||
|
||||
CloudExtraCourse_ 0A 5C 28 6B 2D 0C 55 30 1A
|
||||
```
|
||||
|
||||
Confirmed independently on the WA55A7700AV: `CloudExtraCourse_5958`, and its
|
||||
`CloudCourse` blob `00 1C 59 05 …` has byte 2 = `59`. Its
|
||||
`OneTimeCloudCourse` is `FF FF 01 …` — byte 2 = `01`, which is *not* an
|
||||
advertised slot, and the `FFFF` prefix marks it as "nothing loaded" rather
|
||||
than naming a program. That sentinel is why `cloudcourse.is_loaded` exists.
|
||||
|
||||
This is what makes "3 of 9 discovered" answerable, and it is why no catalog
|
||||
of program ids is hardcoded anywhere: the appliance already knows which
|
||||
programs it has.
|
||||
|
||||
## Writing: the two-token rule
|
||||
|
||||
Confirmed on hardware by the issue #342 reporter. Writing
|
||||
`OneTimeCloudCourse_<blob>` alone while some other course is selected is
|
||||
accepted at the protocol level (no error) and then silently ignored by the
|
||||
machine. It takes effect only when the same write also switches `Course_` to
|
||||
the Download course — which is what `laundry._cloud_cycle_write` does, and
|
||||
the only two-token options write in the codebase:
|
||||
|
||||
```yaml
|
||||
x.com.samsung.da.options:
|
||||
- Course_87
|
||||
- OneTimeCloudCourse_001F6B0449284D134AA04C0035F004F005F0AC00
|
||||
```
|
||||
|
||||
`CloudCourse_` was separately confirmed writable on its own: set while on
|
||||
Download it changes the running program; set from another course it becomes
|
||||
what gets preselected the next time Download is chosen. The integration
|
||||
doesn't write it today — a "default download cycle" control is a possible
|
||||
follow-up, deliberately left out of the first pass.
|
||||
|
||||
### There is no single "Download" course code
|
||||
|
||||
The WW5000C's Download is `Course_87`; the WA55A7700AV's is `17`
|
||||
("Downloaded" in `washer_cycle_table_02`). **Same course table, different
|
||||
code.** Any per-table lookup of "the Download code" would have been wrong on
|
||||
one of the only two devices available to check it against, which is why the
|
||||
code is learned by observation and confirmed by the user in the options flow
|
||||
instead of tabled.
|
||||
|
||||
The observation signal is "whatever `Course_` reads at the moment a
|
||||
non-sentinel `OneTimeCloudCourse_` *appears or changes*" — a transition that
|
||||
was actually watched, not a state. Tokens in this array are replaced by
|
||||
prefix and never evicted, so a payload merely sitting there says nothing
|
||||
about when it got there; on the first rep after a restart it is equally
|
||||
consistent with "just loaded" and "left over from last week". Believing it
|
||||
would propose whatever ordinary course the appliance happens to be sitting
|
||||
on, and accepting that prefill starts a real wash cycle. Even a genuine
|
||||
transition is only ever a *candidate*, confirmed by the user before use.
|
||||
|
||||
Both dumps in the corpus taken while off the Download course
|
||||
(`washer_wa55a7700av` on `Course_01`, the `_B048` washer on `Course_1C`)
|
||||
show the appliance clearing its one-time token to the `FFFF` sentinel, so
|
||||
the saved default persists but the one-shot does not. That makes the stale
|
||||
case unlikely on these boards — which is a reason to expect it to behave,
|
||||
not a reason to depend on it.
|
||||
|
||||
## The dead end: bytes 5/7/9 do not decode portably
|
||||
|
||||
With the nine WW5000C programs and their app-reported settings side by side,
|
||||
three of the varying bytes fit perfectly:
|
||||
|
||||
| byte | meaning | formula | fit |
|
||||
| --- | --- | --- | --- |
|
||||
| 5 | wash temperature | `(b - 0x10) / 0.8` °C, `0x00` = n/a | 9/9 |
|
||||
| 7 | rinse count | `b - 0x10`, `0x00` = off | 9/9 |
|
||||
| 9 | spin level | `(b - 0x90) / 8` | 9/9 |
|
||||
|
||||
Nine for nine, including the internally consistent case: "Spin only" is the
|
||||
only program with `0x00` in *both* byte 5 and byte 7, matching a cycle that
|
||||
skips washing entirely while still reporting a spin level.
|
||||
|
||||
It does not survive the second device. Against the WA55A7700AV's
|
||||
`CloudCourse` blob `00 1C 59 05 49 16 4D 11 4A 22 4C 20 37 F0 AC 22`:
|
||||
|
||||
- temperature: `(0x16 - 0x10) / 0.8` = **7.5 °C**
|
||||
- spin: `(0x22 - 0x90) / 8` = **negative**
|
||||
- rinse: `0x11 - 0x10` = 1 — the only plausible one
|
||||
|
||||
### What *does* survive is the grammar
|
||||
|
||||
The two boards' payloads are different lengths (20 vs 16 bytes) but not a
|
||||
different format — same header, same leading fields, two fewer optional
|
||||
trailing ones:
|
||||
|
||||
```
|
||||
WW5000C 00 | 2155 | 04 | 49:28 4D:13 4A:A0 4C:00 | 35:F0 04:F0 05:F0 | AC:00
|
||||
WA55 00 | 1C59 | 05 | 49:16 4D:11 4A:22 4C:20 | 37:F0 | AC:22
|
||||
```
|
||||
|
||||
- `00`, then the 2-byte program id, then one byte (`04` vs `05`) — identical
|
||||
layout on both.
|
||||
- Then a tag/value stream whose **first four tags are the same, in the same
|
||||
order, at the same offsets**: `49`, `4D`, `4A`, `4C`. These are exactly the
|
||||
four whose values vary per program.
|
||||
- Then a fixed tail, terminated on both by an `AC:<value>` pair. The entire
|
||||
width difference is two trailing pairs the WA55 doesn't carry.
|
||||
|
||||
The tail is not program data. Across all nine WW5000C programs bytes 12–19
|
||||
are byte-identical — every trailing pair carries value `F0` except the `AC`
|
||||
terminator, and `35` vs `37` looks like a board or profile marker rather than
|
||||
a field. (It is not a field count either: the board with the *higher* leading
|
||||
byte has *fewer* pairs.)
|
||||
|
||||
### Byte 3 is not part of a program's identity
|
||||
|
||||
Worth its own heading, because it is the single strongest argument against
|
||||
ever shipping a table of payloads. The second WW5000C (issues #259/#343,
|
||||
firmware `_B048`) has its saved `CloudCourse` set to the same program as the
|
||||
first one's "Towels" capture — and the two payloads differ at exactly one
|
||||
byte:
|
||||
|
||||
```
|
||||
_B06C "Towels" 00 04 0A 04 49 40 4D 13 4A B8 4C 00 35 F0 04 F0 05 F0 AC 00
|
||||
_B048 CloudCourse 00 04 0A 06 49 40 4D 13 4A B8 4C 00 35 F0 04 F0 05 F0 AC 00
|
||||
^^
|
||||
```
|
||||
|
||||
Same program id, same slot, same values on all four varying tags, same tail.
|
||||
Only byte 3 moves, `04` → `06`. So it is neither a per-board constant (both
|
||||
are WW5000C) nor a property of the program (identical in every other
|
||||
respect) — most likely a download revision or sequence counter.
|
||||
|
||||
A hardcoded catalog keyed on program id would therefore have shipped one
|
||||
unit's byte 3 to the other unit. Whether the appliance would reject that, or
|
||||
accept it and do something unintended, is untested and does not need to be:
|
||||
every payload is learned from the device it will be replayed to.
|
||||
|
||||
### Sentinels
|
||||
|
||||
The `FFFF` "nothing loaded" payload takes its board's own width (16 bytes on
|
||||
the WA55, 20 on the WW5000C `_B048`) and always carries byte 3 = `00`. Its
|
||||
byte 2 is *not* reliably meaningful: it equals the currently selected course
|
||||
on the WA55 (`01`, on `Course_01`) and does not on the `_B048` (`1B`, on
|
||||
`Course_1C`). Nothing keys off it — a sentinel is rejected on its `FFFF`
|
||||
prefix, and its byte 2 is not an advertised slot in either dump anyway.
|
||||
|
||||
So the payload is tag/value, not fixed offsets — but knowing the grammar
|
||||
doesn't recover the values. The same four tags carry non-overlapping ranges
|
||||
between the two boards:
|
||||
|
||||
| tag | WW5000C (9 programs) | WA55 |
|
||||
| --- | --- | --- |
|
||||
| `49` | `00, 28, 30, 40, 58` | `16` |
|
||||
| `4D` | `00, 12, 13, 14` | `11` |
|
||||
| `4A` | `A0, B0, B8` | `22` |
|
||||
| `4C` | `00` (all nine) | `20` |
|
||||
|
||||
Same field, board-specific encoding. Decoding it properly needs a third
|
||||
device; one device's fit is a coincidence-shaped hypothesis, not a format.
|
||||
|
||||
**A trap for whoever picks this up:** the WA55's `/washer/vs/0` reads
|
||||
Warm / High / 1, which looks like it could confirm a decode of that unit's
|
||||
`CloudCourse`. It can't — that appliance is sitting on `Course_01` (Normal),
|
||||
not on its cloud course, so those values describe the local cycle it has
|
||||
selected, not the saved cloud program. A cross-check like this is only
|
||||
evidence when the machine is actually loaded with the program being decoded.
|
||||
|
||||
So the shipped code never interprets a payload: a blob is recorded whole and
|
||||
replayed byte-for-byte, exactly as the device reported it, and never
|
||||
decomposed or rebuilt. The read-only "loaded program's temperature/spin"
|
||||
sensors this decode would have enabled were dropped for the same reason.
|
||||
|
||||
## What is deliberately not done
|
||||
|
||||
- **No hardcoded program catalog.** Blobs are cloud-assigned per
|
||||
account/region. One owner's captured payload is not evidence about anyone
|
||||
else's appliance, and a table of them would offer options that write
|
||||
another household's wash settings.
|
||||
- **No invented names.** The appliance reports an opaque slot id and nothing
|
||||
else. Names come from the user in the options flow, the same rule that
|
||||
stops an unrecognized local course code from getting a made-up English
|
||||
label (PR #251 review).
|
||||
- **No blob synthesis.** Even with the byte 5/7/9 decode in hand, nothing
|
||||
builds a payload from parts — the device was never tested with one, and a
|
||||
fabricated blob is an untested write to a wash cycle.
|
||||
|
||||
## Open questions for the next dump
|
||||
|
||||
1. Does `OneTimeCloudCourse_` clear itself when a cycle finishes, or when the
|
||||
course changes? Behavior suggests the appliance falls back to
|
||||
`CloudCourse_` when Download is re-entered, but the token's own lifecycle
|
||||
is unconfirmed. `laundry.cloud_current` is written to be correct either
|
||||
way.
|
||||
2. What does byte 1 mean? It is distinct per program and *sometimes*
|
||||
coincides with a plausible local course code for that program (`2E` Baby
|
||||
Care for "Baby care intensive", `30` Cloudy Day for "Cloudy heaven") and
|
||||
sometimes doesn't (`21` Colors for "Sports"). Probably a base-course
|
||||
reference; not reliable enough to use.
|
||||
3. What does byte 3 count? It moves between two units holding the identical
|
||||
program (`04` vs `06`) and is `00` on every sentinel. A revision or
|
||||
download counter is the obvious guess; a dump taken before and after
|
||||
re-downloading the same program would confirm it.
|
||||
4. **The value encoding is still open, and a third *washer* won't
|
||||
necessarily settle it.** The survey found one, but its saved program is a
|
||||
duplicate of one already captured, so it adds no new tag values. What is
|
||||
actually needed is a dump from a board whose `/washer/vs/0` speaks in
|
||||
named levels (Cold/Warm/Hot, Low/High) *while that unit is sitting on a
|
||||
downloaded program* — then the payload's `49`/`4A` values can be read
|
||||
against settings that describe the same program. The WA55 is such a
|
||||
board but was captured on a local course, which is why it can't be used
|
||||
(see the trap above).
|
||||
5. The DW5000C's four slots (`8E 8D 8F 02`) are in the same numeric range as
|
||||
dishwasher course codes (its selected course is `86`), unlike the
|
||||
washers' slots. One payload from that machine would show whether slot ids
|
||||
are drawn from the course-code space on some boards.
|
||||
@@ -0,0 +1,187 @@
|
||||
# Loading a config entry while the appliance is offline
|
||||
|
||||
Issue #295 asks for faster recovery when a powered-off appliance comes back,
|
||||
instead of waiting out HA's `ConfigEntryNotReady` backoff. PR #303 tried to
|
||||
get there by catching the first-refresh failure in `async_setup_entry` and
|
||||
loading the entry anyway.
|
||||
|
||||
That doesn't work here, and the reason is worth writing down: this
|
||||
integration has no static entity list. Every entity comes from discovery,
|
||||
and discovery only happens inside a successful poll.
|
||||
|
||||
(The issue's "up to 15 minutes" is out of date, incidentally. Current HA
|
||||
retries on `2 ** min(tries, 4) * 5` seconds — capped at 80s, not 900. The
|
||||
backoff was never the worst part; a device card reading "Retrying setup" with
|
||||
no entities behind it is.)
|
||||
|
||||
## What PR #303 produces today
|
||||
|
||||
Measured on the PR's branch — set up with `_poll_once` raising, then advance
|
||||
the clock four summary intervals:
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| entry state | `LOADED` |
|
||||
| `coordinator.bound` | 0 |
|
||||
| entities in the state machine | 0 |
|
||||
| registry entries | 1 (the disabled connection-mode sensor) |
|
||||
| coordinator listeners | 0 |
|
||||
| `_unsub_refresh` | `None` |
|
||||
| poll attempts over the next 4 intervals | **0** |
|
||||
|
||||
The entry loads and then never polls again. `DataUpdateCoordinator._async_refresh`
|
||||
reschedules only `if not auth_failed and self._listeners and not
|
||||
self.hass.is_stopping`; with no bound entities the only unconditional entity
|
||||
is `LocalThingsConnectionModeSensor`, which is
|
||||
`entity_registry_enabled_default = False` and so never added and never
|
||||
subscribes. Nothing reloads the entry either. The device comes back online to
|
||||
an entry that is permanently empty until a manual reload — strictly worse
|
||||
than the backoff it replaces, which did recover on its own within 15 minutes.
|
||||
|
||||
## Why entities can't just be created offline
|
||||
|
||||
Four independent gates, all of which need live device data:
|
||||
|
||||
1. `bound` is only ever assigned in `_run_discovery` (`coordinator.py:1081`),
|
||||
which runs on a poll's `resources` dict.
|
||||
2. All ten platforms enumerate `coordinator.bound` exactly once, at forward
|
||||
time (`sensor.py:34` and siblings). Nothing adds entities later — the
|
||||
invariant is already documented at `coordinator.py:1283-1286`.
|
||||
3. `_is_included` (`entity.py:39`) returns False whenever `last_resources`
|
||||
has no rep for the href. Even a fully reconstructed `bound` filters to
|
||||
nothing while `StateCache` is empty.
|
||||
4. `LocalThingsEntity` is a bare `CoordinatorEntity` with no `available`
|
||||
override, no `RestoreEntity`, and no `Store` anywhere in the component. An
|
||||
entity that did exist offline would be `unavailable` with no state.
|
||||
|
||||
The issue cites ESPHome, Shelly, LIFX and WLED as precedent for setup that
|
||||
never fails. Those integrations can do it because each one has a *persisted
|
||||
device description* to build entities from — ESPHome keeps its entity list in
|
||||
`.storage`, Shelly caches device info. The pattern is portable; the mechanism
|
||||
underneath it is the part PR #303 is missing.
|
||||
|
||||
## How the implemented version works
|
||||
|
||||
Three pieces, plus a gating rule.
|
||||
|
||||
### 1. A persisted discovery snapshot
|
||||
|
||||
After each successful first cycle, `_save_snapshot` banks exactly the
|
||||
`resources` dict that cycle handed `_run_discovery`, along with the
|
||||
pre-narrowing subdevice candidate list and the `DeviceIdentity` read from
|
||||
`/oic/*`.
|
||||
|
||||
Storing the poll input rather than a rendered entity list is the decision
|
||||
that keeps this honest. `BoundEntity` holds live
|
||||
`Capability`/`SamsungEntityDescription` objects and isn't serializable, so
|
||||
the alternative was a parallel format plus a re-resolution path — a second
|
||||
implementation of discovery that could drift from the real one. Replaying the
|
||||
input through `_run_discovery` means the same code, the same registry
|
||||
resolution, and no second source of truth.
|
||||
|
||||
Three things ride along because `_run_discovery` reads them off `self`
|
||||
rather than out of `resources`, and getting them wrong would silently resolve
|
||||
a *different* registry offline than online — which reconciliation below would
|
||||
then see as a real change and reload on every restart:
|
||||
|
||||
- `_identity.device_types` routes `resolve_registry`.
|
||||
- `self.subdevices` is the candidate list `discover_partitioned` narrows;
|
||||
replaying against the already-narrowed list finds no siblings at all.
|
||||
- `_identity.manufacturer`/`model` feed `device_info`.
|
||||
|
||||
It lives in `.storage` (`Store`, keyed on entry_id) rather than on the config
|
||||
entry: it's device state, not configuration, and runs to tens of kilobytes.
|
||||
`async_remove_entry` deletes it with the entry.
|
||||
|
||||
The write is awaited, not `async_delay_save`d. A deferred write outlives
|
||||
whatever queued it: it lands after `async_remove_entry` has deleted the file
|
||||
and recreates it orphaned, and a reload scheduled by the reconcile below
|
||||
would read the pre-reload snapshot back off disk. It runs once per entry
|
||||
load, so there's nothing worth deferring. A write that fails is logged and
|
||||
swallowed — a board reporting something the JSON encoder rejects must not
|
||||
break polling.
|
||||
|
||||
### 2. Reconcile on reconnect
|
||||
|
||||
The snapshot is a claim about a device we haven't talked to yet. When the
|
||||
first live poll lands, `_reconcile_rehydrated` compares the live entity set
|
||||
against the rehydrated one — as `(subdevice key, _key(bound))` pairs, which
|
||||
is the unique_id identity — and calls `async_schedule_reload` if they differ.
|
||||
|
||||
Gate 2 above is why this has to be a reload rather than an in-place fixup.
|
||||
It's what makes the feature safe against a firmware update, a sibling
|
||||
subdevice that starts answering, or a different appliance at the same IP.
|
||||
|
||||
### 3. Keep polling with no listeners
|
||||
|
||||
`async_setup_entry` holds one listener for the entry's lifetime:
|
||||
|
||||
```python
|
||||
entry.async_on_unload(coordinator.async_add_listener(lambda: None))
|
||||
```
|
||||
|
||||
Registered *before* the first refresh, so scheduling survives a refresh that
|
||||
fails. This alone fixes the measured "never polls again" bug, and covers a
|
||||
rehydrated set whose entities are all registry-disabled. Removing the last
|
||||
listener unschedules the timer, and HA runs `async_on_unload` callbacks when
|
||||
setup raises, so the setup-retry path doesn't leak a polling coordinator.
|
||||
|
||||
### Gating rule: only load offline when there's a snapshot
|
||||
|
||||
An entry that has never successfully polled has nothing to restore and keeps
|
||||
raising `ConfigEntryNotReady`. This is what answers the objection in the PR
|
||||
thread — with a snapshot we *do* have metadata to build a device from, and
|
||||
without one HA's backoff is still the right behavior. It also leaves room for
|
||||
the #168-style flows that need to interact with the device during setup: a
|
||||
device that never completed setup still blocks.
|
||||
|
||||
It also means `async_remove_config_entry_device` is no longer reachable with
|
||||
an empty `coordinator.subdevices`, so an offline load can't offer to delete a
|
||||
real-but-unreachable subdevice.
|
||||
|
||||
### The coverage-gap Repair stays live-only
|
||||
|
||||
`_run_discovery(..., from_snapshot=True)` skips `_update_coverage_gap_issue`.
|
||||
The Repair points the user at a diagnostics download, which is empty until
|
||||
the appliance answers, and a device name that drifts between the snapshot and
|
||||
the live poll would churn the issue for no reason.
|
||||
|
||||
Not a de-duplication measure — HA already handles that. `async_create_issue`
|
||||
is keyed on `(domain, issue_id)`, `dataclasses.replace` in
|
||||
`async_get_or_create` leaves `dismissed_version` alone, and the registry
|
||||
reloads non-persistent issues with their dismissal intact, so one row per
|
||||
entry survives restarts and an "Ignore" sticks.
|
||||
|
||||
## What this still won't do
|
||||
|
||||
Entities will be present and `unavailable` — not showing their last values.
|
||||
Gate 4 means last-known values require either `RestoreEntity` per platform or
|
||||
persisting `StateCache`, and both mean asserting state the integration cannot
|
||||
verify: a washer unplugged for a week would read "Running". HA's convention
|
||||
is that unreachable means unavailable, and the recorder keeps the history
|
||||
either way, so long-term statistics and history graphs are unaffected by this
|
||||
choice.
|
||||
|
||||
Worth being explicit about, because it is the gap between what PR #303
|
||||
promises in the thread ("load their previously recorded states") and what any
|
||||
correct version can deliver.
|
||||
|
||||
## Rejected: zeroconf
|
||||
|
||||
The issue's other suggestion — wire zeroconf so the device's own boot
|
||||
announcement triggers a retry, which is the genuinely idiomatic HA answer —
|
||||
is a non-starter as things stand: there is no `zeroconf` or `dhcp` key in
|
||||
`manifest.json` and the config flow is user-driven only, so HA has no
|
||||
discovery signal for this integration to hang a retry on. It would first need
|
||||
a confirmed mDNS service on the appliance. Worth revisiting if one turns up;
|
||||
it would make recovery near-instant instead of within one poll interval.
|
||||
|
||||
## Rejected: the cheap version
|
||||
|
||||
Keeping `ConfigEntryNotReady` and adding a probe that calls
|
||||
`async_schedule_reload` on first success would have fixed the recovery *time*
|
||||
in about twenty lines, with no persistence and no reconcile. It was rejected
|
||||
because it leaves the device reading as broken for as long as the appliance
|
||||
is off, which is the half of issue #295 that actually bites — an appliance
|
||||
switched off at the wall is offline for days, not seconds, and a whole
|
||||
integration that looks failed for that entire window is the complaint.
|
||||
@@ -6,7 +6,7 @@ pytest-homeassistant-custom-component>=0.13.316
|
||||
|
||||
# Integration runtime deps, needed to import the component under test
|
||||
# (also declared in custom_components/localthings/manifest.json).
|
||||
smartthings-local>=0.1.2
|
||||
smartthings-local>=0.1.8
|
||||
cbor2>=5.4.6
|
||||
pyOpenSSL>=23.0
|
||||
cryptography>=41.0
|
||||
|
||||
+8
-1
@@ -70,7 +70,7 @@ class FakeCoapSession:
|
||||
pass
|
||||
|
||||
|
||||
def _discover_full(resources: dict[str, dict], oic_res, seeds: dict[str, list]):
|
||||
def _discover_full(resources: dict[str, dict], oic_res, seeds: dict[str, list], device_types=()):
|
||||
"""Run the *whole* subdevice-aware discovery pipeline against fixture
|
||||
data, HA-free -- mirrors exactly what LocalThingsCoordinator does across
|
||||
_enumerate_subdevices_blocking + _run_discovery (issue #177), so a test
|
||||
@@ -78,6 +78,12 @@ def _discover_full(resources: dict[str, dict], oic_res, seeds: dict[str, list]):
|
||||
it. See the adding-device-support skill's section 2 for the plain
|
||||
(non-subdevice) equivalent this extends.
|
||||
|
||||
`device_types` is the master's own /oic/d `rt` (see
|
||||
discover_partitioned's `oic_device_types` param) -- only needed for a
|
||||
board with no /information/vs/0 at all to route from (issue #324's
|
||||
range, whose modelNum-based fallback has nothing to read), so it
|
||||
defaults to () for every fixture that resolves by board token instead.
|
||||
|
||||
Returns `(bound, materialized, skipped, full_resources, device_type_name)`:
|
||||
- `bound`: every BoundEntity, main + every materialized subdevice.
|
||||
- `materialized`/`skipped`: Subdevice / SkippedSubdevice lists straight from
|
||||
@@ -101,6 +107,7 @@ def _discover_full(resources: dict[str, dict], oic_res, seeds: dict[str, list]):
|
||||
candidates,
|
||||
resolve,
|
||||
CAPABILITIES,
|
||||
oic_device_types=device_types,
|
||||
)
|
||||
return bound, materialized, skipped, full_resources, device_type_name
|
||||
|
||||
|
||||
+297
@@ -0,0 +1,297 @@
|
||||
{
|
||||
"device0": [
|
||||
{
|
||||
"rt": [
|
||||
"x.com.samsung.devcol",
|
||||
"oic.wk.col"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.ll",
|
||||
"oic.if.b"
|
||||
]
|
||||
},
|
||||
{
|
||||
"href": "/realtimenotiforclient/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.timeforshortnoti": "0",
|
||||
"x.com.samsung.da.periodicnotisubscription": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/alarms/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "Alarm",
|
||||
"x.com.samsung.da.alarmType": "Device",
|
||||
"x.com.samsung.da.code": "DishA_Disable",
|
||||
"x.com.samsung.da.triggeredTime": "2022-07-28T13:45:57",
|
||||
"x.com.samsung.da.state": "Deleted"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/diagnosis/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.diagnosisStart": "Ready"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/energy/consumption/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.cumulativeSavedPower": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/energy/consumption/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/course/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.supportedModes": [
|
||||
"HOMECARE_WIZARD_V2"
|
||||
],
|
||||
"x.com.samsung.da.options": [
|
||||
"DeviceType_0812",
|
||||
"UpdateAllow_NotAllowed",
|
||||
"CourseDefaultTimeSet_008B008E009A006D003C000A006600A50059009D",
|
||||
"CourseDefaultTempSet_3C41363F41413737373700003C3C464649493C3C",
|
||||
"CourseDefaultFahrenheitSet_8C95819195958383838300008C8C9E9EA3A38C8C",
|
||||
"Course_86",
|
||||
"DetergentOnce_0",
|
||||
"DetergentLeft_0",
|
||||
"DetergentBase_0",
|
||||
"DetergentAlarm_Off",
|
||||
"DetergentType_0",
|
||||
"DetergentTotal_0",
|
||||
"ProgressTimeSet_420622820456B20384",
|
||||
"SendToDevice_Off",
|
||||
"GMT_F2",
|
||||
"SavingModeCondition_01010207828485868E8D020300",
|
||||
"SavingMode_Off",
|
||||
"DownloadCourseList_8F",
|
||||
"StormWashZone_Off",
|
||||
"AutoDoorRelease_On",
|
||||
"Sound_On",
|
||||
"WaterLevelSet_050404050302010205010400",
|
||||
"CloudExtraCourse_8E8D8F02",
|
||||
"EnergyLevelSet_050403050202010305040300",
|
||||
"UsagesDB_ok",
|
||||
"EnergyKW_396",
|
||||
"DrumCleanLog_Empty",
|
||||
"TimeSync_NotSupported"
|
||||
],
|
||||
"x.com.samsung.da.supportedOptions": [
|
||||
"482830CB002C002D00283830CB002C002D00284830CB002C002D00285830CB000C000D00086830CB002C002D002908308B000C000D0008E830CB000C000D0008D830CB002C002D0028F8308B000C000D00002830CB002C002D002"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/power/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.power": "On"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/power/0",
|
||||
"rep": {
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/kidslock/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.kidsLock": "Ready"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/kidslock/0",
|
||||
"rep": {
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/operational/state/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.state": "Run",
|
||||
"x.com.samsung.da.remainingTime": "00:44:00",
|
||||
"x.com.samsung.da.progressPercentage": "28",
|
||||
"x.com.samsung.da.delayStartTime": "00:00:00",
|
||||
"x.com.samsung.da.progress": "Wash",
|
||||
"x.com.samsung.da.supportedProgress": [
|
||||
"None",
|
||||
"Predrain",
|
||||
"Wash",
|
||||
"Rinse",
|
||||
"Drying",
|
||||
"Finish"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/operational/state/0",
|
||||
"rep": {
|
||||
"currentMachineState": "**REDACTED**",
|
||||
"machineStates": "**REDACTED**",
|
||||
"jobStates": [
|
||||
"None",
|
||||
"Predrain",
|
||||
"Wash",
|
||||
"Rinse",
|
||||
"Drying",
|
||||
"Finish"
|
||||
],
|
||||
"currentJobState": "Wash",
|
||||
"remainingTime": "00:44:00",
|
||||
"progressPercentage": "28"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.modelNum": "DA_DW_TP1_21_COMMON|30010741|40000200001711004981000000200000",
|
||||
"x.com.samsung.da.description": "DA_DW_TP1_21_COMMON_DW5000C/DD92-0010741_0001",
|
||||
"x.com.samsung.da.serialNum": "**REDACTED**",
|
||||
"x.com.samsung.da.otnDUID": "**REDACTED**",
|
||||
"x.com.samsung.da.diagProtocolType": "WIFI_HTTPS",
|
||||
"x.com.samsung.da.diagLogType": [
|
||||
"errCode",
|
||||
"dump"
|
||||
],
|
||||
"x.com.samsung.da.diagDumpType": "file",
|
||||
"x.com.samsung.da.diagEndPoint": "SSM",
|
||||
"x.com.samsung.da.diagMnid": "0AJT",
|
||||
"x.com.samsung.da.diagSetupid": "WD0",
|
||||
"x.com.samsung.da.diagMinVersion": "1.0",
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "DA_DW_TP1_21_COMMON|30010741|40000200001711004981000000200000",
|
||||
"x.com.samsung.da.type": "Software",
|
||||
"x.com.samsung.da.number": "00081A230213(A214)",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.id": "1",
|
||||
"x.com.samsung.da.description": "Firmware_1_DB_30010741230602142FFFFFFFFFFFFFFFFFFFFFFFFFFE(081230010741FFFFFFFF_30000000)(FileDown:0)(Type:0)",
|
||||
"x.com.samsung.da.type": "Firmware",
|
||||
"x.com.samsung.da.number": "23060214,FFFFFFFF",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/file/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.timeoffset": "+00:00"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/wm/editcourse/vs/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/wm/setinfo/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.isModelSettingWithoutSC": "false",
|
||||
"x.com.samsung.da.isModelSettingPowerOnOff": "false"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/dishwasher/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.highTemperatureDry": "Off",
|
||||
"x.com.samsung.da.sanitize": "Off",
|
||||
"x.com.samsung.da.selectedZone": "ON_ON",
|
||||
"x.com.samsung.da.rinseLevel": "0",
|
||||
"x.com.samsung.da.supportedSelectedZone": [
|
||||
"OFF_ON",
|
||||
"ON_ON"
|
||||
],
|
||||
"x.com.samsung.da.supportedSanitize": [
|
||||
"Off",
|
||||
"On"
|
||||
],
|
||||
"x.com.samsung.da.supportedHighTemperatureDry": [
|
||||
"Off",
|
||||
"On"
|
||||
],
|
||||
"x.com.samsung.da.supportedRinseLevel": [
|
||||
"0",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/otninformation/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.target": "Micom",
|
||||
"x.com.samsung.da.newVersionAvailable": "false"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/remotectrl/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.remoteControlEnabled": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/remotectrl/0",
|
||||
"rep": {
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/configuration/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.region": "0000000000",
|
||||
"x.com.samsung.da.countryCode": "CA"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/filter/waterfilter/vs/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/drlc/0",
|
||||
"rep": {
|
||||
"DRLevel": 0,
|
||||
"start": "0000-00-00T00:00:00Z",
|
||||
"duration": 0,
|
||||
"override": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/drlc/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.drlcLevel": "0",
|
||||
"x.com.samsung.da.durationminutes": "0",
|
||||
"x.com.samsung.da.start": "0000-00-00T00:00:00Z",
|
||||
"x.com.samsung.da.override": "Off",
|
||||
"x.com.samsung.da.realSaving": "Off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/water/consumption/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.cumulativeWater": "2662000"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/wm/submode/vs/0",
|
||||
"rep": {
|
||||
"setTemperatureUnit": "F"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+1
@@ -20,6 +20,7 @@
|
||||
"fine_dust",
|
||||
"humidity",
|
||||
"odor",
|
||||
"outdoor_temperature",
|
||||
"power_watts",
|
||||
"super_fine_dust",
|
||||
"tropical_night_mode"
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"mute_once",
|
||||
"odor_controller_active",
|
||||
"odor_controller_progress",
|
||||
"outdoor_temperature",
|
||||
"power_energy_kwh",
|
||||
"power_watts",
|
||||
"selfcheck_error",
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"mute_once",
|
||||
"odor_controller_active",
|
||||
"odor_controller_progress",
|
||||
"outdoor_temperature",
|
||||
"power_watts",
|
||||
"tropical_night_mode"
|
||||
]
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"mute_once",
|
||||
"odor_controller_active",
|
||||
"odor_controller_progress",
|
||||
"outdoor_temperature",
|
||||
"periodic_air_sensing",
|
||||
"periodic_sensing_skip_status",
|
||||
"power_watts",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"firmware_update",
|
||||
"humidity",
|
||||
"mute_once",
|
||||
"outdoor_temperature",
|
||||
"power_watts",
|
||||
"tropical_night_mode"
|
||||
]
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"last_air_sensing_level",
|
||||
"last_air_sensing_time",
|
||||
"mute_once",
|
||||
"outdoor_temperature",
|
||||
"periodic_air_sensing",
|
||||
"periodic_sensing_skip_status",
|
||||
"selfcheck_error",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"energy_saved_kwh",
|
||||
"firmware_update",
|
||||
"mute_once",
|
||||
"outdoor_temperature",
|
||||
"selfcheck_error",
|
||||
"selfcheck_result",
|
||||
"selfcheck_status",
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"mute_once",
|
||||
"odor_controller_active",
|
||||
"odor_controller_progress",
|
||||
"outdoor_temperature",
|
||||
"power_watts",
|
||||
"tropical_night_mode"
|
||||
]
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"firmware_update",
|
||||
"humidity",
|
||||
"mute_once",
|
||||
"outdoor_temperature",
|
||||
"power_watts",
|
||||
"tropical_night_mode"
|
||||
]
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"mute_once",
|
||||
"odor_controller_active",
|
||||
"odor_controller_progress",
|
||||
"outdoor_temperature",
|
||||
"selfcheck_error",
|
||||
"selfcheck_result",
|
||||
"selfcheck_status",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"firmware_update",
|
||||
"humidity",
|
||||
"mute_once",
|
||||
"outdoor_temperature",
|
||||
"power_watts",
|
||||
"tropical_night_mode"
|
||||
]
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"fine_dust",
|
||||
"humidity",
|
||||
"odor",
|
||||
"outdoor_temperature",
|
||||
"power_watts",
|
||||
"super_fine_dust",
|
||||
"tropical_night_mode"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"firmware_update",
|
||||
"humidity",
|
||||
"mute_once",
|
||||
"outdoor_temperature",
|
||||
"power_watts",
|
||||
"selfcheck_error",
|
||||
"selfcheck_result",
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"state_keys": [
|
||||
"alarm_code",
|
||||
"auto_release_dry",
|
||||
"child_lock",
|
||||
"completion_minutes",
|
||||
"cycle",
|
||||
"cycle_active",
|
||||
"delay_start_hours",
|
||||
"diagnosis_status",
|
||||
"energy_saved_kwh",
|
||||
"filter_status",
|
||||
"filter_usage",
|
||||
"finish_time",
|
||||
"firmware_update",
|
||||
"heated_dry",
|
||||
"machine_state",
|
||||
"power_switch",
|
||||
"progress",
|
||||
"progress_percentage",
|
||||
"remote_control",
|
||||
"sanitize",
|
||||
"storm_wash",
|
||||
"water_liters"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"state_keys": [
|
||||
"alarm_code",
|
||||
"child_lock",
|
||||
"cloud_connected",
|
||||
"cook_time",
|
||||
"cooktop_on_alert",
|
||||
"cooktop_running_state",
|
||||
"current_temp_c",
|
||||
"cycle_active",
|
||||
"door_open",
|
||||
"energy_saving",
|
||||
"finish_time",
|
||||
"firmware_update",
|
||||
"lamp",
|
||||
"machine_state",
|
||||
"operation_time_minutes",
|
||||
"oven_mode",
|
||||
"oven_setpoint",
|
||||
"oven_state",
|
||||
"power_switch",
|
||||
"progress_percentage",
|
||||
"remote_control",
|
||||
"sound",
|
||||
"subdevice1_cloud_connected",
|
||||
"subdevice1_cook_time",
|
||||
"subdevice1_current_temp_c",
|
||||
"subdevice1_cycle_active",
|
||||
"subdevice1_finish_time",
|
||||
"subdevice1_machine_state",
|
||||
"subdevice1_operation_time_minutes",
|
||||
"subdevice1_oven_mode",
|
||||
"subdevice1_oven_setpoint",
|
||||
"subdevice1_oven_state",
|
||||
"subdevice1_progress_percentage",
|
||||
"subdevice1_sound",
|
||||
"warming_center_state"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"state_keys": [
|
||||
"ai_energy_level",
|
||||
"alarm_code",
|
||||
"auto_door_opener",
|
||||
"auto_door_timer",
|
||||
"auto_door_voice_control",
|
||||
"defrost_active",
|
||||
"door_onedoorfreezer_open",
|
||||
"energy_kwh",
|
||||
"energy_saved_kwh",
|
||||
"firmware_update",
|
||||
"freezer_setpoint",
|
||||
"freezer_temperature",
|
||||
"fridge_sound",
|
||||
"power_energy_kwh",
|
||||
"power_watts",
|
||||
"rapid_freezing",
|
||||
"rapid_fridge",
|
||||
"selfcheck_error",
|
||||
"selfcheck_result",
|
||||
"selfcheck_status"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"state_keys": [
|
||||
"alarm_code",
|
||||
"auto_door_opener",
|
||||
"auto_door_timer",
|
||||
"auto_door_voice_control",
|
||||
"door_onedoorkimchi_open",
|
||||
"energy_kwh",
|
||||
"energy_saved_kwh",
|
||||
"firmware_update",
|
||||
"fridge_sound",
|
||||
"onedoor_mode",
|
||||
"onedoor_rack_count",
|
||||
"onedoor_ripening_remaining",
|
||||
"onedoor_ripening_status",
|
||||
"power_energy_kwh",
|
||||
"power_watts",
|
||||
"selfcheck_error",
|
||||
"selfcheck_result",
|
||||
"selfcheck_status"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"state_keys": [
|
||||
"alarm_code",
|
||||
"auto_door_opener",
|
||||
"auto_door_sound_control",
|
||||
"auto_door_timer",
|
||||
"auto_door_voice_control",
|
||||
"cabinet_light_dim",
|
||||
"cabinet_light_switch",
|
||||
"deodor_filter_status",
|
||||
"deodor_filter_usage",
|
||||
"door_winecellar_open",
|
||||
"energy_kwh",
|
||||
"energy_saved_kwh",
|
||||
"firmware_update",
|
||||
"fridge_sound",
|
||||
"power_energy_kwh",
|
||||
"power_watts",
|
||||
"selfcheck_error",
|
||||
"selfcheck_result",
|
||||
"selfcheck_status",
|
||||
"winecellar_bottom_setpoint",
|
||||
"winecellar_pantry_zone_mode",
|
||||
"winecellar_top_setpoint"
|
||||
]
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"state_keys": [
|
||||
"alarm_code",
|
||||
"bubble_soak",
|
||||
"buzzer_sound",
|
||||
"child_lock",
|
||||
"completion_minutes",
|
||||
"cycle",
|
||||
"cycle_active",
|
||||
"delay_start_hours",
|
||||
"detergent_low",
|
||||
"diagnosis_status",
|
||||
"drum_clean_cycles_remaining",
|
||||
"drum_clean_last_cleaned",
|
||||
"energy_kwh",
|
||||
"energy_saved_kwh",
|
||||
"finish_sound",
|
||||
"finish_time",
|
||||
"firmware_update",
|
||||
"intensive",
|
||||
"job_beginning_status",
|
||||
"machine_state",
|
||||
"power_switch",
|
||||
"pre_wash",
|
||||
"progress",
|
||||
"progress_percentage",
|
||||
"remote_control",
|
||||
"rinse_cycles",
|
||||
"softener_low",
|
||||
"spin_speed",
|
||||
"wash_temperature",
|
||||
"water_liters"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,470 @@
|
||||
{
|
||||
"device0": [
|
||||
{
|
||||
"rt": [
|
||||
"x.com.samsung.devcol",
|
||||
"oic.wk.col"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.ll",
|
||||
"oic.if.b"
|
||||
]
|
||||
},
|
||||
{
|
||||
"href": "/otninformation/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.target": "",
|
||||
"x.com.samsung.da.newVersionAvailable": "false"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/power/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.power": "On",
|
||||
"rt": [
|
||||
"x.com.samsung.da.operation"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.s"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/alarms/vs/0",
|
||||
"rep": {
|
||||
"rt": [
|
||||
"x.com.samsung.da.alarms"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.s"
|
||||
],
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "Alarm",
|
||||
"x.com.samsung.da.alarmType": "Device",
|
||||
"x.com.samsung.da.code": "OV_E_OFF",
|
||||
"x.com.samsung.da.triggeredTime": "2026-08-07T15:56:50"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/kidslock/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.kidsLock": "Ready"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/configuration/vs/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/oven/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.state": "Ready",
|
||||
"rt": [
|
||||
"x.com.samsung.da.oven"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.s"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/remotectrl/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.remoteControlEnabled": "false",
|
||||
"rt": [
|
||||
"x.com.samsung.da.configuration"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.s"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/temperatures/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "Temperature",
|
||||
"x.com.samsung.da.desired": "0",
|
||||
"x.com.samsung.da.current": "175",
|
||||
"x.com.samsung.da.increment": "5",
|
||||
"x.com.samsung.da.unit": "Fahrenheit"
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.id": "1",
|
||||
"x.com.samsung.da.description": "Temperature",
|
||||
"x.com.samsung.da.desired": "0",
|
||||
"x.com.samsung.da.current": "0",
|
||||
"x.com.samsung.da.increment": "1",
|
||||
"x.com.samsung.da.unit": "Fahrenheit"
|
||||
}
|
||||
],
|
||||
"rt": [
|
||||
"x.com.samsung.da.temperatures"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/mode/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.supportedModes": [
|
||||
"UpperBroil",
|
||||
"UpperConvectionBake",
|
||||
"UpperConvectionRoast"
|
||||
],
|
||||
"x.com.samsung.da.modes": [
|
||||
"NoOperation"
|
||||
],
|
||||
"x.com.samsung.da.options": [
|
||||
"DeviceType_NE9801T-/AA0",
|
||||
"SettingPossible_7",
|
||||
"meatprobe_disconnected",
|
||||
"UpperLamp_Off",
|
||||
"Sound_Off",
|
||||
"AdjustingTemp_0",
|
||||
"Sabbath_Off",
|
||||
"EnergySaving_Off",
|
||||
"BurnerOnAlert_Off"
|
||||
],
|
||||
"x.com.samsung.da.defaultMode": "UpperConvectionBake",
|
||||
"x.com.samsung.da.modeSpec": "[{\"mode\":\"Bake\",\"version\":\"0100\",\"default\":\"Normal\",\"control\":\"Start&Setting\",\"cavity\":\"Single\",\"tempMinC\":\"80\",\"tempMaxC\":\"285\",\"tempDefaultC\":\"175\",\"tempListLengthC\":\"0\",\"tempMinF\":\"175\",\"tempMaxF\":\"550\",\"tempDefaultF\":\"350\",\"tempListLengthF\":\"0\",\"timeMin\":\"00:01:00\",\"timeMax\":\"09:59:00\",\"timeDefault\":\"01:00:00\",\"probeMinC\":\"NotSupported\",\"probeMaxC\":\"NotSupported\",\"probeDefaultC\":\"NotSupported\",\"probeMinF\":\"NotSupported\",\"probeMaxF\":\"NotSupported\",\"probeDefaultF\":\"NotSupported\",\"powerDefault\":\"NotSupported\",\"powerListLength\":\"0\",\"tempIntervalC\":\"0\",\"tempIntervalF\":\"0\",\"probeIntervalC\":\"0\",\"probeIntervalF\":\"0\"},{\"mode\":\"Broil\",\"version\":\"0100\",\"default\":\"Normal\",\"control\":\"Setting\",\"cavity\":\"Single\",\"tempMinC\":\"61441\",\"tempMaxC\":\"61442\",\"tempDefaultC\":\"61441\",\"tempListLengthC\":\"2\",\"tempListDataC\":[\"61441\",\"61442\"],\"tempMinF\":\"61441\",\"tempMaxF\":\"61442\",\"tempDefaultF\":\"61441\",\"tempListLengthF\":\"2\",\"tempListDataF\":[\"61441\",\"61442\"],\"timeMin\":\"NotSupported\",\"timeMax\":\"NotSupported\",\"timeDefault\":\"NotSupported\",\"probeMinC\":\"NotSupported\",\"probeMaxC\":\"NotSupported\",\"probeDefaultC\":\"NotSupported\",\"probeMinF\":\"NotSupported\",\"probeMaxF\":\"NotSupported\",\"probeDefaultF\":\"NotSupported\",\"powerDefault\":\"NotSupported\",\"powerListLength\":\"0\",\"tempIntervalC\":\"0\",\"tempIntervalF\":\"0\",\"probeIntervalC\":\"0\",\"probeIntervalF\":\"0\"},{\"mode\":\"ConvectionBake\",\"version\":\"0100\",\"default\":\"Default\",\"control\":\"Start&Setting\",\"cavity\":\"Single\",\"tempMinC\":\"80\",\"tempMaxC\":\"285\",\"tempDefaultC\":\"160\",\"tempListLengthC\":\"0\",\"tempMinF\":\"175\",\"tempMaxF\":\"550\",\"tempDefaultF\":\"325\",\"tempListLengthF\":\"0\",\"timeMin\":\"00:01:00\",\"timeMax\":\"09:59:00\",\"timeDefault\":\"01:00:00\",\"probeMinC\":\"NotSupported\",\"probeMaxC\":\"NotSupported\",\"probeDefaultC\":\"NotSupported\",\"probeMinF\":\"NotSupported\",\"probeMaxF\":\"NotSupported\",\"probeDefaultF\":\"NotSupported\",\"powerDefault\":\"NotSupported\",\"powerListLength\":\"0\",\"tempIntervalC\":\"0\",\"tempIntervalF\":\"0\",\"probeIntervalC\":\"0\",\"probeIntervalF\":\"0\"},{\"mode\":\"ConvectionRoast\",\"version\":\"0100\",\"default\":\"Normal\",\"control\":\"Start&Setting\",\"cavity\":\"Single\",\"tempMinC\":\"80\",\"tempMaxC\":\"285\",\"tempDefaultC\":\"160\",\"tempListLengthC\":\"0\",\"tempMinF\":\"175\",\"tempMaxF\":\"550\",\"tempDefaultF\":\"325\",\"tempListLengthF\":\"0\",\"timeMin\":\"00:01:00\",\"timeMax\":\"09:59:00\",\"timeDefault\":\"01:00:00\",\"probeMinC\":\"NotSupported\",\"probeMaxC\":\"NotSupported\",\"probeDefaultC\":\"NotSupported\",\"probeMinF\":\"NotSupported\",\"probeMaxF\":\"NotSupported\",\"probeDefaultF\":\"NotSupported\",\"powerDefault\":\"NotSupported\",\"powerListLength\":\"0\",\"tempIntervalC\":\"0\",\"tempIntervalF\":\"0\",\"probeIntervalC\":\"0\",\"probeIntervalF\":\"0\"},{\"mode\":\"KeepWarm\",\"version\":\"0100\",\"default\":\"Normal\",\"control\":\"Setting\",\"cavity\":\"Single\",\"tempMinC\":\"80\",\"tempMaxC\":\"80\",\"tempDefaultC\":\"80\",\"tempListLengthC\":\"1\",\"tempListDataC\":[\"80\"],\"tempMinF\":\"175\",\"tempMaxF\":\"175\",\"tempDefaultF\":\"175\",\"tempListLengthF\":\"1\",\"tempListDataF\":[\"175\"],\"timeMin\":\"NotSupported\",\"timeMax\":\"NotSupported\",\"timeDefault\":\"NotSupported\",\"probeMinC\":\"NotSupported\",\"probeMaxC\":\"NotSupported\",\"probeDefaultC\":\"NotSupported\",\"probeMinF\":\"NotSupported\",\"probeMaxF\":\"NotSupported\",\"probeDefaultF\":\"NotSupported\",\"powerDefault\":\"NotSupported\",\"powerListLength\":\"0\",\"tempIntervalC\":\"0\",\"tempIntervalF\":\"0\",\"probeIntervalC\":\"0\",\"probeIntervalF\":\"0\"},{\"mode\":\"BreadProof\",\"version\":\"0100\",\"default\":\"Normal\",\"control\":\"Setting\",\"cavity\":\"Single\",\"tempMinC\":\"35\",\"tempMaxC\":\"35\",\"tempDefaultC\":\"35\",\"tempListLengthC\":\"1\",\"tempListDataC\":[\"35\"],\"tempMinF\":\"95\",\"tempMaxF\":\"95\",\"tempDefaultF\":\"95\",\"tempListLengthF\":\"1\",\"tempListDataF\":[\"95\"],\"timeMin\":\"NotSupported\",\"timeMax\":\"NotSupported\",\"timeDefault\":\"NotSupported\",\"probeMinC\":\"NotSupported\",\"probeMaxC\":\"NotSupported\",\"probeDefaultC\":\"NotSupported\",\"probeMinF\":\"NotSupported\",\"probeMaxF\":\"NotSupported\",\"probeDefaultF\":\"NotSupported\",\"powerDefault\":\"NotSupported\",\"powerListLength\":\"0\",\"tempIntervalC\":\"0\",\"tempIntervalF\":\"0\",\"probeIntervalC\":\"0\",\"probeIntervalF\":\"0\"},{\"mode\":\"AirFryer\",\"version\":\"0100\",\"default\":\"Normal\",\"control\":\"Start&Setting\",\"cavity\":\"Single\",\"tempMinC\":\"175\",\"tempMaxC\":\"260\",\"tempDefaultC\":\"220\",\"tempListLengthC\":\"0\",\"tempMinF\":\"350\",\"tempMaxF\":\"500\",\"tempDefaultF\":\"425\",\"tempListLengthF\":\"0\",\"timeMin\":\"00:Line truncated
|
||||
"rt": [
|
||||
"x.com.samsung.da.mode"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/operational/state/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.state": "Ready",
|
||||
"x.com.samsung.da.operationTime": "00:00:00",
|
||||
"x.com.samsung.da.remainingTime": "00:00:00",
|
||||
"x.com.samsung.da.progressPercentage": "1",
|
||||
"rt": [
|
||||
"x.com.samsung.da.operation"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/doors/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "Door",
|
||||
"x.com.samsung.da.openState": "Close",
|
||||
"x.com.samsung.da.lock": "Unlock"
|
||||
}
|
||||
],
|
||||
"rt": [
|
||||
"x.com.samsung.da.doors"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.s"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/connected/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.connected": "On"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/cooktopmonitoring/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.warmingCenterState": "Off",
|
||||
"x.com.samsung.da.cooktopMonitoring": "0",
|
||||
"x.com.samsung.da.cooktopRunningState": "Ready",
|
||||
"supportedHoodLampStateList": [
|
||||
"Run",
|
||||
"Ready"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"oic_res": [
|
||||
{
|
||||
"di": "**REDACTED**",
|
||||
"links": [
|
||||
{
|
||||
"href": "/oic/sec/doxm",
|
||||
"rt": [
|
||||
"oic.r.doxm"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline"
|
||||
],
|
||||
"p": {
|
||||
"bm": 1,
|
||||
"sec": true,
|
||||
"port": 49155,
|
||||
"x.org.iotivity.tls": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/oic/sec/pstat",
|
||||
"rt": [
|
||||
"oic.r.pstat"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline"
|
||||
],
|
||||
"p": {
|
||||
"bm": 1,
|
||||
"sec": true,
|
||||
"port": 49155,
|
||||
"x.org.iotivity.tls": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/oic/d",
|
||||
"rt": [
|
||||
"oic.wk.d",
|
||||
"oic.d.range"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.r"
|
||||
],
|
||||
"p": {
|
||||
"bm": 1,
|
||||
"sec": false,
|
||||
"x.org.iotivity.tcp": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/oic/p",
|
||||
"rt": [
|
||||
"oic.wk.p"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.r"
|
||||
],
|
||||
"p": {
|
||||
"bm": 1,
|
||||
"sec": false,
|
||||
"x.org.iotivity.tcp": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/EasySetupResURI",
|
||||
"rt": [
|
||||
"oic.r.easysetup"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.ll",
|
||||
"oic.if.b"
|
||||
],
|
||||
"p": {
|
||||
"bm": 1,
|
||||
"sec": true,
|
||||
"port": 49155,
|
||||
"x.org.iotivity.tls": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/WiFiConfResURI",
|
||||
"rt": [
|
||||
"oic.wk.wifi"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline"
|
||||
],
|
||||
"p": {
|
||||
"bm": 1,
|
||||
"sec": true,
|
||||
"port": 49155,
|
||||
"x.org.iotivity.tls": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/CoapCloudConfResURI",
|
||||
"rt": [
|
||||
"oic.wk.cloudserver"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline"
|
||||
],
|
||||
"p": {
|
||||
"bm": 1,
|
||||
"sec": true,
|
||||
"port": 49155,
|
||||
"x.org.iotivity.tls": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/DevConfResURI",
|
||||
"rt": [
|
||||
"oic.wk.devconf"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline"
|
||||
],
|
||||
"p": {
|
||||
"bm": 1,
|
||||
"sec": true,
|
||||
"port": 49155,
|
||||
"x.org.iotivity.tls": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/sec/provisioninginfo",
|
||||
"rt": [
|
||||
"x.com.samsung.provisioninginfo"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
],
|
||||
"p": {
|
||||
"bm": 1,
|
||||
"sec": false,
|
||||
"x.org.iotivity.tcp": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/sec/accesspointlist",
|
||||
"rt": [
|
||||
"x.com.samsung.accesspointlist"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.s"
|
||||
],
|
||||
"p": {
|
||||
"bm": 1,
|
||||
"sec": false,
|
||||
"x.org.iotivity.tcp": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"seeds": {
|
||||
"/device/1": [
|
||||
{
|
||||
"rt": [
|
||||
"x.com.samsung.devcol",
|
||||
"oic.wk.col"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.ll",
|
||||
"oic.if.b"
|
||||
]
|
||||
},
|
||||
{
|
||||
"href": "/oven/vs/1",
|
||||
"rep": {
|
||||
"x.com.samsung.da.state": "Ready",
|
||||
"rt": [
|
||||
"x.com.samsung.da.oven"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.s"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/temperatures/vs/1",
|
||||
"rep": {
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "Temperature",
|
||||
"x.com.samsung.da.desired": "0",
|
||||
"x.com.samsung.da.current": "175",
|
||||
"x.com.samsung.da.increment": "5",
|
||||
"x.com.samsung.da.unit": "Fahrenheit"
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.id": "1",
|
||||
"x.com.samsung.da.description": "Temperature",
|
||||
"x.com.samsung.da.desired": "0",
|
||||
"x.com.samsung.da.current": "0",
|
||||
"x.com.samsung.da.increment": "1",
|
||||
"x.com.samsung.da.unit": "Fahrenheit"
|
||||
}
|
||||
],
|
||||
"rt": [
|
||||
"x.com.samsung.da.temperatures"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/mode/vs/1",
|
||||
"rep": {
|
||||
"x.com.samsung.da.supportedModes": [
|
||||
"LowerBake",
|
||||
"LowerConvectionBake"
|
||||
],
|
||||
"x.com.samsung.da.modes": [
|
||||
"NoOperation"
|
||||
],
|
||||
"x.com.samsung.da.defaultMode": "LowerConvectionBake",
|
||||
"rt": [
|
||||
"x.com.samsung.da.mode"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/operational/state/vs/1",
|
||||
"rep": {
|
||||
"x.com.samsung.da.state": "Ready",
|
||||
"x.com.samsung.da.operationTime": "00:00:00",
|
||||
"x.com.samsung.da.remainingTime": "00:00:00",
|
||||
"x.com.samsung.da.progressPercentage": "1",
|
||||
"rt": [
|
||||
"x.com.samsung.da.operation"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/connected/vs/1",
|
||||
"rep": {
|
||||
"x.com.samsung.da.connected": "On"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"seeds_note": "device0 and oic_res are verbatim diagnostics captures (issue #324). The /device/1 seed batch is reconstructed, not captured live: the diagnostics report only carries the subdevice's already-canonicalized resources (subdevices[0].resources), so this reindexes each trailing '.../vs/0' href to '.../vs/1' per subdevices.Subdevice.to_actual's own indexed-sibling rule, rather than recording the raw wire response."
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
{
|
||||
"device0": [
|
||||
{
|
||||
"rt": [
|
||||
"x.com.samsung.devcol",
|
||||
"oic.wk.col"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.ll",
|
||||
"oic.if.b"
|
||||
]
|
||||
},
|
||||
{
|
||||
"href": "/alarms/vs/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/temperatures/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "Freezer",
|
||||
"x.com.samsung.da.desired": "-19",
|
||||
"x.com.samsung.da.current": "-19",
|
||||
"x.com.samsung.da.maximum": "-17",
|
||||
"x.com.samsung.da.minimum": "-23",
|
||||
"x.com.samsung.da.unit": "Celsius"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/temperature/current/freezer/0",
|
||||
"rep": {
|
||||
"range": [
|
||||
-23.0,
|
||||
-17.0
|
||||
],
|
||||
"units": "C",
|
||||
"temperature": -19.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/temperature/desired/freezer/0",
|
||||
"rep": {
|
||||
"range": [
|
||||
-23.0,
|
||||
-17.0
|
||||
],
|
||||
"units": "C",
|
||||
"temperature": -19.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/selfcheck/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.status": "Ready",
|
||||
"x.com.samsung.da.result": "Success",
|
||||
"x.com.samsung.da.error": [
|
||||
"DA_ERROR_NONE"
|
||||
],
|
||||
"x.com.samsung.da.supportedActions": [
|
||||
"Start"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/energy/consumption/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.cumulativeConsumption": "41042",
|
||||
"x.com.samsung.da.cumulativePower": "466708",
|
||||
"x.com.samsung.da.cumulativeUnit": "Wh",
|
||||
"x.com.samsung.da.instantaneousPower": "4",
|
||||
"x.com.samsung.da.instantaneousPowerUnit": "W",
|
||||
"x.com.samsung.da.cumulativeSavedPower": "15759"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/mode/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.supportedModes": [
|
||||
"HOMECARE_WIZARD_V2",
|
||||
"ENERGY_REPORT_MODEL",
|
||||
"18K_REF_OUTDOOR_CONTROL_V2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/mode/0",
|
||||
"rep": {
|
||||
"supportedModes": [
|
||||
"HOMECARE_WIZARD_V2",
|
||||
"ENERGY_REPORT_MODEL",
|
||||
"18K_REF_OUTDOOR_CONTROL_V2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/realtimenotiforclient/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.timeforshortnoti": "0",
|
||||
"x.com.samsung.da.periodicnotisubscription": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.modelNum": "TP1X_REF_21K|00168541|00080023001713104100000041010000",
|
||||
"x.com.samsung.da.description": "TP1X_REF_21K",
|
||||
"x.com.samsung.da.serialNum": "**REDACTED**",
|
||||
"x.com.samsung.da.otnDUID": "**REDACTED**",
|
||||
"x.com.samsung.da.diagProtocolType": "BLE_OCF",
|
||||
"x.com.samsung.da.diagLogType": [
|
||||
"errCode",
|
||||
"dump"
|
||||
],
|
||||
"x.com.samsung.da.diagDumpType": "file",
|
||||
"x.com.samsung.da.diagEndPoint": "SSM",
|
||||
"x.com.samsung.da.diagMnid": "0AJT",
|
||||
"x.com.samsung.da.diagSetupid": "RO6",
|
||||
"x.com.samsung.da.diagMinVersion": "3.0",
|
||||
"x.com.samsung.da.diagTsId": "DA01",
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "WiFi Module",
|
||||
"x.com.samsung.da.type": "Software",
|
||||
"x.com.samsung.da.number": "250422",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.id": "1",
|
||||
"x.com.samsung.da.description": "Micom",
|
||||
"x.com.samsung.da.type": "Firmware",
|
||||
"x.com.samsung.da.number": "24101709, 23031302, 24062000, FFFFFFFF",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/file/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.timeoffset": "+09:00",
|
||||
"x.com.samsung.supprtedtype": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/doors/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "3",
|
||||
"x.com.samsung.da.description": "Door",
|
||||
"x.com.samsung.da.openState": "Close"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/door/onedoorfreezer/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.openState": "Close"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/configuration/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.countryCode": "",
|
||||
"x.com.samsung.da.region": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/refrigeration/0",
|
||||
"rep": {
|
||||
"defrost": false,
|
||||
"rapidFreeze": false,
|
||||
"rapidCool": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/refrigeration/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.rapidFreezing": "Off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/drlc/0",
|
||||
"rep": {
|
||||
"DRLevel": 2,
|
||||
"override": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/drlc/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.drlcLevel": "2",
|
||||
"x.com.samsung.da.override": "Not_Supported",
|
||||
"x.com.samsung.da.durationminutes": "1441",
|
||||
"x.com.samsung.da.start": "2026-08-06T00:34:47Z",
|
||||
"x.com.samsung.da.realSaving": "On"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/bespoke/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.BespokeProduct": "On"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/otninformation/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.target": "",
|
||||
"x.com.samsung.da.newVersionAvailable": "false",
|
||||
"otnStatus": "None",
|
||||
"flashingProgress": "",
|
||||
"otnList": [
|
||||
{
|
||||
"type": "WIFI",
|
||||
"modelId": "A-RFWW-TP1-23-COMMON",
|
||||
"versions": [
|
||||
"20250422"
|
||||
],
|
||||
"visVersion": "250422"
|
||||
},
|
||||
{
|
||||
"type": "Micom",
|
||||
"modelId": "02800016854100168441",
|
||||
"versions": [
|
||||
"24101709",
|
||||
"23031302"
|
||||
],
|
||||
"visVersion": "241017"
|
||||
},
|
||||
{
|
||||
"type": "Micom",
|
||||
"modelId": "028070655341FFFFFFFF",
|
||||
"versions": [
|
||||
"24062000",
|
||||
"FFFFFFFF"
|
||||
],
|
||||
"visVersion": "240620"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/status/lock/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.ado.voicecontrol": "Off",
|
||||
"x.com.samsung.da.device.sound": "On"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/energy/ailevel/vs/0",
|
||||
"rep": {
|
||||
"aiLevel": "1",
|
||||
"supportedAiLevel": [
|
||||
"1",
|
||||
"2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/autodoor/timer/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.time.desired": "1",
|
||||
"x.com.samsung.da.time.supportedOptions": [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/autodoor/single/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.ado.openOptions": [
|
||||
"Single"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/connectionconfig/vs/0",
|
||||
"rep": {
|
||||
"autoReconnectionMinVersion": "1.0",
|
||||
"autoReconnection": "true",
|
||||
"autoReconnectionProtocolType": [
|
||||
"ble_ocf",
|
||||
null
|
||||
],
|
||||
"supportedWiFiAuthType": [
|
||||
"OPEN",
|
||||
"WEP",
|
||||
"WPA-PSK",
|
||||
"WPA2-PSK",
|
||||
"SAE"
|
||||
],
|
||||
"supportedWiFiCryptoType": [
|
||||
"TKIP",
|
||||
"AES",
|
||||
"WEP-64",
|
||||
"WEP-128"
|
||||
],
|
||||
"supportedWiFiFreq": [
|
||||
"2.4G"
|
||||
],
|
||||
"calmConnectionCare": {
|
||||
"version": "1.0",
|
||||
"role": [
|
||||
"things"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/timezone/vs/0",
|
||||
"rep": {
|
||||
"timezoneid": "Asia/Seoul",
|
||||
"offset": "+09:00",
|
||||
"DST": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/wirelessinfo/vs/0",
|
||||
"rep": {
|
||||
"macaddressWiFi": "**REDACTED**",
|
||||
"macaddressBLE": "**REDACTED**"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/quickcontrol/info/vs/0",
|
||||
"rep": {
|
||||
"supportedVersion": "1.0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,332 @@
|
||||
{
|
||||
"device0": [
|
||||
{
|
||||
"rt": [
|
||||
"x.com.samsung.devcol",
|
||||
"oic.wk.col"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.ll",
|
||||
"oic.if.b"
|
||||
]
|
||||
},
|
||||
{
|
||||
"href": "/alarms/vs/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/selfcheck/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.status": "Ready",
|
||||
"x.com.samsung.da.result": "Success",
|
||||
"x.com.samsung.da.error": [
|
||||
"DA_ERROR_NONE"
|
||||
],
|
||||
"x.com.samsung.da.supportedActions": [
|
||||
"Start"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/energy/consumption/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.cumulativeConsumption": "53539",
|
||||
"x.com.samsung.da.cumulativePower": "174590",
|
||||
"x.com.samsung.da.cumulativeUnit": "Wh",
|
||||
"x.com.samsung.da.instantaneousPower": "4",
|
||||
"x.com.samsung.da.instantaneousPowerUnit": "W",
|
||||
"x.com.samsung.da.cumulativeSavedPower": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/mode/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.supportedModes": [
|
||||
"HOMECARE_WIZARD_V2",
|
||||
"ENERGY_REPORT_MODEL",
|
||||
"18K_KIMCHI_OUTDOOR_CONTROL"
|
||||
],
|
||||
"x.com.samsung.da.modes": [
|
||||
"KIMCHI_KIMCHI_STORAGE_NORMAL",
|
||||
"KIMCHI_RIPE_REMAIN_[0]:[0]",
|
||||
"KIMCHIT_BOX_COUNT_[0]",
|
||||
"KIMCHIM_BOX_COUNT_[0]",
|
||||
"KIMCHIB_BOX_COUNT_[0]",
|
||||
"KIMCHI_BOX_COUNT_[8]"
|
||||
],
|
||||
"x.com.samsung.da.supportedOptions": [
|
||||
"KIMCHI_KIMCHI_STORAGE_NORMAL_[0]:[0]",
|
||||
"KIMCHI_KIMCHI_STORAGE_COLD_[0]:[0]",
|
||||
"KIMCHI_KIMCHI_STORAGE_WARM_[0]:[0]",
|
||||
"KIMCHI_KIMCHI_STORAGE_CRUNFCH_[0]:[0]",
|
||||
"KIMCHI_KIMCHI_STORAGE_BUY_[0]:[0]",
|
||||
"KIMCHI_STORAGE_FRIDGE_[0]:[0]",
|
||||
"KIMCHI_STORAGE_FREEZER_[0]:[0]",
|
||||
"KIMCHI_KIMCHI_RIPE_NORMAL_TEMP_[2]:[12]",
|
||||
"KIMCHI_KIMCHI_RIPE_LOW_TEMP_[5]:[17]"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/mode/0",
|
||||
"rep": {
|
||||
"supportedModes": [
|
||||
"HOMECARE_WIZARD_V2",
|
||||
"ENERGY_REPORT_MODEL",
|
||||
"18K_KIMCHI_OUTDOOR_CONTROL"
|
||||
],
|
||||
"modes": [
|
||||
"KIMCHI_KIMCHI_STORAGE_NORMAL",
|
||||
"KIMCHI_RIPE_REMAIN_[0]:[0]",
|
||||
"KIMCHIT_BOX_COUNT_[0]",
|
||||
"KIMCHIM_BOX_COUNT_[0]",
|
||||
"KIMCHIB_BOX_COUNT_[0]",
|
||||
"KIMCHI_BOX_COUNT_[8]"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/realtimenotiforclient/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.timeforshortnoti": "0",
|
||||
"x.com.samsung.da.periodicnotisubscription": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.modelNum": "TP1X_REF_21K|00168041|10010022011713004101800031010000",
|
||||
"x.com.samsung.da.description": "TP1X_REF_21K",
|
||||
"x.com.samsung.da.serialNum": "**REDACTED**",
|
||||
"x.com.samsung.da.otnDUID": "**REDACTED**",
|
||||
"x.com.samsung.da.diagProtocolType": "BLE_OCF",
|
||||
"x.com.samsung.da.diagLogType": [
|
||||
"errCode",
|
||||
"dump"
|
||||
],
|
||||
"x.com.samsung.da.diagDumpType": "file",
|
||||
"x.com.samsung.da.diagEndPoint": "SSM",
|
||||
"x.com.samsung.da.diagMnid": "0AJT",
|
||||
"x.com.samsung.da.diagSetupid": "CO0",
|
||||
"x.com.samsung.da.diagMinVersion": "3.0",
|
||||
"x.com.samsung.da.diagTsId": "DA01",
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "WiFi Module",
|
||||
"x.com.samsung.da.type": "Software",
|
||||
"x.com.samsung.da.number": "250422",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.id": "1",
|
||||
"x.com.samsung.da.description": "Micom",
|
||||
"x.com.samsung.da.type": "Firmware",
|
||||
"x.com.samsung.da.number": "24101006, 23031302, 24102200, FFFFFFFF",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/file/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.timeoffset": "+00:00",
|
||||
"x.com.samsung.supprtedtype": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/doors/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "8",
|
||||
"x.com.samsung.da.description": "Door",
|
||||
"x.com.samsung.da.openState": "Close"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/door/onedoorkimchi/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.openState": "Close"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/configuration/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.countryCode": "",
|
||||
"x.com.samsung.da.region": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/drlc/0",
|
||||
"rep": {
|
||||
"DRLevel": 2,
|
||||
"override": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/drlc/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.drlcLevel": "2",
|
||||
"x.com.samsung.da.override": "Not_Supported",
|
||||
"x.com.samsung.da.durationminutes": "1441",
|
||||
"x.com.samsung.da.start": "2026-08-06T00:34:47Z",
|
||||
"x.com.samsung.da.realSaving": "Off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/bespoke/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.BespokeProduct": "On"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/otninformation/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.target": "",
|
||||
"x.com.samsung.da.newVersionAvailable": "false",
|
||||
"otnStatus": "None",
|
||||
"flashingProgress": "",
|
||||
"otnList": [
|
||||
{
|
||||
"type": "WIFI",
|
||||
"modelId": "A-RFWW-TP1-23-COMMON",
|
||||
"versions": [
|
||||
"20250422"
|
||||
],
|
||||
"visVersion": "250422"
|
||||
},
|
||||
{
|
||||
"type": "Micom",
|
||||
"modelId": "02120016804100168441",
|
||||
"versions": [
|
||||
"24101006",
|
||||
"23031302"
|
||||
],
|
||||
"visVersion": "241010"
|
||||
},
|
||||
{
|
||||
"type": "Micom",
|
||||
"modelId": "021270659241FFFFFFFF",
|
||||
"versions": [
|
||||
"24102200",
|
||||
"FFFFFFFF"
|
||||
],
|
||||
"visVersion": "241022"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/status/lock/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.ado.voicecontrol": "Off",
|
||||
"x.com.samsung.da.device.sound": "On"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/status/kimchi/onedoor/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.currentMode": "KIMCHI_STORAGE_NORMAL",
|
||||
"x.com.samsung.da.ripeStatus": "Off",
|
||||
"x.com.samsung.da.ripeRemaintime": "0",
|
||||
"x.com.samsung.da.rackCount": "8",
|
||||
"x.com.samsung.da.ripeTotaltime": "0",
|
||||
"x.com.samsung.da.supportMode": [
|
||||
"KIMCHI_STORAGE_NORMAL",
|
||||
"KIMCHI_STORAGE_COLD",
|
||||
"KIMCHI_STORAGE_WARM",
|
||||
"KIMCHI_STORAGE_CRUNFCH",
|
||||
"KIMCHI_STORAGE_BUY",
|
||||
"STORAGE_FRIDGE",
|
||||
"STORAGE_FREEZER",
|
||||
"KIMCHI_RIPE_NORMAL_TEMP",
|
||||
"KIMCHI_RIPE_LOW_TEMP",
|
||||
"NEWMODE_KIMCHI_0000",
|
||||
"NEWMODE_KIMCHI_0000",
|
||||
"NEWMODE_KIMCHI_0000"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/autodoor/timer/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.time.desired": "1",
|
||||
"x.com.samsung.da.time.supportedOptions": [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/autodoor/kimchi/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.ado.openOptions": [
|
||||
"Single"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/connectionconfig/vs/0",
|
||||
"rep": {
|
||||
"autoReconnectionMinVersion": "1.0",
|
||||
"autoReconnection": "true",
|
||||
"autoReconnectionProtocolType": [
|
||||
"ble_ocf",
|
||||
null
|
||||
],
|
||||
"supportedWiFiAuthType": [
|
||||
"OPEN",
|
||||
"WEP",
|
||||
"WPA-PSK",
|
||||
"WPA2-PSK",
|
||||
"SAE"
|
||||
],
|
||||
"supportedWiFiCryptoType": [
|
||||
"TKIP",
|
||||
"AES",
|
||||
"WEP-64",
|
||||
"WEP-128"
|
||||
],
|
||||
"supportedWiFiFreq": [
|
||||
"2.4G"
|
||||
],
|
||||
"calmConnectionCare": {
|
||||
"version": "1.0",
|
||||
"role": [
|
||||
"things"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/timezone/vs/0",
|
||||
"rep": {
|
||||
"timezoneid": "Asia/Seoul",
|
||||
"offset": "+09:00",
|
||||
"DST": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/wirelessinfo/vs/0",
|
||||
"rep": {
|
||||
"macaddressWiFi": "**REDACTED**",
|
||||
"macaddressBLE": "**REDACTED**"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/quickcontrol/info/vs/0",
|
||||
"rep": {
|
||||
"supportedVersion": "1.0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+466
@@ -0,0 +1,466 @@
|
||||
{
|
||||
"device0": [
|
||||
{
|
||||
"rt": [
|
||||
"x.com.samsung.devcol",
|
||||
"oic.wk.col"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.ll",
|
||||
"oic.if.b"
|
||||
]
|
||||
},
|
||||
{
|
||||
"href": "/alarms/vs/0",
|
||||
"rep": {
|
||||
"href": "/alarms/vs/0",
|
||||
"rt": [
|
||||
"x.com.samsung.da.alarms"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/autodoor/winecellar/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.ado.openOptions": [
|
||||
"Single"
|
||||
],
|
||||
"href": "/autodoor/winecellar/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/autodoor/timer/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.time.desired": "1",
|
||||
"x.com.samsung.da.time.supportedOptions": [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6"
|
||||
],
|
||||
"href": "/autodoor/timer/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/bespoke/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.BespokeProduct": "On",
|
||||
"href": "/bespoke/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/cabinet/light/total/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.lightLevel": "100",
|
||||
"x.com.samsung.da.lightResolution": "1",
|
||||
"x.com.samsung.da.lightControl.off.include": "Off",
|
||||
"x.com.samsung.da.lightControl": "Off",
|
||||
"x.com.samsung.da.timeout.desired": "0",
|
||||
"x.com.samsung.da.timeout.supportedList": [
|
||||
"0",
|
||||
"15",
|
||||
"30",
|
||||
"60"
|
||||
],
|
||||
"href": "/cabinet/light/total/vs/0",
|
||||
"rt": [
|
||||
"x.com.samsung.da.cabinetlight"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/configuration/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.region": "",
|
||||
"x.com.samsung.da.countryCode": "",
|
||||
"href": "/configuration/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/door/winecellar/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.openState": "Close",
|
||||
"href": "/door/winecellar/vs/0",
|
||||
"rt": [
|
||||
"x.com.samsung.da.doorwinecellar"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.s"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/doors/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.openState": "Close",
|
||||
"x.com.samsung.da.id": "9",
|
||||
"x.com.samsung.da.description": "Door"
|
||||
}
|
||||
],
|
||||
"href": "/doors/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/drlc/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.drlcLevel": "2",
|
||||
"x.com.samsung.da.override": "Not_Supported",
|
||||
"x.com.samsung.da.durationminutes": "1345",
|
||||
"x.com.samsung.da.start": "2026-08-06T02:08:48Z",
|
||||
"x.com.samsung.da.realSaving": "On",
|
||||
"href": "/drlc/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/energy/consumption/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.cumulativeConsumption": "19073",
|
||||
"x.com.samsung.da.instantaneousPower": "5",
|
||||
"x.com.samsung.da.cumulativePower": "210483",
|
||||
"x.com.samsung.da.cumulativeSavedPower": "15696",
|
||||
"x.com.samsung.da.cumulativeUnit": "Wh",
|
||||
"x.com.samsung.da.instantaneousPowerUnit": "W",
|
||||
"href": "/energy/consumption/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/file/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.timeoffset": "+00:00",
|
||||
"x.com.samsung.supprtedtype": 1,
|
||||
"href": "/file/information/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/filter/deodorfilter/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.filterUsage": "-1",
|
||||
"x.com.samsung.da.filterUsageResolution": "1",
|
||||
"x.com.samsung.da.filterResetType": [
|
||||
"replaceable"
|
||||
],
|
||||
"x.com.samsung.da.filterStatus": "normal",
|
||||
"href": "/filter/deodorfilter/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.modelNum": "TP1X_REF_21K|00146141|000B0020001513924100000011000000",
|
||||
"x.com.samsung.da.description": "TP1X_REF_21K",
|
||||
"x.com.samsung.da.serialNum": "**REDACTED**",
|
||||
"x.com.samsung.da.otnDUID": "**REDACTED**",
|
||||
"x.com.samsung.da.diagDumpType": "file",
|
||||
"x.com.samsung.da.diagEndPoint": "SSM",
|
||||
"x.com.samsung.da.diagLogType": [
|
||||
"errCode",
|
||||
"dump"
|
||||
],
|
||||
"x.com.samsung.da.diagMnid": "0AJT",
|
||||
"x.com.samsung.da.diagSetupid": "531",
|
||||
"x.com.samsung.da.diagProtocolType": "WIFI_HTTPS",
|
||||
"x.com.samsung.da.diagMinVersion": "1.0",
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "WiFi Module",
|
||||
"x.com.samsung.da.type": "Software",
|
||||
"x.com.samsung.da.number": "260619",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.id": "1",
|
||||
"x.com.samsung.da.description": "Micom",
|
||||
"x.com.samsung.da.type": "Firmware",
|
||||
"x.com.samsung.da.number": "24102313, 2201030E",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
}
|
||||
],
|
||||
"href": "/information/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/status/lock/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.ado.voicecontrol": "Off",
|
||||
"x.com.samsung.da.ado.soundcontrol": "On",
|
||||
"href": "/status/lock/vs/0",
|
||||
"rt": [
|
||||
"x.com.samsung.da.lockstatus"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/mode/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.modes": [
|
||||
"AIRFILTER_DISABLE"
|
||||
],
|
||||
"x.com.samsung.da.supportedModes": [
|
||||
"HOMECARE_WIZARD_V2",
|
||||
"ENERGY_REPORT_MODEL",
|
||||
"WINE_T_TOTRACK_[6]",
|
||||
"WINE_T_BOTTLE_RACK_[7]",
|
||||
"WINE_B_TOTRACK_[4]",
|
||||
"WINE_B_BOTTLE_RACK_[7]",
|
||||
"WINE_PRESENTATION_[6]",
|
||||
"WINE_BTM_BOTTLE_[20]",
|
||||
"WINE_PANTRY_BOTTLE_[5]"
|
||||
],
|
||||
"href": "/mode/vs/0",
|
||||
"rt": [
|
||||
"x.com.samsung.da.mode"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/realtimenotiforclient/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.timeforshortnoti": "0",
|
||||
"x.com.samsung.da.periodicnotisubscription": "true",
|
||||
"href": "/realtimenotiforclient/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/runningmode/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.runningMode": 0,
|
||||
"href": "/runningmode/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/selfcheck/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.supportedActions": [
|
||||
"Start"
|
||||
],
|
||||
"x.com.samsung.da.status": "Ready",
|
||||
"x.com.samsung.da.result": "Success",
|
||||
"x.com.samsung.da.error": [
|
||||
"ErrorCode_None"
|
||||
],
|
||||
"href": "/selfcheck/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/temperature/desired/winecellar/top/vs/0",
|
||||
"rep": {
|
||||
"temperature": 13.0,
|
||||
"range": [
|
||||
4.0,
|
||||
18.0
|
||||
],
|
||||
"units": "C",
|
||||
"href": "/temperature/desired/winecellar/top/vs/0",
|
||||
"rt": [
|
||||
"oic.r.temperature"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/temperature/desired/winecellar/bottom/vs/0",
|
||||
"rep": {
|
||||
"temperature": 7.0,
|
||||
"range": [
|
||||
4.0,
|
||||
18.0
|
||||
],
|
||||
"units": "C",
|
||||
"href": "/temperature/desired/winecellar/bottom/vs/0",
|
||||
"rt": [
|
||||
"oic.r.temperature"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.a"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/temperatures/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "2",
|
||||
"x.com.samsung.da.description": "WineCellar-top",
|
||||
"x.com.samsung.da.desired": "13",
|
||||
"x.com.samsung.da.current": "13",
|
||||
"x.com.samsung.da.maximum": "18",
|
||||
"x.com.samsung.da.minimum": "4",
|
||||
"x.com.samsung.da.unit": "Celsius"
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.id": "3",
|
||||
"x.com.samsung.da.description": "WineCellar-bottom",
|
||||
"x.com.samsung.da.desired": "7",
|
||||
"x.com.samsung.da.current": "7",
|
||||
"x.com.samsung.da.maximum": "18",
|
||||
"x.com.samsung.da.minimum": "4",
|
||||
"x.com.samsung.da.unit": "Celsius"
|
||||
}
|
||||
],
|
||||
"href": "/temperatures/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/information/winecellar/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.tbl.revision": "1",
|
||||
"href": "/information/winecellar/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/status/winecellar/pantry/one/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.mode": "Fruit",
|
||||
"x.com.samsung.range": [
|
||||
"4",
|
||||
"13"
|
||||
],
|
||||
"x.com.samsung.da.room": "0x10",
|
||||
"x.com.samsung.da.name": "MULTI_PANTRY",
|
||||
"x.com.samsung.da.unit": "Celsius",
|
||||
"x.com.samsung.da.supportedOptions": [
|
||||
"Processed_Meat",
|
||||
"Cheese",
|
||||
"Nuts",
|
||||
"Fruit",
|
||||
"Wine"
|
||||
],
|
||||
"href": "/status/winecellar/pantry/one/vs/0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/otninformation/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.target": "",
|
||||
"x.com.samsung.da.newVersionAvailable": "false",
|
||||
"otnStatus": "None",
|
||||
"flashingProgress": "0",
|
||||
"otnCompleteDate": "noHistory",
|
||||
"scheduledTime": "None",
|
||||
"swVersionInfo": {
|
||||
"platform": "Tizen Lite",
|
||||
"oneUiVersion": "7.0 Refrigerator",
|
||||
"osVersion": "4.0"
|
||||
},
|
||||
"otnList": [
|
||||
{
|
||||
"type": "WIFI",
|
||||
"modelId": "A-RFWW-TP1-24-T4-RE2",
|
||||
"versions": [
|
||||
"20260619"
|
||||
],
|
||||
"visVersion": "260619"
|
||||
},
|
||||
{
|
||||
"type": "Micom",
|
||||
"modelId": "02900014614100146441",
|
||||
"versions": [
|
||||
"24102313",
|
||||
"2201030E"
|
||||
],
|
||||
"visVersion": "241023"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/timezone/vs/0",
|
||||
"rep": {
|
||||
"timezoneid": "Asia/Seoul",
|
||||
"offset": "+09:00",
|
||||
"DST": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/connectionconfig/vs/0",
|
||||
"rep": {
|
||||
"autoReconnectionMinVersion": "1.0",
|
||||
"autoReconnection": "true",
|
||||
"autoReconnectionProtocolType": [
|
||||
"helper_hotspot",
|
||||
"ble_ocf"
|
||||
],
|
||||
"supportedWiFiAuthType": [
|
||||
"OPEN",
|
||||
"WEP",
|
||||
"WPA-PSK",
|
||||
"WPA2-PSK",
|
||||
"SAE"
|
||||
],
|
||||
"supportedWiFiCryptoType": [
|
||||
"TKIP",
|
||||
"AES",
|
||||
"WEP-64",
|
||||
"WEP-128"
|
||||
],
|
||||
"supportedWiFiFreq": [
|
||||
"2.4G"
|
||||
],
|
||||
"calmConnectionCare": {
|
||||
"version": "1.0",
|
||||
"role": [
|
||||
"things"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/wirelessinfo/vs/0",
|
||||
"rep": {
|
||||
"macaddressWiFi": "**REDACTED**",
|
||||
"macaddressBLE": "**REDACTED**",
|
||||
"connectedApSsid": "Home_IoT"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/quickcontrol/info/vs/0",
|
||||
"rep": {
|
||||
"supportedVersion": "1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/dginformation/vs/0",
|
||||
"rep": {
|
||||
"enrolmentstatus": "Unknown",
|
||||
"devicestate": "Unknown",
|
||||
"lockstatus": "Unknown",
|
||||
"nextduedate": "",
|
||||
"workingminutes": 0,
|
||||
"paymentinfo": {
|
||||
"emiplan": "Unknown",
|
||||
"currency": "Unknown",
|
||||
"totalemi": 0,
|
||||
"totalemipaid": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+452
@@ -0,0 +1,452 @@
|
||||
{
|
||||
"device0": [
|
||||
{
|
||||
"rt": [
|
||||
"x.com.samsung.devcol",
|
||||
"oic.wk.col"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.ll",
|
||||
"oic.if.b"
|
||||
]
|
||||
},
|
||||
{
|
||||
"href": "/realtimenotiforclient/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.timeforshortnoti": "10",
|
||||
"x.com.samsung.da.periodicnotisubscription": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/alarms/vs/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/diagnosis/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.diagnosisStart": "Ready"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/energy/consumption/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.instantaneousPower": "-500",
|
||||
"x.com.samsung.da.instantaneousPowerUnit": "W",
|
||||
"x.com.samsung.da.cumulativePower": "74800",
|
||||
"x.com.samsung.da.cumulativeUnit": "Wh",
|
||||
"x.com.samsung.da.cumulativeDate": "1786287600",
|
||||
"x.com.samsung.da.cumulativeDateUTC": "1786280400",
|
||||
"x.com.samsung.da.cumulativeSavedPower": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/energy/consumption/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/course/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.supportedModes": [
|
||||
"HOMECARE_WIZARD_V2"
|
||||
],
|
||||
"x.com.samsung.da.options": [
|
||||
"DeviceType_0167",
|
||||
"UpdateAllow_NotAllowed",
|
||||
"Course_87",
|
||||
"LaundryOutTime_0",
|
||||
"SeamlessControl_Enable",
|
||||
"KidsLockBypass_On",
|
||||
"WashingTimes_0",
|
||||
"DrumCleanProposal_40",
|
||||
"DetergentOnce_0",
|
||||
"DetergentLeft_0",
|
||||
"DetergentBase_0",
|
||||
"DetergentAlarm_Off",
|
||||
"DetergentType_0",
|
||||
"DetergentTotal_0",
|
||||
"SoftenerOnce_0",
|
||||
"SoftenerLeft_0",
|
||||
"SoftenerBase_0",
|
||||
"SoftenerAlarm_Off",
|
||||
"SoftenerType_0",
|
||||
"SoftenerTotal_0",
|
||||
"SpecialFunction_4",
|
||||
"AvailableDelayTime_74",
|
||||
"BubbleSoak_Off",
|
||||
"LaundryPlannerUserSetTime_0",
|
||||
"ProgressTimeSet_421C20820437A2042C",
|
||||
"SendToDevice_On",
|
||||
"GMT_04",
|
||||
"PreWashSetting_Off",
|
||||
"IntensiveSetting_Off",
|
||||
"CloudCourse_0021550449284D134AA04C0035F004F005F0AC00",
|
||||
"CloudExtraCourse_0A5C286B2D0C55301A",
|
||||
"OneTimeCloudCourse_001F6B0449284D134AA04C0035F004F005F0AC00",
|
||||
"BubbleSoakSet_00F0F0F00000F0F000000000F000",
|
||||
"EnergyLevelSet_050304040501050404030201020401",
|
||||
"MostUsed_1B841E923FA67F00000000000000",
|
||||
"PreWashAvailableSet_F0F0F0F00000F0F000F0F000F000",
|
||||
"IntensiveAvailableSet_F0F0F0F00000F0F000F0F000F000",
|
||||
"TextureLevel_None",
|
||||
"SavingModeCondition_010102151C1BA0961C8F251C0A061A207F5C55656B0C2D3034030149035E2830",
|
||||
"SavingMode_Off",
|
||||
"WelcomeLighting_1",
|
||||
"SupportedWelcomeLighting_000102",
|
||||
"GeoFenceAlarm",
|
||||
"UsagesDB_ok",
|
||||
"EnergyKW_396",
|
||||
"DrumCleanLog_2025-08-18T14:56:34|2025-11-02T21:08:39|2026-01-19T13:00:50|2026-03-23T12:10:12|2026-06-27T11:07:22|2026-08-09T10:13:44",
|
||||
"TimeSync_NotSupported"
|
||||
],
|
||||
"x.com.samsung.da.supportedOptions": [
|
||||
"31C8410923FA67F1B847E923FA67F25843E933FA57F20857E943FA67F088000913FA67F7485209204A5208780009000A00006841E930FA30F7F841E920FA30F65841E943FA57F8F8102923FA57F96841E920FA37F34841E923FA67FA0811E933FA33F"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/power/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.power": "On"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/power/0",
|
||||
"rep": {
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/cycleinterface/vs/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/kidslock/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.kidsLock": "Ready"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/kidslock/0",
|
||||
"rep": {
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/operational/state/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.state": "Ready",
|
||||
"x.com.samsung.da.remainingTime": "01:14:00",
|
||||
"x.com.samsung.da.progressPercentage": "1",
|
||||
"x.com.samsung.da.progress": "None",
|
||||
"x.com.samsung.da.delayEndTime": "00:00:00",
|
||||
"x.com.samsung.da.supportedProgress": [
|
||||
"None",
|
||||
"Wash",
|
||||
"Rinse",
|
||||
"Spin",
|
||||
"Finish"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/operational/state/0",
|
||||
"rep": {
|
||||
"currentMachineState": "**REDACTED**",
|
||||
"machineStates": "**REDACTED**",
|
||||
"jobStates": [
|
||||
"None",
|
||||
"Wash",
|
||||
"Rinse",
|
||||
"Spin",
|
||||
"Finish"
|
||||
],
|
||||
"currentJobState": "None",
|
||||
"remainingTime": "01:14:00",
|
||||
"progressPercentage": "1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.modelNum": "DA_WM_TP1_21_COMMON|20348141|20010002001711124ACB020200080000",
|
||||
"x.com.samsung.da.description": "DA_WM_TP1_21_COMMON_WW5000C/DC92-03495A_B06C",
|
||||
"x.com.samsung.da.serialNum": "**REDACTED**",
|
||||
"x.com.samsung.da.otnDUID": "**REDACTED**",
|
||||
"x.com.samsung.da.diagProtocolType": "BLE_OCF",
|
||||
"x.com.samsung.da.diagLogType": [
|
||||
"errCode",
|
||||
"dump"
|
||||
],
|
||||
"x.com.samsung.da.diagDumpType": "file",
|
||||
"x.com.samsung.da.diagEndPoint": "SSM",
|
||||
"x.com.samsung.da.diagMnid": "0AJT",
|
||||
"x.com.samsung.da.diagSetupid": "WF1",
|
||||
"x.com.samsung.da.diagMinVersion": "3.0",
|
||||
"x.com.samsung.da.diagTsId": "DA01",
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "DA_WM_TP1_21_COMMON|20348141|20010002001711124ACB020200080000",
|
||||
"x.com.samsung.da.type": "Software",
|
||||
"x.com.samsung.da.number": "02986A260118(A182)",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.id": "1",
|
||||
"x.com.samsung.da.description": "Firmware_1_DB_20348141240110090FFFFF203495412406195503FFFF(01672034814120349541_30000000)(FileDown:0)(Type:0)",
|
||||
"x.com.samsung.da.type": "Firmware",
|
||||
"x.com.samsung.da.number": "03481A24011009,03495A24061955",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.id": "2",
|
||||
"x.com.samsung.da.description": "Firmware_2_DB_2025984624053003032FFFFFFFFFFFFFFFFFFFFFFFFE(016720259846FFFFFFFF_30000000)(FileDown:0)(Type:0)",
|
||||
"x.com.samsung.da.type": "Firmware",
|
||||
"x.com.samsung.da.number": "02598F24053003,FFFFFFFFFFFFFF"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/file/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.timeoffset": "+02:00"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/washer/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.waterTemperature": "30",
|
||||
"x.com.samsung.da.supportedWaterTemperature": [
|
||||
"None",
|
||||
"Cold",
|
||||
"20",
|
||||
"30",
|
||||
"40",
|
||||
"60",
|
||||
"90"
|
||||
],
|
||||
"x.com.samsung.da.spinLevel": "800",
|
||||
"x.com.samsung.da.supportedSpinLevel": [
|
||||
"RinseHold",
|
||||
"NoSpin",
|
||||
"400",
|
||||
"800",
|
||||
"1000",
|
||||
"1200",
|
||||
"1400"
|
||||
],
|
||||
"x.com.samsung.da.rinseCycles": "3",
|
||||
"x.com.samsung.da.supportedRinseCycles": [
|
||||
"0",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/st/washercourse/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.st.washerMode": "Table_02_Course_87",
|
||||
"x.com.samsung.da.st.courseTable": "Table_02"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/water/consumption/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.cumulativeWater": "7512800"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/setting/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.supportedSetLanguage": [
|
||||
"ko_KR",
|
||||
"en_US"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/wm/editcourse/vs/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/wm/setinfo/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.isModelSettingWithoutSC": "true",
|
||||
"x.com.samsung.da.isModelSettingPowerOnOff": "false",
|
||||
"x.com.samsung.da.modelCode": "M(None),W(WW8XCGC04AAEEG)"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/wm/jobbeginingstatus/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.currentStatus": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/otninformation/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.target": "",
|
||||
"x.com.samsung.da.newVersionAvailable": "false",
|
||||
"x.com.samsung.da.newVersionNo": "00000000",
|
||||
"x.com.samsung.da.currentVersionInfo": "00000000",
|
||||
"otnStatus": "None",
|
||||
"flashingProgress": "",
|
||||
"otnTarget": "main",
|
||||
"otnCompleteDate": "2026-03-04",
|
||||
"otnList": [
|
||||
{
|
||||
"type": "WIFI",
|
||||
"modelId": "DA_WM_TP1_21_COMMON",
|
||||
"versions": [
|
||||
"30260118"
|
||||
],
|
||||
"visVersion": "260118"
|
||||
},
|
||||
{
|
||||
"type": "Micom",
|
||||
"modelId": "01672034814120349541",
|
||||
"versions": [
|
||||
"24011009",
|
||||
"24061955"
|
||||
],
|
||||
"visVersion": "240619"
|
||||
},
|
||||
{
|
||||
"type": "Micom",
|
||||
"modelId": "016720259846FFFFFFFF",
|
||||
"versions": [
|
||||
"24053003",
|
||||
"FFFFFFFF"
|
||||
],
|
||||
"visVersion": "240530"
|
||||
},
|
||||
{
|
||||
"type": "Micom",
|
||||
"modelId": "016720259846FFFFFFFF",
|
||||
"versions": [
|
||||
"24053003",
|
||||
"FFFFFFFF"
|
||||
],
|
||||
"visVersion": "240530"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/buzzersound/vs/0",
|
||||
"rep": {
|
||||
"supportedBuzzerSound": [
|
||||
"Volume_Off",
|
||||
"Volume_Low",
|
||||
"Volume_Med",
|
||||
"Volume_High"
|
||||
],
|
||||
"setBuzzerSound": "Volume_Low",
|
||||
"supportedFinishSound": [
|
||||
"FinishSound_1",
|
||||
"FinishSound_2",
|
||||
"FinishSound_3"
|
||||
],
|
||||
"setFinishSound": "FinishSound_2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/remotectrl/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.remoteControlEnabled": "false"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/remotectrl/0",
|
||||
"rep": {
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/configuration/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.region": "0000000000",
|
||||
"x.com.samsung.da.countryCode": "DE"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/drlc/0",
|
||||
"rep": {
|
||||
"DRLevel": 0,
|
||||
"start": "0000-00-00T00:00:00Z",
|
||||
"duration": 0,
|
||||
"override": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/drlc/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.drlcLevel": "0",
|
||||
"x.com.samsung.da.durationminutes": "0",
|
||||
"x.com.samsung.da.start": "0000-00-00T00:00:00Z",
|
||||
"x.com.samsung.da.override": "Off",
|
||||
"x.com.samsung.da.realSaving": "Off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/timezone/vs/0",
|
||||
"rep": {
|
||||
"timezoneid": "Europe/Berlin",
|
||||
"offset": "+02:00",
|
||||
"DST": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/connectionconfig/vs/0",
|
||||
"rep": {
|
||||
"autoReconnectionMinVersion": "1.0",
|
||||
"autoReconnection": "true",
|
||||
"autoReconnectionProtocolType": [
|
||||
"helper_hotspot",
|
||||
"ble_ocf"
|
||||
],
|
||||
"supportedWiFiAuthType": [
|
||||
"OPEN",
|
||||
"WEP",
|
||||
"WPA-PSK",
|
||||
"WPA2-PSK",
|
||||
"SAE"
|
||||
],
|
||||
"supportedWiFiCryptoType": [
|
||||
"TKIP",
|
||||
"AES",
|
||||
"WEP-64",
|
||||
"WEP-128"
|
||||
],
|
||||
"supportedWiFiFreq": [
|
||||
"2.4G"
|
||||
],
|
||||
"calmConnectionCare": {
|
||||
"version": "1.0",
|
||||
"role": [
|
||||
"things"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/wirelessinfo/vs/0",
|
||||
"rep": {
|
||||
"macaddressWiFi": "**REDACTED**",
|
||||
"macaddressBLE": "**REDACTED**"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/quickcontrol/info/vs/0",
|
||||
"rep": {
|
||||
"supportedVersion": "1.0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -238,6 +238,11 @@ class FakeSession:
|
||||
|
||||
instances: ClassVar[list[FakeSession]] = []
|
||||
reject_certs: ClassVar[set[str]] = set()
|
||||
# smartthings-local >= 0.1.3 ("redacted typed failures") no longer puts
|
||||
# the alert in connect()'s exception text -- set True to model that, so
|
||||
# a test can check the diagnostic-handshake fallback (_resolve_alert)
|
||||
# instead of the legacy _alert_name text-parsing path.
|
||||
redact_rejection: ClassVar[bool] = False
|
||||
|
||||
def __init__(self, host, port, cert_pem=None, key_pem=None, **kwargs):
|
||||
self.host, self.port, self.cert_pem = host, port, cert_pem
|
||||
@@ -245,6 +250,10 @@ class FakeSession:
|
||||
|
||||
def connect(self):
|
||||
if self.cert_pem in FakeSession.reject_certs:
|
||||
if FakeSession.redact_rejection:
|
||||
from smartthings_local.errors import SessionError
|
||||
|
||||
raise SessionError()
|
||||
raise ConnectionError(
|
||||
"DTLS handshake error: [('SSL routines', '', 'sslv3 alert bad certificate')]"
|
||||
)
|
||||
@@ -268,6 +277,7 @@ def fake_dtls(monkeypatch):
|
||||
|
||||
FakeSession.instances = []
|
||||
FakeSession.reject_certs = set()
|
||||
FakeSession.redact_rejection = False
|
||||
monkeypatch.setattr(config_flow, "_fetch_samsung_uuid", lambda: "test-uuid")
|
||||
monkeypatch.setattr(
|
||||
config_flow,
|
||||
@@ -480,6 +490,77 @@ async def test_rejected_reused_leaf_is_reminted(
|
||||
assert [s.cert_pem for s in FakeSession.instances] == [MOCK_LEAF_CERT_PEM, "FULLCHAIN"]
|
||||
|
||||
|
||||
async def test_rejected_reused_leaf_is_reminted_against_a_redacted_library(
|
||||
hass: HomeAssistant, monkeypatch, fake_dtls
|
||||
) -> None:
|
||||
"""Same flow as test_rejected_reused_leaf_is_reminted, but against a
|
||||
connect() failure shaped like smartthings-local >= 0.1.3 -- a fixed,
|
||||
redacted exception with no alert text at all (see errors.py's
|
||||
"Classified errors"). The re-mint decision has to come from
|
||||
_resolve_alert's diagnostic-handshake fallback instead of _alert_name."""
|
||||
from custom_components.localthings import config_flow
|
||||
|
||||
existing = MockConfigEntry(domain=DOMAIN, data=ENTRY_DATA, unique_id="localthings_other")
|
||||
existing.add_to_hass(hass)
|
||||
_patch_clienthello(monkeypatch, {49154})
|
||||
FakeSession.reject_certs = {MOCK_LEAF_CERT_PEM}
|
||||
FakeSession.redact_rejection = True
|
||||
|
||||
class _DiagnosticResult:
|
||||
alert = (2, "bad_certificate")
|
||||
|
||||
diagnosed: list[int] = []
|
||||
|
||||
def _diagnostic_alert(host, port, cert_pem, key_pem):
|
||||
diagnosed.append(port)
|
||||
return _DiagnosticResult()
|
||||
|
||||
monkeypatch.setattr(config_flow, "_diagnostic_alert", _diagnostic_alert)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(DOMAIN, context={"source": "user"})
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_HOST: MOCK_HOST}
|
||||
)
|
||||
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_LEAF_CERT_PEM] == "FULLCHAIN"
|
||||
assert [s.cert_pem for s in FakeSession.instances] == [MOCK_LEAF_CERT_PEM, "FULLCHAIN"]
|
||||
assert diagnosed == [49154]
|
||||
|
||||
|
||||
def test_diagnostic_handshake_runs_once_not_once_per_failing_port(monkeypatch) -> None:
|
||||
"""_diagnostic_alert commits association state on the device (see its
|
||||
own docstring) -- running it once per failing candidate instead of once
|
||||
overall would both add latency (each is its own bounded handshake) and
|
||||
multiply that pollution right before _probe_and_validate might retry a
|
||||
real handshake against these very same ports. Three candidates fail
|
||||
here; the diagnostic must run exactly once, against the confirmed-live
|
||||
port, not three times against every candidate in scan order."""
|
||||
from custom_components.localthings import config_flow
|
||||
|
||||
FakeSession.instances = []
|
||||
FakeSession.reject_certs = {MOCK_LEAF_CERT_PEM}
|
||||
FakeSession.redact_rejection = True
|
||||
monkeypatch.setattr("smartthings_local.protocol.dtls_session.DtlsCoapSession", FakeSession)
|
||||
|
||||
diagnosed: list[int] = []
|
||||
|
||||
class _DiagnosticResult:
|
||||
alert = (2, "bad_certificate")
|
||||
|
||||
def _diagnostic_alert(host, port, cert_pem, key_pem):
|
||||
diagnosed.append(port)
|
||||
return _DiagnosticResult()
|
||||
|
||||
monkeypatch.setattr(config_flow, "_diagnostic_alert", _diagnostic_alert)
|
||||
|
||||
scan = _scan(confirmed=[49153, 49154], candidates=[49153, 49154, 49155])
|
||||
with pytest.raises(config_flow.CertRejected):
|
||||
config_flow._handshake_and_read(MOCK_HOST, scan, MOCK_LEAF_CERT_PEM, "KEY")
|
||||
|
||||
assert diagnosed == [49153] # confirmed-live, and only once
|
||||
|
||||
|
||||
async def test_unconfirmed_port_failure_is_not_reminted(
|
||||
hass: HomeAssistant, monkeypatch, fake_dtls
|
||||
) -> None:
|
||||
@@ -554,6 +635,92 @@ def test_cert_alert_is_reported_as_a_certificate_problem() -> None:
|
||||
assert err.error_key == "cert_rejected"
|
||||
|
||||
|
||||
def test_classify_handshake_failure_uses_a_resolved_alert_over_exception_text() -> None:
|
||||
"""_handshake_and_read passes its own resolved `alerts` mapping (built
|
||||
via _resolve_alert, which is what actually classifies a failure against
|
||||
smartthings-local >= 0.1.3's redacted exceptions) -- it must win even
|
||||
when the exception text itself says nothing."""
|
||||
from custom_components.localthings.config_flow import (
|
||||
CertRejected,
|
||||
_classify_handshake_failure,
|
||||
)
|
||||
|
||||
err = _classify_handshake_failure(
|
||||
MOCK_HOST,
|
||||
_scan(confirmed=[49154]),
|
||||
[(49154, RuntimeError("session operation failed"))],
|
||||
{49154: "bad_certificate"},
|
||||
)
|
||||
assert isinstance(err, CertRejected)
|
||||
assert err.error_key == "cert_rejected"
|
||||
|
||||
|
||||
def test_resolve_alert_prefers_exception_text_over_the_diagnostic_handshake() -> None:
|
||||
"""A library still stamping the alert into its exception text (< 0.1.3)
|
||||
answers for free; the diagnostic handshake must not run at all then."""
|
||||
from custom_components.localthings.config_flow import _resolve_alert
|
||||
|
||||
def _must_not_run(*args, **kwargs):
|
||||
raise AssertionError("must not run the diagnostic handshake")
|
||||
|
||||
with patch("custom_components.localthings.config_flow._diagnostic_alert", _must_not_run):
|
||||
name = _resolve_alert(
|
||||
_openssl_alert("tlsv1 alert unknown ca"), MOCK_HOST, 49154, "CERT", "KEY"
|
||||
)
|
||||
assert name == "unknown_ca"
|
||||
|
||||
|
||||
def test_resolve_alert_falls_back_to_the_diagnostic_handshake() -> None:
|
||||
"""smartthings-local >= 0.1.3 redacts the exception text (see errors.py's
|
||||
"Classified errors"), so the only way left to learn *why* a handshake
|
||||
failed is the library's own classification of the raw alert record."""
|
||||
from smartthings_local.errors import SessionError
|
||||
|
||||
from custom_components.localthings import config_flow
|
||||
|
||||
class _Result:
|
||||
alert = (2, "bad_certificate")
|
||||
|
||||
with patch.object(config_flow, "_diagnostic_alert", lambda *a, **k: _Result()):
|
||||
name = config_flow._resolve_alert(SessionError(), MOCK_HOST, 49154, "CERT", "KEY")
|
||||
assert name == "bad_certificate"
|
||||
|
||||
|
||||
def test_resolve_alert_ignores_a_non_fatal_alert() -> None:
|
||||
"""ProbeResult.alert is set for a *received* alert of either level, but
|
||||
only a fatal one (2) means the appliance actually broke off the
|
||||
handshake over it -- a warning-level alert (e.g. close_notify on an
|
||||
otherwise ordinary close) is not evidence of a rejection. The old
|
||||
exception-text path never had this ambiguity: OpenSSL's exception only
|
||||
ever rendered for a fatal alert, so nothing pre-0.1.3 could confuse the
|
||||
two -- the diagnostic-handshake fallback must not introduce the mix-up."""
|
||||
from smartthings_local.errors import SessionError
|
||||
|
||||
from custom_components.localthings import config_flow
|
||||
|
||||
class _Result:
|
||||
alert = (1, "close_notify") # warning level, not fatal
|
||||
|
||||
with patch.object(config_flow, "_diagnostic_alert", lambda *a, **k: _Result()):
|
||||
name = config_flow._resolve_alert(SessionError(), MOCK_HOST, 49154, "CERT", "KEY")
|
||||
assert name is None
|
||||
|
||||
|
||||
def test_resolve_alert_is_none_when_the_diagnostic_handshake_also_fails() -> None:
|
||||
"""A best-effort extra probe: its own failure must not raise out of
|
||||
_resolve_alert, it just leaves the caller with no alert to report."""
|
||||
from smartthings_local.errors import SessionError, SessionTimeoutError
|
||||
|
||||
from custom_components.localthings import config_flow
|
||||
|
||||
def _boom(*args, **kwargs):
|
||||
raise SessionTimeoutError()
|
||||
|
||||
with patch.object(config_flow, "_diagnostic_alert", _boom):
|
||||
name = config_flow._resolve_alert(SessionError(), MOCK_HOST, 49154, "CERT", "KEY")
|
||||
assert name is None
|
||||
|
||||
|
||||
def test_non_cert_alert_is_kept_distinct_from_a_cert_problem() -> None:
|
||||
"""A cipher or version mismatch is also a deliberate refusal, but no
|
||||
amount of fiddling with CA credentials will fix it."""
|
||||
|
||||
@@ -13,6 +13,7 @@ from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ServiceValidationError
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from smartthings_local.errors import SessionClosedError, SessionError, SessionTimeoutError
|
||||
|
||||
from custom_components.localthings.const import (
|
||||
CONF_BYPASS_REMOTE_CONTROL,
|
||||
@@ -70,7 +71,12 @@ async def test_summary_interval(hass: HomeAssistant, mock_entry, mock_coordinato
|
||||
|
||||
|
||||
async def test_update_failed_on_persistent_poll_error(hass: HomeAssistant, mock_entry) -> None:
|
||||
"""ConfigEntryNotReady raised when poll fails even after reconnect."""
|
||||
"""ConfigEntryNotReady raised when poll fails even after reconnect.
|
||||
|
||||
An entry with no stored discovery snapshot has never reached this device,
|
||||
so there is nothing to load offline from (issue #295) -- it stays on HA's
|
||||
backoff rather than loading empty.
|
||||
"""
|
||||
|
||||
with (
|
||||
patch("custom_components.localthings.coordinator.LocalThingsCoordinator._connect_session"),
|
||||
@@ -531,6 +537,36 @@ async def test_total_poll_failure_downgrades_observe_mode_to_poll(
|
||||
assert coordinator.last_update_success is True
|
||||
|
||||
|
||||
def test_defer_reconnect_for_reconnects_immediately_on_a_confirmed_dead_session(
|
||||
hass: HomeAssistant, mock_entry
|
||||
) -> None:
|
||||
"""smartthings-local >= 0.1.6 raises SessionClosedError -- a
|
||||
ConnectionError, not a TimeoutError -- the moment a dead reader thread
|
||||
is confirmed, instead of the old behavior of letting the request hang
|
||||
out to its own timeout and surface as an ambiguous TimeoutError.
|
||||
_defer_reconnect_for must never extend the block-ACK tolerance to a
|
||||
failure this unambiguous; see its docstring for the full reasoning."""
|
||||
coordinator = LocalThingsCoordinator(hass, mock_entry)
|
||||
coordinator._discovered = True
|
||||
|
||||
assert coordinator._defer_reconnect_for(SessionClosedError()) is False
|
||||
|
||||
|
||||
def test_defer_reconnect_for_still_tolerates_an_ambiguous_timeout(
|
||||
hass: HomeAssistant, mock_entry
|
||||
) -> None:
|
||||
"""The other half of the same distinction: a plain block-ACK timeout --
|
||||
still a TimeoutError, including smartthings-local's own
|
||||
SessionTimeoutError subclass -- keeps its multi-cycle tolerance rather
|
||||
than being swept into the immediate-reconnect path above."""
|
||||
coordinator = LocalThingsCoordinator(hass, mock_entry)
|
||||
coordinator._discovered = True
|
||||
|
||||
for _ in range(coordinator._POLL_TIMEOUT_LIMIT - 1):
|
||||
assert coordinator._defer_reconnect_for(SessionTimeoutError()) is True
|
||||
assert coordinator._defer_reconnect_for(SessionTimeoutError()) is False
|
||||
|
||||
|
||||
async def test_poll_timeout_skips_reconnect_when_push_is_healthy(
|
||||
hass: HomeAssistant, mock_entry, mock_coordinator_observe_session
|
||||
) -> None:
|
||||
@@ -786,6 +822,38 @@ async def test_attempt_observe_mode_discards_stale_commit_after_session_swap(
|
||||
assert coordinator._resubscribe_due is True
|
||||
|
||||
|
||||
async def test_attempt_observe_mode_survives_a_failed_reconnect(
|
||||
hass: HomeAssistant, mock_entry, mock_coordinator_observe_session
|
||||
) -> None:
|
||||
"""The session was closed out from under this attempt concurrently
|
||||
(rare, but real -- see the docstring above), and the reconnect it tries
|
||||
on the way back in fails too (smartthings-local >= 0.1.3's redacted
|
||||
SessionError, or any other exception). That must not escape
|
||||
_async_update_data uncaught: it should land in the same "give up on
|
||||
push this cycle" state the subscribe-failed and stale-session branches
|
||||
already produce, not skip this integration's own logging/state handling
|
||||
entirely."""
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
coordinator: LocalThingsCoordinator = hass.data[DOMAIN][mock_entry.entry_id]
|
||||
coordinator._session = None
|
||||
coordinator._reconnect_times = []
|
||||
|
||||
with patch.object(
|
||||
coordinator,
|
||||
"_connect_session",
|
||||
side_effect=SessionError(),
|
||||
):
|
||||
await coordinator._attempt_observe_mode() # must not raise
|
||||
|
||||
assert coordinator.observe_mode == MODE_POLL
|
||||
assert coordinator._observe.subscribed_hrefs == set()
|
||||
assert coordinator._resubscribe_due is False
|
||||
# Not the poll path's own reconnect-frequency window (see the fix's
|
||||
# comment) -- this failure must not count toward it.
|
||||
assert coordinator._reconnect_times == []
|
||||
|
||||
|
||||
async def test_maybe_retry_observe_mode_uses_most_recent_attempt_not_just_mode_change(
|
||||
hass: HomeAssistant, mock_entry, mock_coordinator_observe_session
|
||||
) -> None:
|
||||
@@ -1761,10 +1829,11 @@ async def test_first_refresh_timeout_recovers_via_reconnect(
|
||||
async def test_first_refresh_persistent_timeout_fails_setup(
|
||||
hass: HomeAssistant, mock_entry
|
||||
) -> None:
|
||||
"""When the reconnect times out too, the first refresh must fail so HA
|
||||
retries on its backoff -- not load an entity-less entry. The session it
|
||||
left open is closed on the way out (`_poll_once` keeps it up on a
|
||||
`TimeoutError`, and the source port is fixed per device)."""
|
||||
"""With no snapshot to load from, a reconnect that times out too must
|
||||
fail the first refresh so HA retries on its backoff -- not load an
|
||||
entity-less entry. The session it left open is closed on the way out
|
||||
(`_poll_once` keeps it up on a `TimeoutError`, and the source port is
|
||||
fixed per device)."""
|
||||
with (
|
||||
patch("custom_components.localthings.coordinator.LocalThingsCoordinator._connect_session"),
|
||||
patch(
|
||||
|
||||
@@ -38,7 +38,9 @@ async def test_migration_recovers_serial_from_unique_id(
|
||||
await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert entry.version == 2
|
||||
# Straight through to the current version: v2 -> v3 is a statistics
|
||||
# relabel that no-ops for a family without particulate sensors.
|
||||
assert entry.version == 3
|
||||
assert entry.data[CONF_SERIAL] == MOCK_SERIAL
|
||||
|
||||
|
||||
@@ -257,7 +259,7 @@ async def test_migration_rejects_a_future_entry_version(hass: HomeAssistant) ->
|
||||
written by a newer release."""
|
||||
from custom_components.localthings import async_migrate_entry
|
||||
|
||||
entry = MockConfigEntry(domain=DOMAIN, data=LEGACY_ENTRY_DATA, version=3)
|
||||
entry = MockConfigEntry(domain=DOMAIN, data=LEGACY_ENTRY_DATA, version=4)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
assert await async_migrate_entry(hass, entry) is False
|
||||
|
||||
@@ -58,6 +58,49 @@ def test_apply_merges_partial_update_onto_prior_rep():
|
||||
assert cached["x.com.samsung.da.supportedOptions"] == ["CV_FDR_WINE", "CV_FDR_MEAT"]
|
||||
|
||||
|
||||
def test_apply_fully_replaces_alarms_href_instead_of_merging():
|
||||
"""Regression test for issue #348: /alarms/vs/0's `items` array is a
|
||||
complete snapshot of every currently-active alarm, not a partial field
|
||||
update like /mode/vs/0 (issue #27). A washer's board reports a cleared
|
||||
alarm by omitting `items` entirely -- a live read_resource GET showed
|
||||
`{}` -- so merging that onto the prior rep (as every other href does)
|
||||
left the stale ErrorCode_DC entry in the cache forever. This must
|
||||
instead behave like a full replace: the empty rep wins outright."""
|
||||
mgr = _manager()
|
||||
active = {
|
||||
"x.com.samsung.da.items": [
|
||||
{"x.com.samsung.da.code": "ErrorCode_DC", "x.com.samsung.da.state": "Created"}
|
||||
]
|
||||
}
|
||||
mgr.apply("/alarms/vs/0", active, source="poll")
|
||||
assert mgr.cache.get("/alarms/vs/0") == active
|
||||
|
||||
cleared = mgr.apply("/alarms/vs/0", {}, source="poll")
|
||||
|
||||
assert cleared is True
|
||||
assert mgr.cache.get("/alarms/vs/0") == {}
|
||||
|
||||
|
||||
def test_apply_fully_replaces_alarms_href_for_subdevice_shapes():
|
||||
"""The same full-replace behavior must hold for both hrefs
|
||||
`Subdevice.to_actual` can produce: an indexed subdevice renumbers only
|
||||
the trailing '0' (/alarms/vs/1), and a prefixed one prepends a UUID
|
||||
(/<uuid>/alarms/vs/0) -- neither ever touches the 'alarms/vs' stem
|
||||
itself (registry/subdevices.py)."""
|
||||
for href in ("/alarms/vs/1", "/6c2dff6d-ee5c-dad1-6a5e-000000000001/alarms/vs/0"):
|
||||
mgr = _manager()
|
||||
mgr.apply(
|
||||
href,
|
||||
{"x.com.samsung.da.items": [{"x.com.samsung.da.code": "ErrorCode_UB"}]},
|
||||
source="poll",
|
||||
)
|
||||
|
||||
cleared = mgr.apply(href, {}, source="poll")
|
||||
|
||||
assert cleared is True
|
||||
assert mgr.cache.get(href) == {}
|
||||
|
||||
|
||||
def test_apply_drops_update_during_settle_window():
|
||||
mgr = _manager()
|
||||
mgr.cache.apply_rep("/oven/vs/0", {"a": 1}, source="seed")
|
||||
|
||||
@@ -0,0 +1,418 @@
|
||||
"""Loading a config entry while the appliance is unreachable (issue #295).
|
||||
|
||||
The device's entity set only exists as the output of a live poll, so coming
|
||||
up offline means replaying the last successful discovery from a stored
|
||||
snapshot. These tests pin the four things that makes load-bearing: the
|
||||
snapshot gets written, it produces the same entity set offline, the
|
||||
coordinator keeps polling until the device answers, and a live discovery that
|
||||
disagrees with the snapshot reloads the entry rather than silently keeping a
|
||||
stale set.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from contextlib import contextmanager
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from homeassistant.util import dt as dt_util
|
||||
from pytest_homeassistant_custom_component.common import async_fire_time_changed
|
||||
|
||||
from custom_components.localthings.const import DOMAIN, SUMMARY_INTERVAL_S
|
||||
from custom_components.localthings.coordinator import LocalThingsCoordinator
|
||||
from custom_components.localthings.registry.identity import DeviceIdentity
|
||||
|
||||
from .conftest import _load_fridge_resources as _load_fridge
|
||||
|
||||
_COORD = "custom_components.localthings.coordinator.LocalThingsCoordinator"
|
||||
|
||||
|
||||
@contextmanager
|
||||
def _reachable(resources: dict, identity: DeviceIdentity | None = None):
|
||||
"""A device that answers, optionally with an /oic/* identity -- which
|
||||
`_connect_session` is what normally reads, so a test that patches it out
|
||||
otherwise leaves `_identity` None."""
|
||||
|
||||
def _connect(self) -> None:
|
||||
self._identity = identity
|
||||
|
||||
with (
|
||||
patch(f"{_COORD}._connect_session", _connect),
|
||||
patch(f"{_COORD}._poll_once", return_value=resources),
|
||||
patch(f"{_COORD}._close_session"),
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
@contextmanager
|
||||
def _unreachable():
|
||||
with (
|
||||
patch(f"{_COORD}._connect_session"),
|
||||
patch(f"{_COORD}._poll_once", side_effect=OSError("device offline")),
|
||||
patch(f"{_COORD}._close_session"),
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
def _store_key(entry) -> str:
|
||||
return f"{DOMAIN}.{entry.entry_id}.discovery"
|
||||
|
||||
|
||||
async def _tick(hass: HomeAssistant) -> None:
|
||||
"""Advance past one summary interval so the coordinator polls again.
|
||||
|
||||
`wait_background_tasks` is load-bearing: DataUpdateCoordinator runs its
|
||||
interval refresh as a background task, which a plain block_till_done
|
||||
doesn't await -- the poll would still be in flight at the assertion.
|
||||
"""
|
||||
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=SUMMARY_INTERVAL_S + 1))
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
|
||||
async def _setup_online_then_unload(hass: HomeAssistant, entry, resources: dict) -> set[str]:
|
||||
"""Bring the entry up against a live device, bank the snapshot, and take
|
||||
it back down. Returns the entity_ids that run produced."""
|
||||
with _reachable(resources):
|
||||
await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
entity_ids = {s.entity_id for s in hass.states.async_all()}
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
return entity_ids
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Writing the snapshot
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
async def test_snapshot_written_after_first_discovery(
|
||||
hass: HomeAssistant, mock_entry, mock_coordinator_session, hass_storage
|
||||
) -> None:
|
||||
"""A successful first cycle banks what it handed _run_discovery."""
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
stored = hass_storage[_store_key(mock_entry)]["data"]
|
||||
assert stored["resources"]
|
||||
assert "/information/vs/0" in stored["resources"]
|
||||
assert "subdevice_candidates" in stored
|
||||
|
||||
|
||||
async def test_snapshot_not_written_when_device_never_answers(
|
||||
hass: HomeAssistant, mock_entry, hass_storage
|
||||
) -> None:
|
||||
"""Nothing to bank, so nothing is -- this is what keeps the no-snapshot
|
||||
gate meaningful on a brand-new entry."""
|
||||
with _unreachable():
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert mock_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
assert _store_key(mock_entry) not in hass_storage
|
||||
|
||||
|
||||
async def test_snapshot_removed_when_entry_removed(
|
||||
hass: HomeAssistant, mock_entry, mock_coordinator_session, hass_storage
|
||||
) -> None:
|
||||
"""The store is keyed on entry_id, so re-adding the appliance mints a new
|
||||
one -- the old file has to go with the entry that wrote it.
|
||||
|
||||
The clock is run on afterwards because a deferred write would land here:
|
||||
with `async_delay_save` the removal was undone a few seconds later by the
|
||||
save the last poll had queued, leaving the file orphaned for good.
|
||||
"""
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert _store_key(mock_entry) in hass_storage
|
||||
|
||||
await hass.config_entries.async_remove(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert hass_storage.get(_store_key(mock_entry), {}).get("data") is None
|
||||
|
||||
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=60))
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
assert hass_storage.get(_store_key(mock_entry), {}).get("data") is None
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Loading from it
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
async def test_offline_load_restores_the_same_entity_set(
|
||||
hass: HomeAssistant, mock_entry, hass_storage
|
||||
) -> None:
|
||||
"""The whole point: a restart with the appliance powered off comes up on
|
||||
the entity set the device last actually reported."""
|
||||
resources = _load_fridge()
|
||||
online_ids = await _setup_online_then_unload(hass, mock_entry, resources)
|
||||
assert online_ids # guard: the online run must actually produce entities
|
||||
|
||||
with _unreachable():
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_entry.state is ConfigEntryState.LOADED
|
||||
assert {s.entity_id for s in hass.states.async_all()} == online_ids
|
||||
|
||||
|
||||
async def test_offline_entities_are_unavailable_not_stale(hass: HomeAssistant, mock_entry) -> None:
|
||||
"""Restored entities must not render the snapshot's values -- the
|
||||
appliance is unreachable, so `unavailable` is the honest state and the
|
||||
live cache stays empty to enforce it."""
|
||||
resources = _load_fridge()
|
||||
await _setup_online_then_unload(hass, mock_entry, resources)
|
||||
|
||||
with _unreachable():
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
states = hass.states.async_all()
|
||||
assert states
|
||||
assert all(s.state == "unavailable" for s in states)
|
||||
|
||||
coordinator: LocalThingsCoordinator = hass.data[DOMAIN][mock_entry.entry_id]
|
||||
assert coordinator.rehydrated
|
||||
assert not coordinator.last_resources
|
||||
|
||||
|
||||
async def test_offline_load_without_snapshot_still_fails(hass: HomeAssistant, mock_entry) -> None:
|
||||
"""No snapshot means no device metadata to build anything from, so the
|
||||
entry stays on HA's backoff rather than loading empty."""
|
||||
with _unreachable():
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
assert not hass.states.async_all()
|
||||
|
||||
|
||||
async def test_malformed_snapshot_falls_back_to_setup_retry(
|
||||
hass: HomeAssistant, mock_entry, hass_storage
|
||||
) -> None:
|
||||
"""A stored row missing a field the current dataclass declares must fail
|
||||
the same way an unreachable device does.
|
||||
|
||||
Anything escaping async_rehydrate reaches async_setup_entry, which only
|
||||
handles ConfigEntryNotReady -- so the entry would land in SETUP_ERROR,
|
||||
which HA never retries, with its DTLS session left open on the fixed
|
||||
source port the next attempt binds.
|
||||
"""
|
||||
key = _store_key(mock_entry)
|
||||
hass_storage[key] = {
|
||||
"version": 1,
|
||||
"minor_version": 1,
|
||||
"key": key,
|
||||
"data": {
|
||||
"resources": _load_fridge(),
|
||||
"subdevice_candidates": [{"key": "1"}], # no "kind"
|
||||
},
|
||||
}
|
||||
|
||||
with (
|
||||
_unreachable(),
|
||||
patch.object(LocalThingsCoordinator, "async_close", autospec=True) as close,
|
||||
):
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
close.assert_awaited_once()
|
||||
|
||||
|
||||
async def test_corrupt_snapshot_falls_back_to_setup_retry(
|
||||
hass: HomeAssistant, mock_entry, hass_storage
|
||||
) -> None:
|
||||
"""A snapshot whose resources no longer replay cleanly must not take the
|
||||
entry down with it."""
|
||||
key = _store_key(mock_entry)
|
||||
hass_storage[key] = {
|
||||
"version": 1,
|
||||
"minor_version": 1,
|
||||
"key": key,
|
||||
"data": {"resources": {"/information/vs/0": "not-a-rep"}, "subdevice_candidates": []},
|
||||
}
|
||||
|
||||
with _unreachable():
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
|
||||
async def test_snapshot_restores_identity(hass: HomeAssistant, mock_entry) -> None:
|
||||
"""`/oic/d`'s device types route the registry, so an offline load that
|
||||
lost them could resolve a different one than the live poll did -- which
|
||||
would show up as a spurious reconcile reload every restart."""
|
||||
resources = _load_fridge()
|
||||
identity = DeviceIdentity(
|
||||
manufacturer="Samsung",
|
||||
model="TEST-MODEL",
|
||||
name="Fridge",
|
||||
serial=None,
|
||||
device_types=("oic.d.refrigerator",),
|
||||
raw={"/oic/p": {}, "/oic/d": {}, "/oic/res": []},
|
||||
)
|
||||
with _reachable(resources, identity):
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
await hass.config_entries.async_unload(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
with _unreachable():
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
coordinator: LocalThingsCoordinator = hass.data[DOMAIN][mock_entry.entry_id]
|
||||
assert coordinator._identity is not None
|
||||
assert coordinator._identity.device_types == ("oic.d.refrigerator",)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Recovery and reconciliation
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
async def test_offline_load_keeps_polling_and_recovers(hass: HomeAssistant, mock_entry) -> None:
|
||||
"""The failure the PR this replaces actually shipped: with zero live
|
||||
listeners the base coordinator stops rescheduling, and the entry never
|
||||
polls again. Entities must go available on the next interval once the
|
||||
appliance answers."""
|
||||
resources = _load_fridge()
|
||||
await _setup_online_then_unload(hass, mock_entry, resources)
|
||||
|
||||
with _unreachable():
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
coordinator: LocalThingsCoordinator = hass.data[DOMAIN][mock_entry.entry_id]
|
||||
assert coordinator._unsub_refresh is not None # a poll is actually queued
|
||||
assert not coordinator.last_update_success
|
||||
|
||||
with _reachable(resources):
|
||||
await _tick(hass)
|
||||
|
||||
assert coordinator.last_update_success
|
||||
assert any(s.state != "unavailable" for s in hass.states.async_all())
|
||||
|
||||
|
||||
async def test_reconcile_reloads_when_live_discovery_differs(
|
||||
hass: HomeAssistant, mock_entry, hass_storage
|
||||
) -> None:
|
||||
"""Platforms enumerate `bound` once, so a live set that disagrees with the
|
||||
snapshot can only be adopted by bringing the entry back up."""
|
||||
resources = _load_fridge()
|
||||
|
||||
with _reachable(resources):
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
coordinator: LocalThingsCoordinator = hass.data[DOMAIN][mock_entry.entry_id]
|
||||
victim = coordinator.bound[0].href
|
||||
await hass.config_entries.async_unload(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
with _unreachable():
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
reduced = {href: rep for href, rep in resources.items() if href != victim}
|
||||
with (
|
||||
_reachable(reduced),
|
||||
patch.object(hass.config_entries, "async_schedule_reload") as reload,
|
||||
):
|
||||
await _tick(hass)
|
||||
|
||||
reload.assert_called_once_with(mock_entry.entry_id)
|
||||
# Banked before the reload is scheduled, so the entry that comes back up
|
||||
# replays this discovery rather than the one it is replacing -- otherwise
|
||||
# a device that goes quiet again mid-reload rehydrates the stale set and
|
||||
# reconciles all over again.
|
||||
assert victim not in hass_storage[_store_key(mock_entry)]["data"]["resources"]
|
||||
|
||||
|
||||
async def test_reconcile_is_quiet_when_live_discovery_agrees(
|
||||
hass: HomeAssistant, mock_entry
|
||||
) -> None:
|
||||
"""The common case -- same appliance, same firmware -- must not reload,
|
||||
or every offline restart would cost a second setup cycle."""
|
||||
resources = _load_fridge()
|
||||
await _setup_online_then_unload(hass, mock_entry, resources)
|
||||
|
||||
with _unreachable():
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
with (
|
||||
_reachable(resources),
|
||||
patch.object(hass.config_entries, "async_schedule_reload") as reload,
|
||||
):
|
||||
await _tick(hass)
|
||||
|
||||
reload.assert_not_called()
|
||||
|
||||
|
||||
def test_coverage_gap_repair_is_live_only(hass: HomeAssistant, mock_entry) -> None:
|
||||
"""A coverage gap is a claim about what the device reports, so replaying
|
||||
a snapshot must not raise the Repair -- it would restate last run's
|
||||
conclusion while the diagnostics download it points at is still empty."""
|
||||
gappy = {
|
||||
"/information/vs/0": {
|
||||
"x.com.samsung.da.modelNum": "TOTALLY_UNKNOWN_BOARD",
|
||||
"x.com.samsung.da.serialNum": "TEST-SERIAL-0000",
|
||||
},
|
||||
"/nothing/maps/this/vs/0": {"someField": 1},
|
||||
}
|
||||
issue_id = f"device_gap_{mock_entry.entry_id}"
|
||||
coordinator = LocalThingsCoordinator(hass, mock_entry)
|
||||
|
||||
coordinator._run_discovery(gappy, from_snapshot=True)
|
||||
assert coordinator._unbound_hrefs # the gap is real, it just stays quiet
|
||||
assert ir.async_get(hass).async_get_issue(DOMAIN, issue_id) is None
|
||||
|
||||
coordinator._run_discovery(gappy)
|
||||
assert ir.async_get(hass).async_get_issue(DOMAIN, issue_id) is not None
|
||||
|
||||
|
||||
async def test_live_load_never_reconciles(
|
||||
hass: HomeAssistant, mock_entry, mock_coordinator_session
|
||||
) -> None:
|
||||
"""An entry that came up against a live device has nothing to reconcile
|
||||
against; the reload path must stay out of the normal startup entirely."""
|
||||
with patch.object(hass.config_entries, "async_schedule_reload") as reload:
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
coordinator: LocalThingsCoordinator = hass.data[DOMAIN][mock_entry.entry_id]
|
||||
assert not coordinator.rehydrated
|
||||
reload.assert_not_called()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("failures", [1, 3])
|
||||
async def test_offline_load_survives_repeated_poll_failures(
|
||||
hass: HomeAssistant, mock_entry, failures: int
|
||||
) -> None:
|
||||
"""Recovery isn't one-shot: the entry keeps its entities and keeps
|
||||
retrying across however many intervals the appliance stays dark."""
|
||||
resources = _load_fridge()
|
||||
online_ids = await _setup_online_then_unload(hass, mock_entry, resources)
|
||||
|
||||
with _unreachable():
|
||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
for _ in range(failures):
|
||||
await _tick(hass)
|
||||
|
||||
assert mock_entry.state is ConfigEntryState.LOADED
|
||||
assert {s.entity_id for s in hass.states.async_all()} == online_ids
|
||||
|
||||
with _reachable(resources):
|
||||
await _tick(hass)
|
||||
|
||||
coordinator: LocalThingsCoordinator = hass.data[DOMAIN][mock_entry.entry_id]
|
||||
assert coordinator.last_update_success
|
||||
@@ -0,0 +1,221 @@
|
||||
"""The v2 -> v3 entry migration that relabels particulate statistics.
|
||||
|
||||
Dust/FineDust/SuperFineDust gained a pm10/pm25/pm1 device_class and a
|
||||
µg/m³ unit (issue #325) after having recorded long-term statistics with no
|
||||
unit at all. Home Assistant treats that as a unit change it cannot convert
|
||||
and *suppresses statistics generation* for the entity until a human
|
||||
resolves the repair, so the metadata is corrected during migration instead.
|
||||
|
||||
Only the metadata row is touched, never the recorded values -- the readings
|
||||
were always µg/m³, so there is nothing to convert.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from homeassistant.const import CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from pytest_homeassistant_custom_component.common import MockConfigEntry
|
||||
|
||||
from custom_components.localthings import async_migrate_entry
|
||||
from custom_components.localthings.const import CONF_DEVICE_TYPE, DOMAIN
|
||||
|
||||
from .conftest import ENTRY_DATA, MOCK_SERIAL
|
||||
|
||||
RELABEL = "homeassistant.components.recorder.statistics.async_update_statistics_metadata"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _recorder_loaded(hass: HomeAssistant):
|
||||
"""Most tests here assume a normal install, where after_dependencies has
|
||||
pulled the recorder in. The deferral test below undoes it."""
|
||||
hass.config.components.add("recorder")
|
||||
return hass
|
||||
|
||||
|
||||
def _entry(hass: HomeAssistant, device_type: str) -> MockConfigEntry:
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
data={**ENTRY_DATA, CONF_DEVICE_TYPE: device_type},
|
||||
unique_id=f"{DOMAIN}_{MOCK_SERIAL}",
|
||||
version=2,
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
return entry
|
||||
|
||||
|
||||
def _add_sensor(hass: HomeAssistant, entry: MockConfigEntry, key: str, **kwargs):
|
||||
return er.async_get(hass).async_get_or_create(
|
||||
"sensor",
|
||||
DOMAIN,
|
||||
f"{DOMAIN}_{MOCK_SERIAL}_{key}",
|
||||
config_entry=entry,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
async def test_relabels_every_particulate_sensor(hass: HomeAssistant) -> None:
|
||||
entry = _entry(hass, "air_purifier")
|
||||
expected = {
|
||||
_add_sensor(hass, entry, key).entity_id for key in ("dust", "fine_dust", "super_fine_dust")
|
||||
}
|
||||
|
||||
with patch(RELABEL, autospec=True) as relabel:
|
||||
assert await async_migrate_entry(hass, entry) is True
|
||||
|
||||
assert {call.args[1] for call in relabel.call_args_list} == expected
|
||||
for call in relabel.call_args_list:
|
||||
assert call.kwargs["new_unit_of_measurement"] == CONCENTRATION_MICROGRAMS_PER_CUBIC_METER
|
||||
# µg/m³ has a converter, so the class must be named, not None --
|
||||
# passing neither is deprecated and breaks in HA Core 2026.11.
|
||||
assert call.kwargs["new_unit_class"] == "concentration"
|
||||
assert entry.version == 3
|
||||
|
||||
|
||||
async def test_leaves_other_sensors_on_the_same_device_alone(hass: HomeAssistant) -> None:
|
||||
"""Odor/CleanLevel/CO2 share the resource but keep the units they had."""
|
||||
entry = _entry(hass, "air_monitor")
|
||||
dust = _add_sensor(hass, entry, "dust")
|
||||
for key in ("odor", "clean_level", "co2", "dustbag_usage", "dustbin_auto_close"):
|
||||
_add_sensor(hass, entry, key)
|
||||
|
||||
with patch(RELABEL, autospec=True) as relabel:
|
||||
assert await async_migrate_entry(hass, entry) is True
|
||||
|
||||
assert [call.args[1] for call in relabel.call_args_list] == [dust.entity_id]
|
||||
|
||||
|
||||
async def test_skips_families_that_did_not_gain_the_unit(hass: HomeAssistant) -> None:
|
||||
"""range_hood and airconditioner still declare no unit for their
|
||||
identically-named sensors. Relabelling their statistics would assert a
|
||||
unit those entities don't report -- creating the very mismatch this
|
||||
migration exists to prevent."""
|
||||
for device_type in ("range_hood", "airconditioner"):
|
||||
entry = _entry(hass, device_type)
|
||||
_add_sensor(hass, entry, "dust")
|
||||
_add_sensor(hass, entry, "fine_dust")
|
||||
|
||||
with patch(RELABEL, autospec=True) as relabel:
|
||||
assert await async_migrate_entry(hass, entry) is True
|
||||
|
||||
assert relabel.call_args_list == [], device_type
|
||||
assert entry.version == 3
|
||||
|
||||
|
||||
async def test_defers_rather_than_consuming_the_migration_without_the_recorder(
|
||||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
"""A boot where the recorder didn't come up must not burn the one-shot
|
||||
migration -- doing so would leave the statistics suppressed for good.
|
||||
The entry stays on v2 so the next start retries."""
|
||||
entry = _entry(hass, "air_purifier")
|
||||
_add_sensor(hass, entry, "dust")
|
||||
|
||||
hass.config.components.remove("recorder")
|
||||
with patch(RELABEL, autospec=True) as relabel:
|
||||
assert await async_migrate_entry(hass, entry) is True
|
||||
|
||||
assert relabel.call_args_list == []
|
||||
assert entry.version == 2
|
||||
|
||||
# ...and the retry lands once the recorder is there.
|
||||
hass.config.components.add("recorder")
|
||||
with patch(RELABEL, autospec=True) as relabel:
|
||||
assert await async_migrate_entry(hass, entry) is True
|
||||
|
||||
assert len(relabel.call_args_list) == 1
|
||||
assert entry.version == 3
|
||||
|
||||
|
||||
async def test_omits_unit_class_on_an_older_home_assistant(hass: HomeAssistant) -> None:
|
||||
"""`new_unit_class` only exists from HA 2025.11, and hacs.json still
|
||||
declares 2025.1 as the minimum. Passing it to the older signature is a
|
||||
TypeError out of async_migrate_entry, which fails the whole entry -- so
|
||||
the kwarg is feature-detected rather than assumed.
|
||||
|
||||
Stands in for an older HA by patching in that exact signature; the
|
||||
autospec'd tests above cover the modern one.
|
||||
"""
|
||||
entry = _entry(hass, "air_purifier")
|
||||
_add_sensor(hass, entry, "dust")
|
||||
|
||||
seen: list[dict] = []
|
||||
|
||||
def old_signature(hass, statistic_id, *, new_statistic_id=None, **kwargs):
|
||||
seen.append(kwargs)
|
||||
|
||||
with patch(RELABEL, old_signature):
|
||||
assert await async_migrate_entry(hass, entry) is True
|
||||
|
||||
assert seen == [{"new_unit_of_measurement": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER}]
|
||||
assert entry.version == 3
|
||||
|
||||
|
||||
async def test_a_relabel_failure_never_fails_the_entry(hass: HomeAssistant) -> None:
|
||||
"""Relabelling is a convenience -- without it the user gets HA's own
|
||||
units_changed repair, which is where they were before. An older HA whose
|
||||
async_update_statistics_metadata has a different signature, or any other
|
||||
recorder-side surprise, must not cost them the integration."""
|
||||
entry = _entry(hass, "air_purifier")
|
||||
_add_sensor(hass, entry, "dust")
|
||||
|
||||
with patch(RELABEL, autospec=True, side_effect=TypeError("older HA signature")):
|
||||
assert await async_migrate_entry(hass, entry) is True
|
||||
|
||||
assert entry.version == 3
|
||||
|
||||
|
||||
async def test_follows_a_renamed_entity_rather_than_rebuilding_its_id(
|
||||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
"""statistic_id is the entity_id, which the user can rename. Matching the
|
||||
unique_id tail and reading entity_id back off the registry is what keeps
|
||||
this correct for a renamed sensor -- reconstructing an entity_id from the
|
||||
descriptor key would relabel a statistic nobody is recording."""
|
||||
entry = _entry(hass, "air_purifier")
|
||||
renamed = _add_sensor(hass, entry, "dust", suggested_object_id="living_room_pm10")
|
||||
assert renamed.entity_id == "sensor.living_room_pm10"
|
||||
|
||||
with patch(RELABEL, autospec=True) as relabel:
|
||||
assert await async_migrate_entry(hass, entry) is True
|
||||
|
||||
assert [call.args[1] for call in relabel.call_args_list] == ["sensor.living_room_pm10"]
|
||||
|
||||
|
||||
async def test_matches_subdevice_prefixed_and_instanced_keys(hass: HomeAssistant) -> None:
|
||||
"""_key() can prefix a subdevice and append an instance number, so the
|
||||
match is on the tail rather than the whole unique_id. The instance form
|
||||
is `_<n>` (discovery.instance_suffix), not a bare digit."""
|
||||
entry = _entry(hass, "air_purifier")
|
||||
ent_reg = er.async_get(hass)
|
||||
for unique_suffix in ("indoor_0_dust", "fine_dust_1", "super_fine_dust"):
|
||||
ent_reg.async_get_or_create(
|
||||
"sensor",
|
||||
DOMAIN,
|
||||
f"{DOMAIN}_{MOCK_SERIAL}_{unique_suffix}",
|
||||
config_entry=entry,
|
||||
)
|
||||
# Near-misses that must not match.
|
||||
for unique_suffix in ("dustbag_full", "dustbin_auto_close", "dust_filter_reset"):
|
||||
ent_reg.async_get_or_create(
|
||||
"sensor",
|
||||
DOMAIN,
|
||||
f"{DOMAIN}_{MOCK_SERIAL}_{unique_suffix}",
|
||||
config_entry=entry,
|
||||
)
|
||||
|
||||
with patch(RELABEL, autospec=True) as relabel:
|
||||
assert await async_migrate_entry(hass, entry) is True
|
||||
|
||||
assert len(relabel.call_args_list) == 3
|
||||
|
||||
|
||||
async def test_a_fresh_entry_starts_at_the_migrated_version(hass: HomeAssistant) -> None:
|
||||
"""A newly created entry has no statistics to relabel, so the config flow
|
||||
mints v3 directly rather than walking through the migration."""
|
||||
from custom_components.localthings.config_flow import LocalThingsConfigFlow
|
||||
|
||||
assert LocalThingsConfigFlow.VERSION == 3
|
||||
@@ -30,30 +30,54 @@ def test_graded_sensors_are_left_without_a_state_class():
|
||||
assert _desc(key).state_class is None, key
|
||||
|
||||
|
||||
def test_no_unit_or_device_class_is_asserted():
|
||||
"""state_class alone makes the series recordable. pm1/pm25/pm10 with
|
||||
µg/m³ would additionally assert the reading is a mass concentration,
|
||||
which no dump states."""
|
||||
for key in PARTICULATE + GRADED:
|
||||
def test_particulate_sensors_declare_pm_device_class_and_unit():
|
||||
"""Dust/FineDust/SuperFineDust map to PM10/PM2.5/PM1 (issue #325) -- see
|
||||
air_purifier._AIR_QUALITY_SENSORS for the three lines of evidence and
|
||||
tests/test_air_quality_grade_column.py for the device-side ones.
|
||||
|
||||
The expected unit comes from HA's own constant rather than a literal:
|
||||
typing it out is how PR #365 landed U+00B5 MICRO SIGN where HA uses
|
||||
U+03BC, which renders identically and would make this test agree with
|
||||
the bug."""
|
||||
from homeassistant.const import CONCENTRATION_MICROGRAMS_PER_CUBIC_METER as UG_M3
|
||||
|
||||
expected = {
|
||||
"dust": ("pm10", UG_M3),
|
||||
"fine_dust": ("pm25", UG_M3),
|
||||
"super_fine_dust": ("pm1", UG_M3),
|
||||
}
|
||||
for key, (device_class, unit) in expected.items():
|
||||
desc = _desc(key)
|
||||
assert desc.device_class == device_class, key
|
||||
assert desc.unit == unit, key
|
||||
for key in GRADED:
|
||||
desc = _desc(key)
|
||||
assert desc.unit is None, key
|
||||
assert desc.device_class is None, key
|
||||
assert desc.unit is None, key
|
||||
|
||||
|
||||
def test_state_class_comes_from_the_shared_tuples_fourth_column():
|
||||
"""The rows carry their own state_class rather than a parallel lookup, so
|
||||
a new sensor can't be added here without deciding the question."""
|
||||
def test_metadata_comes_from_the_shared_tuples_own_columns():
|
||||
"""The rows carry their own state_class/device_class/unit rather than a
|
||||
parallel lookup, so a new sensor can't be added here without deciding
|
||||
each question. Unit validity against HA is a separate guard --
|
||||
tests/test_sensor_device_class_units.py."""
|
||||
for row in air_purifier._AIR_QUALITY_SENSORS:
|
||||
assert len(row) == 4, row
|
||||
assert len(row) == 6, row
|
||||
assert row[3] in ("measurement", None), row
|
||||
assert row[4] in ("pm10", "pm25", "pm1", None), row
|
||||
# A device_class without a unit would leave HA inferring one.
|
||||
assert (row[4] is None) == (row[5] is None), row
|
||||
|
||||
|
||||
def test_air_monitor_keeps_stamping_every_shared_sensor():
|
||||
"""air_monitor imports _AIR_QUALITY_SENSORS and discards the fourth column
|
||||
on purpose: that board (issue #210) has stamped all five as `measurement`
|
||||
since it was added, and consuming the column would silently drop long-term
|
||||
statistics for Odor/CleanLevel there. Guards the import end to end and the
|
||||
deliberate divergence together."""
|
||||
def test_air_monitor_takes_the_pm_labels_but_not_the_state_class():
|
||||
"""air_monitor imports _AIR_QUALITY_SENSORS and consumes device_class and
|
||||
unit -- the mapping rests on device-side grading that board shares (issue
|
||||
#325), so typing one family and not the other would be an inconsistency.
|
||||
|
||||
state_class is still discarded: that board (issue #210) has stamped all
|
||||
five as `measurement` since it was added, and consuming the column would
|
||||
silently drop long-term statistics for Odor/CleanLevel there. Guards the
|
||||
import end to end and the deliberate divergence together."""
|
||||
from custom_components.localthings.registry.capabilities import air_monitor
|
||||
|
||||
assert air_monitor.SENSORS.href == "/sensors/vs/0"
|
||||
@@ -62,6 +86,14 @@ def test_air_monitor_keeps_stamping_every_shared_sensor():
|
||||
d for d in air_monitor.SENSORS.entities if d.key == key and isinstance(d, SensorDesc)
|
||||
)
|
||||
assert desc.state_class == "measurement", key
|
||||
assert desc.device_class == _desc(key).device_class, key
|
||||
assert desc.unit == _desc(key).unit, key
|
||||
# And the graded pair stays untyped on both families.
|
||||
for key in GRADED:
|
||||
desc = next(
|
||||
d for d in air_monitor.SENSORS.entities if d.key == key and isinstance(d, SensorDesc)
|
||||
)
|
||||
assert (desc.device_class, desc.unit) == (None, None), key
|
||||
|
||||
|
||||
def test_every_air_quality_sensor_still_reads_a_plain_int():
|
||||
|
||||
@@ -59,5 +59,5 @@ def test_air_quality_and_filter_sensors_present():
|
||||
assert state["dust"] == 10
|
||||
assert state["fine_dust"] == 9
|
||||
assert state["odor"] == 1
|
||||
assert state["hepa_filter_usage"] == 0
|
||||
assert state["hepa_filter_usage"] == 30
|
||||
assert state["hepa_filter_status"] == "normal"
|
||||
@@ -0,0 +1,135 @@
|
||||
"""What the second element of a /sensors/vs/0 dust reading means, and why
|
||||
it is what confirms Dust/FineDust/SuperFineDust are PM10/PM2.5/PM1.
|
||||
|
||||
`x.com.samsung.da.value` is `[concentration, grade]` on the fields that
|
||||
carry a magnitude and `[grade]` on Odor/CleanLevel, which are grades
|
||||
already. Index 1 is never bound to an entity (its floor differs by board
|
||||
family), but it is the device's own opinion about its own readings, and
|
||||
that makes it the one piece of evidence for the PM mapping that doesn't
|
||||
depend on Samsung's field names or on a user's screenshot.
|
||||
|
||||
These assertions read the shipped fixtures rather than restating numbers,
|
||||
so a re-captured dump that contradicts the mapping fails here instead of
|
||||
silently weakening the argument in air_purifier.py's comment.
|
||||
"""
|
||||
|
||||
import json
|
||||
import pathlib
|
||||
|
||||
FIXTURES = pathlib.Path(__file__).parent / "fixtures"
|
||||
DUST_TYPES = ("Dust", "FineDust", "SuperFineDust")
|
||||
|
||||
|
||||
def _items(fixture: str):
|
||||
dump = json.loads((FIXTURES / f"{fixture}_device.json").read_text(encoding="utf-8"))
|
||||
for entry in dump["device0"]:
|
||||
if entry.get("href") == "/sensors/vs/0":
|
||||
return {
|
||||
item.get("x.com.samsung.da.type"): item.get("x.com.samsung.da.value")
|
||||
for item in entry.get("rep", {}).get("x.com.samsung.da.items") or []
|
||||
}
|
||||
raise AssertionError(f"{fixture} has no /sensors/vs/0")
|
||||
|
||||
|
||||
def _fixtures_reporting_sensors():
|
||||
for path in sorted(FIXTURES.glob("*_device.json")):
|
||||
dump = json.loads(path.read_text(encoding="utf-8"))
|
||||
entries = dump.get("device0")
|
||||
if not isinstance(entries, list):
|
||||
continue
|
||||
if any(e.get("href") == "/sensors/vs/0" for e in entries):
|
||||
name = path.name.removesuffix("_device.json")
|
||||
if any(t in _items(name) for t in DUST_TYPES):
|
||||
yield name
|
||||
|
||||
|
||||
def test_magnitude_fields_carry_a_grade_and_graded_fields_do_not():
|
||||
"""The shape asymmetry is the whole argument for what index 1 is: the
|
||||
fields that already *are* grades have no second slot."""
|
||||
checked = 0
|
||||
for fixture in _fixtures_reporting_sensors():
|
||||
items = _items(fixture)
|
||||
for type_ in (*DUST_TYPES, "CO2"):
|
||||
if type_ in items:
|
||||
assert len(items[type_]) == 2, (fixture, type_, items[type_])
|
||||
checked += 1
|
||||
for type_ in ("Odor", "CleanLevel"):
|
||||
if type_ in items:
|
||||
assert len(items[type_]) == 1, (fixture, type_, items[type_])
|
||||
assert checked >= 30
|
||||
|
||||
|
||||
def test_concentration_falls_with_particle_size_on_every_fixture():
|
||||
"""PM10 >= PM2.5 >= PM1 by definition -- they are cumulative masses, so
|
||||
a violation would mean the three fields aren't nested size tiers at
|
||||
all."""
|
||||
for fixture in _fixtures_reporting_sensors():
|
||||
items = _items(fixture)
|
||||
if not all(t in items for t in DUST_TYPES):
|
||||
continue
|
||||
coarse, fine, finest = (int(items[t][0]) for t in DUST_TYPES)
|
||||
assert coarse >= fine >= finest, (fixture, coarse, fine, finest)
|
||||
|
||||
|
||||
def test_the_same_reading_grades_differently_as_dust_than_as_superfinedust():
|
||||
"""18 is one step above the grade floor as SuperFineDust but sits *at*
|
||||
the floor as Dust, on two families that both grade good air as 1.
|
||||
|
||||
One shared threshold cannot produce both, so the firmware treats the
|
||||
coarse field as tolerating more than the fine one -- three scales
|
||||
ordered coarse-to-fine, which is what PM10/PM2.5/PM1 requires and what
|
||||
"all three are the same kind of reading" cannot explain.
|
||||
"""
|
||||
monitor, hood = _items("air_monitor"), _items("range_hood")
|
||||
assert monitor["SuperFineDust"] == ["18", "2"]
|
||||
assert hood["Dust"] == ["18", "1"]
|
||||
# Both families put good air at grade 1, so the two grades are
|
||||
# comparable -- ARTIK051_TVTL's 0-based floor is the reason this
|
||||
# comparison is drawn between these two fixtures and not against it.
|
||||
assert monitor["Odor"] == ["1"]
|
||||
assert hood["CleanLevel"] == ["2"]
|
||||
assert _items("air_purifier")["Dust"] == ["11", "0"]
|
||||
|
||||
|
||||
def test_grade_boundaries_bracket_the_korean_cai_bands():
|
||||
"""Where each field crosses from its floor to the next grade lines up
|
||||
with the band that field's PM tier is graded on in Korea's CAI:
|
||||
PM10 breaks at 30/31, PM2.5 at 15/16. A PM1 reading has no standard
|
||||
index and is graded on PM2.5-like widths.
|
||||
"""
|
||||
monitor, hood = _items("air_monitor"), _items("range_hood")
|
||||
# Dust: still at the floor at 18, above it at 31 -> boundary in (18, 31].
|
||||
assert (hood["Dust"], monitor["Dust"]) == (["18", "1"], ["31", "2"])
|
||||
# FineDust: at the floor at 14, above it at 23 -> boundary in (14, 23].
|
||||
assert (hood["FineDust"], monitor["FineDust"]) == (["14", "1"], ["23", "2"])
|
||||
# SuperFineDust: at the floor at 9, above it at 18 -> boundary in (9, 18],
|
||||
# strictly below where Dust's sits.
|
||||
assert (hood["SuperFineDust"], monitor["SuperFineDust"]) == (["9", "1"], ["18", "2"])
|
||||
|
||||
|
||||
def test_clean_level_aggregates_the_per_field_grades():
|
||||
"""CleanLevel is the highest per-field grade on every family except the
|
||||
range hood and one RAC, which report a higher CleanLevel than any dust
|
||||
grade -- those two fold in something this resource doesn't expose, so
|
||||
CleanLevel is never derived from the dust grades in code."""
|
||||
exceptions = {"range_hood", "airconditioner_tp1x_da_ac_rac_01011"}
|
||||
for fixture in _fixtures_reporting_sensors():
|
||||
items = _items(fixture)
|
||||
if "CleanLevel" not in items:
|
||||
continue
|
||||
grades = [int(v[1]) for v in items.values() if len(v) == 2]
|
||||
if not grades:
|
||||
continue
|
||||
aggregate = int(items["CleanLevel"][0])
|
||||
if fixture in exceptions:
|
||||
assert aggregate > max(grades), (fixture, aggregate, grades)
|
||||
else:
|
||||
assert aggregate == max(grades), (fixture, aggregate, grades)
|
||||
|
||||
|
||||
def test_grade_floor_is_zero_based_on_artik051_tvtl_and_one_based_elsewhere():
|
||||
"""Why index 1 stays unbound: a shared descriptor would need a
|
||||
per-family offset to mean anything."""
|
||||
assert _items("air_purifier")["CleanLevel"] == ["0"]
|
||||
for fixture in ("air_monitor", "air_purifier_avt_ww", "air_purifier_vtww", "range_hood"):
|
||||
assert int(_items(fixture)["CleanLevel"][0]) >= 1, fixture
|
||||
@@ -36,6 +36,15 @@ class _FakeCoordinator:
|
||||
def canonical_resources(self, subdevice):
|
||||
return self.last_resources
|
||||
|
||||
# _is_included judges existence against the discovery view, which is the
|
||||
# live cache for everything but an offline load (issue #295).
|
||||
@property
|
||||
def discovery_resources(self):
|
||||
return self.last_resources
|
||||
|
||||
def discovery_canonical(self, subdevice):
|
||||
return self.canonical_resources(subdevice)
|
||||
|
||||
|
||||
def _resources():
|
||||
return _load_device("airconditioner_ailp_fac")
|
||||
|
||||
@@ -129,22 +129,35 @@ def test_token_entities_present_with_calibrated_values():
|
||||
|
||||
|
||||
def test_token_entities_stay_off_newer_boards():
|
||||
"""Newer families carry Volume/Sleep/OutdoorTemp/Autoclean tokens too,
|
||||
while also exposing those settings as dedicated resources -- ungated, the
|
||||
token entities would duplicate them (auto clean) or apply a scale
|
||||
calibrated on another board generation (outdoor temperature)."""
|
||||
"""Newer families carry Volume/Sleep/Autoclean tokens too, while also
|
||||
exposing those settings as dedicated resources -- ungated, the token
|
||||
entities would duplicate them."""
|
||||
state = _state("airconditioner_tp1x_rac")
|
||||
for key in (
|
||||
"spi",
|
||||
"auto_clean_legacy",
|
||||
"air_monitoring",
|
||||
"good_sleep",
|
||||
"outdoor_temperature",
|
||||
"filter_time",
|
||||
):
|
||||
assert key not in state, key
|
||||
|
||||
|
||||
def test_outdoor_temperature_is_not_gated_to_legacy_boards():
|
||||
"""issue #367: OutdoorTemp_ is not paired with any dedicated resource on
|
||||
newer boards -- /temperatures/vs/0 carries indoor temperature only, no
|
||||
outdoor equivalent exists anywhere in this fixture's 23 hrefs -- so unlike
|
||||
auto_clean_legacy et al. above, gating it to is_legacy_board only dropped
|
||||
a real reading. A 48h field capture correlated the token against
|
||||
weather.forecast_home at r=0.92 across several non-legacy boards,
|
||||
confirming it is live per-site data rather than a firmware constant."""
|
||||
resources = _load_device("airconditioner_tp1x_rac")
|
||||
assert is_legacy_board(resources) is False
|
||||
bound, _ = _discover(resources)
|
||||
state = flatten(bound, resources)
|
||||
assert state["outdoor_temperature"] == 37.0 # OutdoorTemp_92, the fixture's own value
|
||||
|
||||
|
||||
def test_climate_legacy_airflow_gate_agrees_with_is_legacy_board():
|
||||
"""issue #161: climate.py's _legacy_airflow() delegates to
|
||||
capabilities/airconditioner.py's is_legacy_board() instead of
|
||||
|
||||
@@ -95,10 +95,13 @@ def test_power_and_convenient_folded_into_climate():
|
||||
assert "convenient_mode" not in state
|
||||
|
||||
|
||||
def test_air_filter_usage_is_percentage_of_capacity():
|
||||
"""filterUsage is a raw count in the capacity unit (100 of 500), surfaced as
|
||||
a percentage rather than the misleading raw value."""
|
||||
assert _state()["air_filter_usage"] == 20
|
||||
def test_air_filter_usage_is_already_a_percentage():
|
||||
"""filterUsage is already 0-100, not a raw count to divide by
|
||||
filterCapacity (issue #330): this fixture (ARTIK051_PRAC_20K) reports
|
||||
filterStatus == 'wash' at filterUsage == '100', which only holds if
|
||||
filterUsage is already a percent -- dividing by the 500 capacity again
|
||||
would read a filter due for washing as 20% fresh."""
|
||||
assert _state()["air_filter_usage"] == 100
|
||||
|
||||
|
||||
def test_climate_write_targets():
|
||||
@@ -149,6 +152,81 @@ def test_climate_write_targets():
|
||||
assert write(("bogus", 1), {}) is None
|
||||
|
||||
|
||||
def test_climate_write_preserves_half_degree_temperature_steps():
|
||||
"""CAC/TP1X FAC boards advertise `0.5` on both temperature resources.
|
||||
The increment on /temperatures/vs/0 lives inside its items[] entry (the
|
||||
same shape every fixture in the corpus uses), not at the resource's top
|
||||
level -- a fabricated flat `{"/temperatures/vs/0": {"increment": ...}}`
|
||||
resource would pass a step-reading bug like that silently.
|
||||
|
||||
Calls _climate_write directly rather than through ClimateDesc.write_fn
|
||||
(as test_climate_write_targets above does): WriteFn only declares the
|
||||
(payload, rep) shape every other write_fn honors, so the type checker
|
||||
rejects a call carrying the climate-only href/resources params through
|
||||
that narrower alias -- same reason test_coordinator_send_command.py and
|
||||
test_airconditioner_artik051_krac.py import the function directly too.
|
||||
"""
|
||||
resources = _load_device("airconditioner_cac")
|
||||
assert airconditioner._climate_write(("temperature_ocf", 24.5), {}, None, resources) == (
|
||||
["temperature", "desired", "0"],
|
||||
{"temperature": 24.5},
|
||||
)
|
||||
assert airconditioner._climate_write(("temperature", 24.5), {}, None, resources) == (
|
||||
["temperatures", "vs", "0"],
|
||||
{
|
||||
"x.com.samsung.da.items": [
|
||||
{"x.com.samsung.da.id": "0", "x.com.samsung.da.desired": "24.5"}
|
||||
]
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def test_temperature_step_falls_back_to_temps_vs_items_when_no_control_resource():
|
||||
"""Isolates the /temperatures/vs/0 fallback: every fixture that carries
|
||||
an increment there also carries /temperature/control/vs/0, which
|
||||
_temperature_step checks first -- so without dropping that resource,
|
||||
this fallback branch is never actually exercised, and reinstating the
|
||||
original bug (reading the increment off /temperatures/vs/0's top level
|
||||
instead of unwrapping its items[0]) would still pass every other test."""
|
||||
resources = dict(_load_device("airconditioner_cac"))
|
||||
del resources[airconditioner.HREF_TEMP_CONTROL]
|
||||
assert airconditioner._temperature_step(resources) == 0.5
|
||||
assert airconditioner._climate_write(("temperature", 24.5), {}, None, resources) == (
|
||||
["temperatures", "vs", "0"],
|
||||
{
|
||||
"x.com.samsung.da.items": [
|
||||
{"x.com.samsung.da.id": "0", "x.com.samsung.da.desired": "24.5"}
|
||||
]
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def test_climate_write_rounds_to_whole_degree_with_no_advertised_increment():
|
||||
"""ARTIK051 boards have neither /temperature/control/vs/0 nor an
|
||||
increment field on /temperatures/vs/0's item -- target_temperature_step
|
||||
(climate.py) defaults to 1.0 there, so the write path must match rather
|
||||
than pass the raw value through unrounded."""
|
||||
resources = _load_device("airconditioner_artik051_krac_18k")
|
||||
assert airconditioner._temperature_step(resources) is None
|
||||
assert airconditioner._climate_write(("temperature", 23.6), {}, None, resources) == (
|
||||
["temperatures", "vs", "0"],
|
||||
{
|
||||
"x.com.samsung.da.items": [
|
||||
{"x.com.samsung.da.id": "0", "x.com.samsung.da.desired": "24"}
|
||||
]
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def test_climate_write_rejects_non_numeric_temperature():
|
||||
"""A non-numeric payload must reject the write (return None) rather than
|
||||
build a body with `{"temperature": None}` -- coordinator.py's
|
||||
async_send_command logs and drops a write_fn result of None instead of
|
||||
POSTing it."""
|
||||
assert airconditioner._climate_write(("temperature_ocf", "not-a-number"), {}) is None
|
||||
assert airconditioner._climate_write(("temperature", None), {}) is None
|
||||
|
||||
|
||||
def test_climate_consumed_hrefs_declared_as_coverage():
|
||||
"""The climate-consumed and ambiguous hrefs are declared in the AC registry
|
||||
(as no-entity coverage caps) so they don't leak as gaps -- but produce no
|
||||
@@ -576,6 +654,22 @@ def test_lnx_rac_heatpump_no_unbound_hrefs():
|
||||
assert unbound == []
|
||||
|
||||
|
||||
def test_lnx_rac_heatpump_outdoor_temperature_stays_off_fahrenheit_boards():
|
||||
"""issue #367's -55 offset was field-validated on Celsius-locale boards
|
||||
only; this fixture's own /temperatures/vs/0 declares Fahrenheit despite
|
||||
carrying an OutdoorTemp_ token, so the sensor stays off rather than
|
||||
apply an unvalidated offset/unit to it (see _reports_celsius)."""
|
||||
reg, resources = _ac_lnx_rac_heatpump()
|
||||
temps_item = resources["/temperatures/vs/0"]["x.com.samsung.da.items"][0]
|
||||
assert temps_item["x.com.samsung.da.unit"] == "Fahrenheit"
|
||||
options = resources["/mode/vs/0"]["x.com.samsung.da.options"]
|
||||
assert any(o.startswith("OutdoorTemp_") for o in options)
|
||||
|
||||
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
|
||||
state = flatten(bound, resources)
|
||||
assert "outdoor_temperature" not in state
|
||||
|
||||
|
||||
def test_lnx_rac_heatpump_absence_power_saving_state():
|
||||
reg, resources = _ac_lnx_rac_heatpump()
|
||||
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
|
||||
@@ -771,19 +865,34 @@ def test_tropical_night_state_levels_across_fixtures():
|
||||
assert level("airconditioner_tp2x_rac_20k") == 16
|
||||
|
||||
|
||||
def test_air_filter_usage_hours_reads_raw_count():
|
||||
"""filterUsage is a lifetime hour counter (41 of 500) that resets on
|
||||
filter replacement -- total_increasing, not measurement. Unit comes from
|
||||
def test_air_filter_usage_hours_derived_from_percent_and_capacity():
|
||||
"""filterUsage is a percent, not an hour count (issue #330): the lifetime
|
||||
hour reading is derived from percent * capacity rather than read off
|
||||
filterUsage directly. total_increasing, not measurement; unit comes from
|
||||
filterCapacityUnit via unit_fn, not a hardcoded 'h'."""
|
||||
desc = next(
|
||||
e
|
||||
for e in airconditioner.AIR_FILTER.entities
|
||||
if e.key == "air_filter_usage_hours" and isinstance(e, SensorDesc)
|
||||
)
|
||||
assert desc.value_fn("41") == 41
|
||||
assert desc.value_fn(41) == 41
|
||||
assert desc.value_fn(None) is None
|
||||
assert desc.value_fn("not-a-number") is None
|
||||
assert desc.rep_fn is not None
|
||||
assert (
|
||||
desc.rep_fn(
|
||||
{"x.com.samsung.da.filterUsage": "91", "x.com.samsung.da.filterCapacity": "500"}
|
||||
)
|
||||
== 455.0
|
||||
)
|
||||
assert (
|
||||
desc.rep_fn(
|
||||
{
|
||||
"x.com.samsung.da.filterUsage": "not-a-number",
|
||||
"x.com.samsung.da.filterCapacity": "500",
|
||||
}
|
||||
)
|
||||
is None
|
||||
)
|
||||
assert desc.rep_fn({"x.com.samsung.da.filterCapacity": "500"}) is None
|
||||
assert desc.rep_fn({"x.com.samsung.da.filterUsage": "91"}) is None
|
||||
assert desc.device_class == "duration"
|
||||
assert desc.state_class == "total_increasing"
|
||||
assert desc.unit_fn is not None
|
||||
@@ -830,8 +939,8 @@ def test_air_filter_threshold_absent_without_supported_enum():
|
||||
reg, resources = _ac_windfree()
|
||||
state = flatten(discover(resources, reg.capabilities, reg.pattern_capabilities), resources)
|
||||
assert "air_filter_threshold" not in state
|
||||
assert state["air_filter_usage_hours"] == 41
|
||||
assert state["air_filter_usage"] == 8 # 41/500 -> 8%
|
||||
assert state["air_filter_usage"] == 41
|
||||
assert state["air_filter_usage_hours"] == 205.0 # 41% of 500
|
||||
|
||||
|
||||
def test_air_filter_threshold_binds_on_enum_board():
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
"""Cloud "Download" programs on laundry devices (issue #342).
|
||||
|
||||
The store and blob parsing live in cloudcourse.py; how they reach the cycle
|
||||
select lives in registry/capabilities/laundry.py. Both are covered here,
|
||||
against the two real dumps in the corpus that carry these tokens:
|
||||
|
||||
washer_ww5000c_cloud the issue #342 reporter's WW5000C, sitting on
|
||||
Download with a one-time Jeans override loaded over
|
||||
a saved Sports default. Advertises nine programs.
|
||||
washer_wa55a7700av a WA55A7700AV sitting on an ordinary local course,
|
||||
with a saved program and the FFFF "none" sentinel in
|
||||
the one-time slot. Advertises two programs.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
from custom_components.localthings import cloudcourse
|
||||
from custom_components.localthings.registry.capabilities import laundry, washer
|
||||
from custom_components.localthings.registry.entities import SelectDesc
|
||||
from tests.conftest import _load_device
|
||||
|
||||
# The reporter's nine captured programs, keyed by the slot byte the device
|
||||
# itself advertises. Only used to drive the tests -- nothing in the shipped
|
||||
# code carries a table of these (see cloudcourse.py's module docstring).
|
||||
SPORTS = "0021550449284D134AA04C0035F004F005F0AC00"
|
||||
JEANS = "001F6B0449284D134AA04C0035F004F005F0AC00"
|
||||
TOWELS = "00040A0449404D134AB84C0035F004F005F0AC00"
|
||||
|
||||
|
||||
def _cycle_desc():
|
||||
return next(
|
||||
e for e in washer.WASHER_COURSE.entities if e.key == "cycle" and isinstance(e, SelectDesc)
|
||||
)
|
||||
|
||||
|
||||
def _rep(options, cloud=None):
|
||||
rep = {"x.com.samsung.da.options": list(options)}
|
||||
if cloud is not None:
|
||||
rep[cloudcourse.FIELD] = cloud
|
||||
return rep
|
||||
|
||||
|
||||
class TestBlobParsing:
|
||||
def test_slot_is_byte_two(self):
|
||||
"""Confirmed against every program in both dumps: byte 2 of a blob
|
||||
is the slot id its own CloudExtraCourse_ token advertises."""
|
||||
assert cloudcourse.slot_of(SPORTS) == "55"
|
||||
assert cloudcourse.slot_of(JEANS) == "6B"
|
||||
assert cloudcourse.slot_of(TOWELS) == "0A"
|
||||
|
||||
def test_ffff_prefix_is_not_a_program(self):
|
||||
"""WA55A7700AV reports this while sitting on a local course -- it
|
||||
means 'no one-time override', not a program, and its byte 2 is not
|
||||
one of the slots that device advertises."""
|
||||
sentinel = "FFFF010049004D004A804C0037F0AC00"
|
||||
assert cloudcourse.is_loaded(sentinel) is False
|
||||
assert cloudcourse.slot_of(sentinel) is None
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"bad",
|
||||
[None, "", "zz", "0021", "0021550449284D134AA04C0035F004F005F0AC0"],
|
||||
)
|
||||
def test_malformed_blobs_yield_no_slot(self, bad):
|
||||
assert cloudcourse.slot_of(bad) is None
|
||||
|
||||
def test_advertised_slots_preserve_device_order(self):
|
||||
rep = _rep(["CloudExtraCourse_0A5C286B2D0C55301A"])
|
||||
assert cloudcourse.advertised_slots(rep) == [
|
||||
"0A",
|
||||
"5C",
|
||||
"28",
|
||||
"6B",
|
||||
"2D",
|
||||
"0C",
|
||||
"55",
|
||||
"30",
|
||||
"1A",
|
||||
]
|
||||
|
||||
def test_no_cloud_tokens_means_unsupported(self):
|
||||
assert cloudcourse.supports_cloud_courses(_rep(["Course_1C"]), ["1C"]) is False
|
||||
|
||||
|
||||
class TestRealDumps:
|
||||
def test_reporter_dump_advertises_nine_and_learns_both_loaded_blobs(self):
|
||||
"""One poll teaches two programs: the saved default and the loaded
|
||||
one-time override are different programs on this dump."""
|
||||
rep = _load_device("washer_ww5000c_cloud")["/course/vs/0"]
|
||||
assert len(cloudcourse.advertised_slots(rep)) == 9
|
||||
|
||||
store = cloudcourse.CloudCourses()
|
||||
assert store.observe(rep) is True
|
||||
assert store.snapshot()["slots"]["55"]["blob"] == SPORTS
|
||||
assert store.snapshot()["slots"]["6B"]["blob"] == JEANS
|
||||
# Learned but unnamed -- nothing is offerable yet.
|
||||
assert store.named() == {}
|
||||
assert store.view() == {}
|
||||
|
||||
def test_reporter_dump_proposes_its_download_course(self):
|
||||
"""Only once a load has actually been watched. A single observation
|
||||
can't tell "just loaded" from "left over", so the dump alone proposes
|
||||
nothing -- see test_a_single_observation_proposes_nothing."""
|
||||
rep = _load_device("washer_ww5000c_cloud")["/course/vs/0"]
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(_rep(["CloudExtraCourse_556B", "Course_87", f"OneTimeCloudCourse_{SPORTS}"]))
|
||||
store.observe(rep) # one-time token moves to Jeans while on Course_87
|
||||
assert store.download_candidates() == ["87"]
|
||||
# A candidate is never used until confirmed.
|
||||
assert store.snapshot()["download_course"] is None
|
||||
|
||||
def test_a_single_observation_proposes_nothing(self):
|
||||
"""The case a user hits after any restart: the appliance has cloud
|
||||
payloads from previous runs and is sitting on an ordinary course. If
|
||||
the board doesn't clear its one-time token, believing the first
|
||||
observation would propose that ordinary course as the Download one --
|
||||
and accepting the prefill would start a real wash cycle."""
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(_rep(["CloudExtraCourse_55", "Course_1B", f"OneTimeCloudCourse_{SPORTS}"]))
|
||||
assert store.download_candidates() == []
|
||||
# The payload is still learned -- that part is device fact.
|
||||
assert store.snapshot()["slots"]["55"]["blob"] == SPORTS
|
||||
|
||||
def test_wa55_learns_its_saved_program_but_not_the_sentinel(self):
|
||||
rep = _load_device("washer_wa55a7700av")["/course/vs/0"]
|
||||
assert cloudcourse.advertised_slots(rep) == ["59", "58"]
|
||||
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(rep)
|
||||
assert store.snapshot()["slots"]["59"]["blob"] == "001C590549164D114A224C2037F0AC22"
|
||||
assert "01" not in store.snapshot()["slots"] # the FFFF sentinel's byte 2
|
||||
|
||||
def test_wa55_proposes_no_download_course(self):
|
||||
"""It is sitting on an ordinary local course with no override
|
||||
loaded, so there is nothing to infer -- exactly the case where
|
||||
guessing a code would start the wrong cycle."""
|
||||
rep = _load_device("washer_wa55a7700av")["/course/vs/0"]
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(rep)
|
||||
assert store.download_candidates() == []
|
||||
|
||||
def test_a_dishwasher_tags_its_own_courses_not_payload_slots(self):
|
||||
"""DW5000C (issues #113/#123). Its CloudExtraCourse_ names four
|
||||
bytes, and all four are course codes in its *own* course list --
|
||||
8E/8D/8F/02, three of them already translated (Plastic, Pots and
|
||||
pans, Baby Care). There it marks which ordinary courses came from
|
||||
the cloud; they select with a plain Course_ write and need nothing
|
||||
from this module. It carries no payload token at all, consistent
|
||||
with that.
|
||||
|
||||
So none of this feature applies to it, and offering its owner a
|
||||
naming flow for programs that already work would be nonsense. The
|
||||
washers are the other shape: zero overlap with their course lists,
|
||||
and a payload required to select one."""
|
||||
resources = _load_device("dishwasher_dw5000c_cloud")
|
||||
rep = resources["/course/vs/0"]
|
||||
courses = laundry.cycle_options(resources)
|
||||
|
||||
assert cloudcourse.advertised_slots(rep) == ["8E", "8D", "8F", "02"]
|
||||
assert set(cloudcourse.advertised_slots(rep)) <= set(courses)
|
||||
assert cloudcourse.cloud_slots(rep, courses) == []
|
||||
assert cloudcourse.supports_cloud_courses(rep, courses) is False
|
||||
assert cloudcourse.undiscovered(rep, cloudcourse.CloudCourses().snapshot(), courses) == []
|
||||
|
||||
def test_washer_slots_share_nothing_with_the_course_list(self):
|
||||
"""The distinguishing property, on both washers -- which is what
|
||||
makes subtracting the course list a safe way to tell the two
|
||||
meanings of CloudExtraCourse_ apart."""
|
||||
for name in ("washer_ww5000c_cloud", "washer_wa55a7700av"):
|
||||
resources = _load_device(name)
|
||||
rep = resources["/course/vs/0"]
|
||||
courses = laundry.cycle_options(resources)
|
||||
assert set(cloudcourse.advertised_slots(rep)).isdisjoint(courses), name
|
||||
assert cloudcourse.supports_cloud_courses(rep, courses) is True, name
|
||||
|
||||
def test_byte_three_is_not_part_of_a_programs_identity(self):
|
||||
"""Two WW5000C units on different firmware (issue #342's _B06C and
|
||||
issues #259/#343's _B048) report the same program -- same id, same
|
||||
slot, same field values, same tail -- differing only at byte 3.
|
||||
|
||||
This is the evidence against a shipped catalog of payloads: keyed on
|
||||
program id, one unit's capture would have carried the other unit's
|
||||
byte 3. Both are recorded and replayed per device instead, so
|
||||
whatever byte 3 tracks never has to be understood."""
|
||||
b06c = "00040A0449404D134AB84C0035F004F005F0AC00"
|
||||
b048 = "00040A0649404D134AB84C0035F004F005F0AC00"
|
||||
assert b06c != b048
|
||||
# Same program by every identifier the device gives us.
|
||||
assert cloudcourse.slot_of(b06c) == cloudcourse.slot_of(b048) == "0A"
|
||||
assert b06c[:6] == b048[:6]
|
||||
assert b06c[8:] == b048[8:]
|
||||
# Learned separately per device, and each replays what it saw.
|
||||
for blob in (b06c, b048):
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(_rep(["CloudExtraCourse_0A", f"CloudCourse_{blob}"]))
|
||||
assert store.snapshot()["slots"]["0A"]["blob"] == blob
|
||||
|
||||
def test_a_sentinel_slot_byte_is_not_the_current_course(self):
|
||||
"""The two sentinels in the corpus disagree about this -- WA55's byte
|
||||
2 happens to equal its selected course, the WW5000C _B048's does not
|
||||
(1B against Course_1C). Nothing keys off it: a sentinel is rejected
|
||||
on its FFFF prefix, and its byte 2 is not an advertised slot either
|
||||
way."""
|
||||
wa55 = "FFFF010049004D004A804C0037F0AC00"
|
||||
b048 = "FFFF1B0049004D004A804C0035F004F005F0AC00"
|
||||
assert cloudcourse.slot_of(wa55) is None
|
||||
assert cloudcourse.slot_of(b048) is None
|
||||
# Different board widths, same sentinel rule.
|
||||
assert len(wa55) != len(b048)
|
||||
|
||||
def test_undiscovered_counts_against_what_the_device_advertises(self):
|
||||
rep = _load_device("washer_ww5000c_cloud")["/course/vs/0"]
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(rep)
|
||||
# Both learned slots are still unnamed, so all nine are outstanding.
|
||||
courses = laundry.cycle_options(_load_device("washer_ww5000c_cloud"))
|
||||
assert len(cloudcourse.undiscovered(rep, store.snapshot(), courses)) == 9
|
||||
store.set_name("55", "Sports")
|
||||
assert "55" not in cloudcourse.undiscovered(rep, store.snapshot(), courses)
|
||||
assert len(cloudcourse.undiscovered(rep, store.snapshot(), courses)) == 8
|
||||
|
||||
|
||||
class TestStoreRules:
|
||||
def test_only_advertised_slots_are_recorded(self):
|
||||
"""A blob for a slot this appliance doesn't list isn't a program it
|
||||
offers."""
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(_rep(["CloudExtraCourse_55", f"OneTimeCloudCourse_{JEANS}"]))
|
||||
assert "6B" not in store.snapshot()["slots"]
|
||||
|
||||
def test_a_relearned_blob_replaces_the_old_payload(self):
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(_rep(["CloudExtraCourse_55", f"CloudCourse_{SPORTS}"]))
|
||||
rewritten = SPORTS.replace("F005F0AC00", "F005F0AC11")
|
||||
assert store.observe(_rep(["CloudExtraCourse_55", f"CloudCourse_{rewritten}"])) is True
|
||||
assert store.snapshot()["slots"]["55"]["blob"] == rewritten
|
||||
|
||||
def test_observing_the_same_rep_twice_changes_nothing(self):
|
||||
store = cloudcourse.CloudCourses()
|
||||
rep = _rep(["CloudExtraCourse_55", f"CloudCourse_{SPORTS}"])
|
||||
assert store.observe(rep) is True
|
||||
assert store.observe(rep) is False
|
||||
|
||||
def test_candidates_rank_by_program_loads_not_by_dwell_time(self):
|
||||
"""A stale OneTimeCloudCourse_ token outlives the run it belonged to,
|
||||
so it is still reported through every poll the appliance spends on
|
||||
whatever ordinary course comes next. Counting polls would rank that
|
||||
course first and suggest it as the Download course -- and accepting
|
||||
the suggestion would start a real wash cycle. Only the poll where the
|
||||
payload actually changed is evidence."""
|
||||
store = cloudcourse.CloudCourses()
|
||||
loaded = _rep(["CloudExtraCourse_55", "Course_87", f"OneTimeCloudCourse_{SPORTS}"])
|
||||
stale = _rep(["CloudExtraCourse_55", "Course_1B", f"OneTimeCloudCourse_{SPORTS}"])
|
||||
store.observe(_rep(["CloudExtraCourse_55", "Course_87"])) # baseline
|
||||
store.observe(loaded)
|
||||
for _ in range(200): # ~100 minutes sitting on a cotton cycle
|
||||
store.observe(stale)
|
||||
assert store.download_candidates() == ["87"]
|
||||
|
||||
def test_a_second_distinct_load_is_counted(self):
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(_rep(["CloudExtraCourse_556B", "Course_87"])) # baseline
|
||||
store.observe(_rep(["CloudExtraCourse_556B", "Course_87", f"OneTimeCloudCourse_{SPORTS}"]))
|
||||
store.observe(_rep(["CloudExtraCourse_556B", "Course_87", f"OneTimeCloudCourse_{JEANS}"]))
|
||||
assert store.download_candidates() == ["87"]
|
||||
|
||||
def test_view_is_empty_until_a_download_course_is_confirmed(self):
|
||||
"""Both halves are required: without the course code there is no
|
||||
write to build, so nothing should reach the select."""
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(_rep(["CloudExtraCourse_55", f"CloudCourse_{SPORTS}"]))
|
||||
store.set_name("55", "Sports")
|
||||
assert store.view() == {}
|
||||
store.set_download_course("87")
|
||||
assert store.view()["programs"] == {"55": {"blob": SPORTS, "name": "Sports"}}
|
||||
|
||||
def test_round_trips_through_the_entry(self):
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(_rep(["CloudExtraCourse_55", f"CloudCourse_{SPORTS}"]))
|
||||
store.set_name("55", "Sports")
|
||||
store.set_download_course("87")
|
||||
restored = cloudcourse.CloudCourses(store.snapshot())
|
||||
assert restored.snapshot() == store.snapshot()
|
||||
assert restored.view() == store.view()
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"junk",
|
||||
[
|
||||
"not a dict",
|
||||
{"slots": "nope"},
|
||||
{"slots": {"55": {"blob": "garbage", "name": "Sports"}}},
|
||||
# blob's own byte 2 disagrees with the key it is filed under
|
||||
{"slots": {"99": {"blob": SPORTS, "name": "Sports"}}},
|
||||
],
|
||||
)
|
||||
def test_a_hand_edited_entry_cannot_crash_setup(self, junk):
|
||||
assert cloudcourse.CloudCourses(junk).snapshot()["slots"] == {}
|
||||
|
||||
|
||||
class TestCycleSelectIntegration:
|
||||
"""The cloud programs ride in the ordinary cycle select -- on the
|
||||
appliance's dial, Download is one course among the rest."""
|
||||
|
||||
def _cloud(self):
|
||||
return {
|
||||
"download_course": "87",
|
||||
"programs": {"55": {"blob": SPORTS, "name": "Sports"}},
|
||||
}
|
||||
|
||||
def test_local_courses_are_unchanged_without_cloud_data(self):
|
||||
desc = _cycle_desc()
|
||||
live = {"/wm/editcourse/vs/0": {"x.com.samsung.da.editCourseList": "EditCourseList_1C1D"}}
|
||||
assert desc.options(live) == ["1C", "1D"]
|
||||
|
||||
def test_named_programs_join_the_option_list_after_local_courses(self):
|
||||
desc = _cycle_desc()
|
||||
live = {
|
||||
"/wm/editcourse/vs/0": {"x.com.samsung.da.editCourseList": "EditCourseList_1C87"},
|
||||
"/course/vs/0": _rep(["Course_87"], self._cloud()),
|
||||
}
|
||||
assert desc.options(live) == ["1C", "87", "cloud:55"]
|
||||
|
||||
def test_an_unnamed_program_is_never_offered(self):
|
||||
desc = _cycle_desc()
|
||||
live = {
|
||||
"/wm/editcourse/vs/0": {"x.com.samsung.da.editCourseList": "EditCourseList_1C"},
|
||||
"/course/vs/0": _rep(
|
||||
["Course_87"],
|
||||
{"download_course": "87", "programs": {}},
|
||||
),
|
||||
}
|
||||
assert desc.options(live) == ["1C"]
|
||||
|
||||
def test_label_is_the_users_own_name(self):
|
||||
desc = _cycle_desc()
|
||||
resources = {"/course/vs/0": _rep(["Course_87"], self._cloud())}
|
||||
assert desc.display_fn("cloud:55", resources) == "Sports"
|
||||
|
||||
def test_unknown_cloud_value_gets_no_invented_label(self):
|
||||
desc = _cycle_desc()
|
||||
resources = {"/course/vs/0": _rep(["Course_87"], self._cloud())}
|
||||
assert desc.display_fn("cloud:99", resources) is None
|
||||
|
||||
def test_state_reports_the_loaded_program_while_on_download(self):
|
||||
desc = _cycle_desc()
|
||||
rep = _rep(["Course_87", f"OneTimeCloudCourse_{SPORTS}"], self._cloud())
|
||||
assert desc.rep_fn(rep) == "cloud:55"
|
||||
|
||||
def test_state_falls_back_to_the_saved_program(self):
|
||||
"""No one-time override loaded: the appliance runs the saved default,
|
||||
which the reporter confirmed by leaving Download and returning."""
|
||||
desc = _cycle_desc()
|
||||
rep = _rep(
|
||||
["Course_87", f"CloudCourse_{SPORTS}", "OneTimeCloudCourse_FFFF010049004D004A804C00"],
|
||||
self._cloud(),
|
||||
)
|
||||
assert desc.rep_fn(rep) == "cloud:55"
|
||||
|
||||
def test_a_stale_program_token_is_not_reported_on_a_local_course(self):
|
||||
"""Tokens are replaced by prefix and never evicted, so a one-time
|
||||
program outlives its run. Reporting 'Sports' while a cotton cycle
|
||||
runs would be a live lie about what the machine is doing."""
|
||||
desc = _cycle_desc()
|
||||
rep = _rep(["Course_1C", f"OneTimeCloudCourse_{SPORTS}"], self._cloud())
|
||||
assert desc.rep_fn(rep) == "1C"
|
||||
|
||||
def test_selecting_a_program_switches_course_and_loads_it_in_one_write(self):
|
||||
"""Confirmed on hardware: writing the program token alone while
|
||||
another course is selected is silently ignored."""
|
||||
desc = _cycle_desc()
|
||||
rep = _rep(["Course_1C"], self._cloud())
|
||||
path, body = desc.write_fn("cloud:55", rep)
|
||||
assert path == ["course", "vs", "0"]
|
||||
assert body == {"x.com.samsung.da.options": ["Course_87", f"OneTimeCloudCourse_{SPORTS}"]}
|
||||
|
||||
def test_selecting_a_local_course_still_writes_one_token(self):
|
||||
desc = _cycle_desc()
|
||||
rep = _rep(["Course_87"], self._cloud())
|
||||
_, body = desc.write_fn("1C", rep)
|
||||
assert body == {"x.com.samsung.da.options": ["Course_1C"]}
|
||||
|
||||
def test_no_write_without_a_confirmed_download_course(self):
|
||||
desc = _cycle_desc()
|
||||
rep = _rep(["Course_1C"], {"programs": {"55": {"blob": SPORTS, "name": "Sports"}}})
|
||||
assert desc.write_fn("cloud:55", rep) is None
|
||||
|
||||
def test_no_write_for_an_unknown_program(self):
|
||||
desc = _cycle_desc()
|
||||
rep = _rep(["Course_1C"], self._cloud())
|
||||
assert desc.write_fn("cloud:99", rep) is None
|
||||
|
||||
|
||||
class TestOptionsMergePreservesSiblingTokens:
|
||||
def test_two_token_write_merges_like_the_device_does(self):
|
||||
"""The write carries only the changed tokens; merge_options_field is
|
||||
what keeps the optimistic cache entry complete during the settle
|
||||
window. Both tokens must land, and unrelated ones must survive."""
|
||||
from custom_components.localthings.registry.capabilities.common import merge_options_field
|
||||
|
||||
cached = [
|
||||
"DeviceType_0167",
|
||||
"Course_1C",
|
||||
f"CloudCourse_{SPORTS}",
|
||||
"CloudExtraCourse_0A5C286B2D0C55301A",
|
||||
f"OneTimeCloudCourse_{TOWELS}",
|
||||
"GMT_04",
|
||||
]
|
||||
merged = merge_options_field(cached, ["Course_87", f"OneTimeCloudCourse_{SPORTS}"])
|
||||
assert "Course_87" in merged
|
||||
assert f"OneTimeCloudCourse_{SPORTS}" in merged
|
||||
# The saved default and the device's own slot list are untouched.
|
||||
assert f"CloudCourse_{SPORTS}" in merged
|
||||
assert "CloudExtraCourse_0A5C286B2D0C55301A" in merged
|
||||
assert "DeviceType_0167" in merged
|
||||
|
||||
def test_cloud_prefixes_do_not_poison_the_course_lookup(self):
|
||||
"""'Course_' is a prefix of neither 'CloudCourse_' nor
|
||||
'OneTimeCloudCourse_' only because option_value anchors at position
|
||||
0 -- one character away from being wrong, so it is pinned."""
|
||||
options = [f"CloudCourse_{SPORTS}", f"OneTimeCloudCourse_{JEANS}", "Course_1C"]
|
||||
assert laundry.option_value(options, "Course") == "1C"
|
||||
assert cloudcourse.option_value(options, "Course") == "1C"
|
||||
|
||||
def test_a_payload_appearing_while_watching_is_a_real_transition(self):
|
||||
"""Absent-then-loaded is the user selecting a program, and must count
|
||||
-- only "never observed at all" suppresses a candidate."""
|
||||
store = cloudcourse.CloudCourses()
|
||||
store.observe(_rep(["CloudExtraCourse_55", "Course_87"]))
|
||||
store.observe(_rep(["CloudExtraCourse_55", "Course_87", f"OneTimeCloudCourse_{SPORTS}"]))
|
||||
assert store.download_candidates() == ["87"]
|
||||
|
||||
def test_a_stale_payload_across_a_restart_proposes_nothing(self):
|
||||
"""A restored store starts unobserved again on purpose: the first rep
|
||||
after a restart is indistinguishable from a stale one, whatever was
|
||||
persisted."""
|
||||
seeded = cloudcourse.CloudCourses()
|
||||
seeded.observe(_rep(["CloudExtraCourse_55", "Course_87", f"OneTimeCloudCourse_{SPORTS}"]))
|
||||
restored = cloudcourse.CloudCourses(seeded.snapshot())
|
||||
restored.observe(_rep(["CloudExtraCourse_55", "Course_1B", f"OneTimeCloudCourse_{SPORTS}"]))
|
||||
assert restored.download_candidates() == []
|
||||
@@ -0,0 +1,786 @@
|
||||
"""End-to-end wiring for cloud "Download" cycles (issue #342).
|
||||
|
||||
The store's own rules are covered in test_cloud_courses.py. This file covers
|
||||
the parts that only exist once a coordinator is running: learning from an
|
||||
applied rep, persisting to the config entry, surfacing the store to entity
|
||||
descriptors through the synthetic field, the Repairs nudge, and the options
|
||||
flow that supplies the names.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
import json
|
||||
from typing import Any, cast
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
import cbor2
|
||||
import pytest
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from pytest_homeassistant_custom_component.common import MockConfigEntry
|
||||
|
||||
from custom_components.localthings import cloudcourse
|
||||
from custom_components.localthings.const import CONF_CLOUD_COURSES, DOMAIN
|
||||
from custom_components.localthings.coordinator import LocalThingsCoordinator
|
||||
from custom_components.localthings.registry.entities import SelectDesc
|
||||
from custom_components.localthings.registry.subdevices import MAIN
|
||||
from tests.conftest import _load_device
|
||||
from tests.test_subdevice_discovery import ENTRY_DATA
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _fast_guided_waits(monkeypatch):
|
||||
"""Guided setup polls the appliance on a human timescale. Left at its
|
||||
real values a single lingering round would hold the suite for its whole
|
||||
timeout, since async_block_till_done waits on the task."""
|
||||
from custom_components.localthings import config_flow as cf
|
||||
|
||||
monkeypatch.setattr(cf, "_CLOUD_PROBE_INTERVAL_S", 0.01)
|
||||
monkeypatch.setattr(cf, "_CLOUD_WAIT_TIMEOUT_S", 0.5)
|
||||
|
||||
|
||||
FIXTURE = "washer_ww5000c_cloud"
|
||||
COURSE = cloudcourse.COURSE_HREF
|
||||
|
||||
SPORTS = "0021550449284D134AA04C0035F004F005F0AC00"
|
||||
JEANS = "001F6B0449284D134AA04C0035F004F005F0AC00"
|
||||
|
||||
|
||||
async def _flush(hass: HomeAssistant) -> None:
|
||||
"""hass.add_job hops used by the persist path."""
|
||||
for _ in range(3):
|
||||
await asyncio.sleep(0)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
def _entry(hass: HomeAssistant, data=None) -> MockConfigEntry:
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
data={**ENTRY_DATA, **(data or {})},
|
||||
unique_id="localthings_CLOUD-COURSE-TEST",
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
return entry
|
||||
|
||||
|
||||
async def _coordinator(hass: HomeAssistant, entry=None) -> LocalThingsCoordinator:
|
||||
coordinator = LocalThingsCoordinator(hass, entry or _entry(hass))
|
||||
resources = _load_device(FIXTURE)
|
||||
coordinator._run_discovery(resources)
|
||||
for href, rep in resources.items():
|
||||
coordinator._observe.apply(href, rep, source="poll")
|
||||
await _flush(hass)
|
||||
return coordinator
|
||||
|
||||
|
||||
def _cycle_state(coordinator: LocalThingsCoordinator):
|
||||
from custom_components.localthings.registry.adapter import flatten
|
||||
|
||||
return flatten(coordinator.bound, coordinator.entity_resources()).get("cycle")
|
||||
|
||||
|
||||
def _cycle_desc(coordinator: LocalThingsCoordinator) -> SelectDesc:
|
||||
return cast(SelectDesc, next(b.desc for b in coordinator.bound if b.desc.key == "cycle"))
|
||||
|
||||
|
||||
def _cycle_options(coordinator: LocalThingsCoordinator):
|
||||
from custom_components.localthings.registry.subdevices import MAIN
|
||||
|
||||
return _cycle_desc(coordinator).options(coordinator.canonical_resources(MAIN))
|
||||
|
||||
|
||||
async def test_a_poll_learns_and_persists_the_loaded_programs(hass: HomeAssistant):
|
||||
entry = _entry(hass)
|
||||
coordinator = await _coordinator(hass, entry)
|
||||
|
||||
assert coordinator.cloud_courses.snapshot()["slots"]["55"]["blob"] == SPORTS
|
||||
assert coordinator.cloud_courses.snapshot()["slots"]["6B"]["blob"] == JEANS
|
||||
# Survives a restart -- the payload is only visible while loaded.
|
||||
assert entry.data[CONF_CLOUD_COURSES]["slots"]["55"]["blob"] == SPORTS
|
||||
|
||||
|
||||
async def test_an_optimistic_write_teaches_nothing(hass: HomeAssistant):
|
||||
"""An optimistic rep is what this integration just wrote, not what the
|
||||
appliance reported."""
|
||||
coordinator = LocalThingsCoordinator(hass, _entry(hass))
|
||||
coordinator._observe.apply(
|
||||
COURSE,
|
||||
{"x.com.samsung.da.options": ["CloudExtraCourse_55", f"CloudCourse_{SPORTS}"]},
|
||||
source="optimistic",
|
||||
)
|
||||
await _flush(hass)
|
||||
assert "55" not in coordinator.cloud_courses.snapshot()["slots"]
|
||||
|
||||
|
||||
async def test_learned_but_unnamed_programs_stay_out_of_the_cycle_select(hass: HomeAssistant):
|
||||
coordinator = await _coordinator(hass)
|
||||
options = _cycle_options(coordinator)
|
||||
assert all(not o.startswith(cloudcourse.RAW_PREFIX) for o in options)
|
||||
# The local courses are untouched.
|
||||
assert "87" in options
|
||||
|
||||
|
||||
async def test_naming_a_program_puts_it_in_the_cycle_select(hass: HomeAssistant):
|
||||
coordinator = await _coordinator(hass)
|
||||
coordinator.apply_cloud_courses({"55": "Sports"}, "87")
|
||||
await _flush(hass)
|
||||
|
||||
assert "cloud:55" in _cycle_options(coordinator)
|
||||
# The fixture is sitting on Download with a Jeans one-time override, and
|
||||
# Jeans is still unnamed -- so the state falls through to the raw course.
|
||||
assert _cycle_state(coordinator) == "87"
|
||||
|
||||
coordinator.apply_cloud_courses({"6B": "Jeans"}, "87")
|
||||
await _flush(hass)
|
||||
assert _cycle_state(coordinator) == "cloud:6B"
|
||||
|
||||
|
||||
async def test_the_synthetic_field_never_reaches_the_device_snapshot(hass: HomeAssistant):
|
||||
"""It is merged at read time only: last_resources stays exactly what the
|
||||
appliance reported, so it can't be polled over, written back, or land in
|
||||
a diagnostics dump."""
|
||||
coordinator = await _coordinator(hass)
|
||||
coordinator.apply_cloud_courses({"55": "Sports"}, "87")
|
||||
await _flush(hass)
|
||||
|
||||
assert cloudcourse.FIELD in coordinator.entity_resources()[COURSE]
|
||||
assert cloudcourse.FIELD not in coordinator.last_resources[COURSE]
|
||||
assert cloudcourse.FIELD not in coordinator.resource(COURSE)
|
||||
|
||||
|
||||
async def test_selecting_a_named_program_writes_both_tokens(hass: HomeAssistant):
|
||||
"""Driven through async_send_command rather than write_fn directly: the
|
||||
command path builds its own rep, and a rep taken straight off the state
|
||||
cache carries no cloud programs, so the write would silently no-op."""
|
||||
coordinator = await _coordinator(hass)
|
||||
coordinator.apply_cloud_courses({"55": "Sports"}, "87")
|
||||
await _flush(hass)
|
||||
|
||||
sent: list[tuple[list[str], bytes]] = []
|
||||
|
||||
class _FakeSession:
|
||||
def post(self, path_segs, payload, timeout=None):
|
||||
sent.append((path_segs, payload))
|
||||
return 0x44, b""
|
||||
|
||||
def pace(self):
|
||||
pass
|
||||
|
||||
coordinator._session = cast(Any, _FakeSession())
|
||||
# Same shape as test_coordinator_send_command's fixture: a write schedules
|
||||
# a debounced refresh, which would poll through this fake and leave its
|
||||
# timer behind after the test.
|
||||
coordinator.async_request_refresh = AsyncMock()
|
||||
bound = next(b for b in coordinator.bound if b.desc.key == "cycle")
|
||||
await coordinator.async_send_command(bound, "cloud:55")
|
||||
|
||||
assert len(sent) == 1
|
||||
path_segs, payload = sent[0]
|
||||
assert path_segs == ["course", "vs", "0"]
|
||||
assert cbor2.loads(payload)["x.com.samsung.da.options"] == [
|
||||
"Course_87",
|
||||
f"OneTimeCloudCourse_{SPORTS}",
|
||||
]
|
||||
# The optimistic merge keeps the rest of the array intact for the settle
|
||||
# window -- including the device's own slot list and the saved default.
|
||||
merged = coordinator.resource(COURSE)["x.com.samsung.da.options"]
|
||||
assert "Course_87" in merged
|
||||
assert f"OneTimeCloudCourse_{SPORTS}" in merged
|
||||
assert "CloudExtraCourse_0A5C286B2D0C55301A" in merged
|
||||
|
||||
|
||||
async def test_a_repair_is_raised_until_every_program_is_named(hass: HomeAssistant):
|
||||
entry = _entry(hass)
|
||||
coordinator = await _coordinator(hass, entry)
|
||||
coordinator._refresh_cloud_course_issue()
|
||||
await _flush(hass)
|
||||
|
||||
registry = ir.async_get(hass)
|
||||
issue_id = f"cloud_courses_{entry.entry_id}"
|
||||
issue = registry.async_get_issue(DOMAIN, issue_id)
|
||||
assert issue is not None
|
||||
assert (issue.translation_placeholders or {})["total"] == "9"
|
||||
|
||||
for slot in cloudcourse.advertised_slots(coordinator.cloud_course_rep()):
|
||||
# Only two are learned; name every advertised slot to close the gap.
|
||||
coordinator.cloud_courses.observe(
|
||||
{
|
||||
"x.com.samsung.da.options": [
|
||||
"CloudExtraCourse_0A5C286B2D0C55301A",
|
||||
f"CloudCourse_0000{slot}0449284D134AA04C0035F004F005F0AC00",
|
||||
]
|
||||
}
|
||||
)
|
||||
coordinator.apply_cloud_courses({slot: f"Program {slot}"}, "87")
|
||||
await _flush(hass)
|
||||
|
||||
assert registry.async_get_issue(DOMAIN, issue_id) is None
|
||||
|
||||
|
||||
async def test_no_repair_for_a_device_without_downloaded_programs(hass: HomeAssistant):
|
||||
entry = _entry(hass)
|
||||
coordinator = LocalThingsCoordinator(hass, entry)
|
||||
resources = _load_device("washer")
|
||||
coordinator._run_discovery(resources)
|
||||
for href, rep in resources.items():
|
||||
coordinator._observe.apply(href, rep, source="poll")
|
||||
coordinator._refresh_cloud_course_issue()
|
||||
await _flush(hass)
|
||||
|
||||
registry = ir.async_get(hass)
|
||||
assert registry.async_get_issue(DOMAIN, f"cloud_courses_{entry.entry_id}") is None
|
||||
|
||||
|
||||
async def test_a_malformed_entry_record_does_not_block_setup(hass: HomeAssistant):
|
||||
entry = _entry(hass, data={CONF_CLOUD_COURSES: {"slots": {"55": {"blob": "junk"}}}})
|
||||
coordinator = await _coordinator(hass, entry)
|
||||
# Dropped on restore, then relearned from the live poll.
|
||||
assert coordinator.cloud_courses.snapshot()["slots"]["55"]["blob"] == SPORTS
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Options flow
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
async def _options_handler(hass: HomeAssistant, coordinator: LocalThingsCoordinator):
|
||||
from custom_components.localthings.config_flow import LocalThingsOptionsFlow
|
||||
|
||||
entry = coordinator.config_entry
|
||||
assert entry is not None
|
||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
||||
handler = LocalThingsOptionsFlow()
|
||||
handler.hass = hass
|
||||
# OptionsFlow.config_entry resolves through `handler`, which the flow
|
||||
# manager normally sets when it starts the flow.
|
||||
handler.handler = entry.entry_id
|
||||
return handler
|
||||
|
||||
|
||||
async def test_the_menu_offers_download_cycles_only_when_the_device_has_them(
|
||||
hass: HomeAssistant,
|
||||
):
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
result = await handler.async_step_init()
|
||||
assert "cloud_courses" in result["menu_options"]
|
||||
|
||||
|
||||
async def test_naming_through_the_flow_persists(hass: HomeAssistant):
|
||||
entry = _entry(hass)
|
||||
coordinator = await _coordinator(hass, entry)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
|
||||
await handler.async_step_cloud_manual()
|
||||
await handler.async_step_cloud_manual(
|
||||
{"name_55": "Sports", "name_6B": "Jeans", "download_course": "87"}
|
||||
)
|
||||
await _flush(hass)
|
||||
|
||||
assert coordinator.cloud_courses.named() == {"55": "Sports", "6B": "Jeans"}
|
||||
assert entry.data[CONF_CLOUD_COURSES]["download_course"] == "87"
|
||||
|
||||
|
||||
async def test_the_flow_rejects_two_programs_sharing_a_name(hass: HomeAssistant):
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
|
||||
result = await handler.async_step_cloud_manual(
|
||||
{"name_55": "Sports", "name_6B": "sports", "download_course": "87"}
|
||||
)
|
||||
assert result["errors"] == {"base": "cloud_course_name_duplicate"}
|
||||
assert coordinator.cloud_courses.named() == {}
|
||||
|
||||
|
||||
async def test_clearing_a_name_removes_the_program_from_the_select(hass: HomeAssistant):
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_manual({"name_55": "Sports", "download_course": "87"})
|
||||
await _flush(hass)
|
||||
assert "cloud:55" in _cycle_options(coordinator)
|
||||
|
||||
await handler.async_step_cloud_manual({"name_55": "", "download_course": "87"})
|
||||
await _flush(hass)
|
||||
assert "cloud:55" not in _cycle_options(coordinator)
|
||||
|
||||
|
||||
async def test_without_a_confirmed_download_course_nothing_is_offered(hass: HomeAssistant):
|
||||
"""Names alone aren't enough -- there'd be no course code to write."""
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_manual({"name_55": "Sports", "download_course": ""})
|
||||
await _flush(hass)
|
||||
|
||||
assert coordinator.cloud_courses.named() == {"55": "Sports"}
|
||||
assert "cloud:55" not in _cycle_options(coordinator)
|
||||
|
||||
|
||||
async def test_the_form_proposes_the_observed_download_course(hass: HomeAssistant):
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
result = await handler.async_step_cloud_manual()
|
||||
|
||||
assert result["step_id"] == "cloud_manual"
|
||||
assert result["description_placeholders"]["total"] == "9"
|
||||
# Two learned so far, seven still to walk through on the appliance.
|
||||
assert result["description_placeholders"]["found"] == "2"
|
||||
_observe_program_load(coordinator, SPORTS)
|
||||
assert coordinator.cloud_courses.download_candidates() == ["87"]
|
||||
|
||||
|
||||
async def test_no_repair_until_a_program_has_actually_been_seen(hass: HomeAssistant):
|
||||
"""The DW5000C advertises four downloaded programs and has never loaded
|
||||
one, so nothing about them is learnable and no name field can be offered.
|
||||
Warning its owner about a feature they may never use -- with no action
|
||||
that could clear it -- is worse than staying quiet until they run one."""
|
||||
entry = _entry(hass)
|
||||
coordinator = LocalThingsCoordinator(hass, entry)
|
||||
resources = _load_device("dishwasher_dw5000c_cloud")
|
||||
coordinator._run_discovery(resources)
|
||||
for href, rep in resources.items():
|
||||
coordinator._observe.apply(href, rep, source="poll")
|
||||
coordinator._refresh_cloud_course_issue()
|
||||
await _flush(hass)
|
||||
|
||||
assert cloudcourse.advertised_slots(coordinator.cloud_course_rep()) == ["8E", "8D", "8F", "02"]
|
||||
assert coordinator.cloud_courses.snapshot()["slots"] == {}
|
||||
registry = ir.async_get(hass)
|
||||
assert registry.async_get_issue(DOMAIN, f"cloud_courses_{entry.entry_id}") is None
|
||||
|
||||
|
||||
async def test_the_synthetic_field_never_reaches_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
enable_custom_integrations,
|
||||
):
|
||||
"""canonical_resources carries it so entity descriptors can read it, and
|
||||
diagnostics reads canonical_resources -- so the drop has to happen at the
|
||||
redaction boundary. A dump is meant to be what the appliance said, and
|
||||
cloud program names are text the user typed."""
|
||||
from custom_components.localthings.diagnostics import (
|
||||
async_get_config_entry_diagnostics,
|
||||
)
|
||||
|
||||
entry = _entry(hass)
|
||||
coordinator = await _coordinator(hass, entry)
|
||||
coordinator.apply_cloud_courses({"55": "Marc's weekend towels"}, "87")
|
||||
await _flush(hass)
|
||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
||||
|
||||
diag = await async_get_config_entry_diagnostics(hass, entry)
|
||||
assert cloudcourse.FIELD not in json.dumps(diag["resources"])
|
||||
# The device's own tokens are still there -- resources stays what it said.
|
||||
assert "CloudExtraCourse_0A5C286B2D0C55301A" in json.dumps(diag["resources"])
|
||||
|
||||
# The store is reported in full in its own block: what was discovered,
|
||||
# what the user named it, and which course they confirmed. Half of what
|
||||
# goes wrong here is a configuration question and none of it is
|
||||
# answerable from the payloads alone.
|
||||
cloud = diag["cloud_courses"]
|
||||
assert cloud["advertised_slots"] == ["0A", "5C", "28", "6B", "2D", "0C", "55", "30", "1A"]
|
||||
assert cloud["download_course"] == "87"
|
||||
assert cloud["slots"]["55"] == {"blob": SPORTS, "name": "Marc's weekend towels"}
|
||||
# A slot seen but never named is reported too -- that gap is the thing a
|
||||
# "why isn't my download cycle showing up" report needs to reveal.
|
||||
assert cloud["slots"]["6B"] == {"blob": JEANS, "name": ""}
|
||||
|
||||
|
||||
async def test_the_debug_read_service_reports_only_device_state(hass: HomeAssistant):
|
||||
coordinator = await _coordinator(hass)
|
||||
coordinator.apply_cloud_courses({"55": "Sports"}, "87")
|
||||
await _flush(hass)
|
||||
|
||||
stripped = coordinator.device_resources(MAIN)
|
||||
assert cloudcourse.FIELD not in stripped[COURSE]
|
||||
assert "x.com.samsung.da.options" in stripped[COURSE]
|
||||
|
||||
|
||||
async def test_the_flow_rejects_a_download_course_the_device_does_not_offer(
|
||||
hass: HomeAssistant,
|
||||
):
|
||||
"""Whatever lands here becomes the Course_ token of a real write."""
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
|
||||
result = await handler.async_step_cloud_manual({"name_55": "Sports", "download_course": "FF"})
|
||||
assert result["errors"] == {"base": "cloud_course_unknown_course"}
|
||||
assert coordinator.cloud_courses.snapshot()["download_course"] is None
|
||||
assert coordinator.cloud_courses.named() == {}
|
||||
|
||||
|
||||
async def test_the_flow_rejects_a_name_shadowing_a_personal_course(hass: HomeAssistant):
|
||||
"""Personal course names come from the device, not the catalog, and the
|
||||
select renders them the same way -- so they collide the same way."""
|
||||
coordinator = await _coordinator(hass)
|
||||
# 'MyCo' as a personal course label on a code the device offers.
|
||||
rep = dict(coordinator.resource("/wm/personalcourse/vs/0") or {})
|
||||
rep["x.com.samsung.da.courses"] = ["1C_01044D79436F"]
|
||||
coordinator._observe.apply("/wm/personalcourse/vs/0", rep, source="poll")
|
||||
await _flush(hass)
|
||||
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
result = await handler.async_step_cloud_manual({"name_55": "MyCo", "download_course": "87"})
|
||||
assert result["errors"] == {"base": "cloud_course_name_duplicate"}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Guided setup
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def _observe_program_load(coordinator, blob, course="87"):
|
||||
"""Stand in for the user loading a program while Home Assistant watches.
|
||||
A candidate Download course comes only from a transition that was
|
||||
actually observed, so tests that expect one have to produce it."""
|
||||
coordinator._observe.apply(
|
||||
COURSE,
|
||||
{
|
||||
"x.com.samsung.da.options": [
|
||||
"CloudExtraCourse_0A5C286B2D0C55301A",
|
||||
f"Course_{course}",
|
||||
f"OneTimeCloudCourse_{blob}",
|
||||
]
|
||||
},
|
||||
source="poll",
|
||||
)
|
||||
|
||||
|
||||
def _stub_probe(coordinator, sequence):
|
||||
"""Drive async_probe_cloud_courses from a scripted list of loaded slots,
|
||||
standing in for the user turning the dial. The last entry repeats."""
|
||||
seq = list(sequence)
|
||||
|
||||
async def probe() -> str | None:
|
||||
return seq.pop(0) if len(seq) > 1 else seq[0]
|
||||
|
||||
# setattr, not assignment: the stub stands in for a bound method.
|
||||
setattr(coordinator, "async_probe_cloud_courses", probe) # noqa: B010
|
||||
|
||||
|
||||
async def _run_wait(handler):
|
||||
"""Re-enter the progress step the way Home Assistant does until its task
|
||||
settles, then follow the completion through."""
|
||||
result = await handler.async_step_cloud_wait()
|
||||
for _ in range(200):
|
||||
if result["type"] != "progress":
|
||||
return result
|
||||
if handler._cloud_task is not None:
|
||||
with contextlib.suppress(TimeoutError):
|
||||
await asyncio.wait_for(asyncio.shield(handler._cloud_task), 5)
|
||||
result = await handler.async_step_cloud_wait()
|
||||
raise AssertionError("progress step never settled")
|
||||
|
||||
|
||||
async def test_guided_waits_for_a_change_not_a_state(hass: HomeAssistant):
|
||||
"""The trap this design exists to avoid. After naming a program the
|
||||
appliance is still sitting on it, so a loop that fires on "a known slot is
|
||||
loaded" would re-offer the same one forever. Each round baselines on what
|
||||
is loaded when it starts and completes only on a change."""
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
|
||||
# The fixture is already loaded with 6B, so that is the baseline.
|
||||
await handler.async_step_cloud_guided()
|
||||
assert handler._cloud_baseline == "6B"
|
||||
|
||||
# The appliance stays on 6B: no round completes.
|
||||
_stub_probe(coordinator, ["6B"])
|
||||
handler._cloud_task = None
|
||||
task = hass.async_create_task(handler._await_cloud_selection(coordinator))
|
||||
await asyncio.sleep(0)
|
||||
assert not task.done()
|
||||
task.cancel()
|
||||
with contextlib.suppress(asyncio.CancelledError):
|
||||
await task
|
||||
|
||||
|
||||
async def test_guided_names_a_newly_selected_program(hass: HomeAssistant):
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
|
||||
_stub_probe(coordinator, ["55"])
|
||||
result = await _run_wait(handler)
|
||||
assert result["step_id"] == "cloud_name"
|
||||
|
||||
form = await handler.async_step_cloud_name()
|
||||
assert form["description_placeholders"]["slot"] == "55"
|
||||
# Persisted immediately -- closing the dialog now would lose nothing.
|
||||
await handler.async_step_cloud_name({"name": "Sports"})
|
||||
await _flush(hass)
|
||||
assert coordinator.cloud_courses.named() == {"55": "Sports"}
|
||||
|
||||
|
||||
async def test_guided_rebaselines_so_the_named_program_cannot_refire(
|
||||
hass: HomeAssistant,
|
||||
):
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
_stub_probe(coordinator, ["55"])
|
||||
await _run_wait(handler)
|
||||
await handler.async_step_cloud_name({"name": "Sports"})
|
||||
await _flush(hass)
|
||||
# The next round starts from the program just named, so the appliance
|
||||
# sitting on it is not a new selection.
|
||||
assert handler._cloud_baseline == "55"
|
||||
|
||||
|
||||
async def test_reselecting_a_named_program_offers_an_edit_not_an_error(
|
||||
hass: HomeAssistant,
|
||||
):
|
||||
"""Re-picking one is how someone checks their work. It gets the existing
|
||||
name pre-filled, and the counter deliberately does not move."""
|
||||
coordinator = await _coordinator(hass)
|
||||
coordinator.apply_cloud_courses({"55": "Sports"}, "87")
|
||||
await _flush(hass)
|
||||
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
_stub_probe(coordinator, ["55"])
|
||||
await _run_wait(handler)
|
||||
|
||||
form = await handler.async_step_cloud_name()
|
||||
assert form["errors"] == {}
|
||||
assert form["data_schema"]({})["name"] == "Sports"
|
||||
before = form["description_placeholders"]["named"]
|
||||
await handler.async_step_cloud_name({"name": "Sports"})
|
||||
await _flush(hass)
|
||||
after = handler._cloud_progress_placeholders(coordinator)["named"]
|
||||
assert before == after == "1"
|
||||
|
||||
|
||||
async def test_guided_times_out_into_a_retry_or_finish_menu(hass: HomeAssistant, monkeypatch):
|
||||
from custom_components.localthings import config_flow as cf
|
||||
|
||||
monkeypatch.setattr(cf, "_CLOUD_WAIT_TIMEOUT_S", 0.0)
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
_stub_probe(coordinator, ["6B"])
|
||||
|
||||
result = await _run_wait(handler)
|
||||
assert result["step_id"] == "cloud_timeout"
|
||||
menu = await handler.async_step_cloud_timeout()
|
||||
assert set(menu["menu_options"]) == {"cloud_guided", "cloud_finish"}
|
||||
|
||||
|
||||
async def test_a_failed_probe_does_not_end_the_round(hass: HomeAssistant):
|
||||
"""A dropped read is one missed poll, not a reason to bail on someone
|
||||
standing at the appliance."""
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
_stub_probe(coordinator, [None, None, "55"])
|
||||
|
||||
result = await _run_wait(handler)
|
||||
assert result["step_id"] == "cloud_name"
|
||||
assert handler._cloud_slot == "55"
|
||||
|
||||
|
||||
async def test_the_entry_step_is_a_menu_offering_both_paths(hass: HomeAssistant):
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
result = await handler.async_step_cloud_courses()
|
||||
assert set(result["menu_options"]) == {"cloud_guided", "cloud_manual"}
|
||||
|
||||
|
||||
async def test_closing_the_dialog_stops_probing_the_appliance(hass: HomeAssistant):
|
||||
"""Closing the dialog is the documented way to leave guided setup, so it
|
||||
has to actually stop -- an abandoned round would otherwise keep taking the
|
||||
session lock every few seconds for a user who has walked away."""
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
|
||||
probes = 0
|
||||
|
||||
async def probe() -> str | None:
|
||||
nonlocal probes
|
||||
probes += 1
|
||||
return "6B" # never changes, so the round would run to timeout
|
||||
|
||||
# setattr, not assignment: the stub stands in for a bound method.
|
||||
setattr(coordinator, "async_probe_cloud_courses", probe) # noqa: B010
|
||||
result = await handler.async_step_cloud_wait()
|
||||
assert result["type"] == "progress"
|
||||
task = handler._cloud_task
|
||||
assert task is not None and not task.done()
|
||||
|
||||
handler.async_remove()
|
||||
with contextlib.suppress(asyncio.CancelledError):
|
||||
await task
|
||||
assert task.cancelled()
|
||||
settled = probes
|
||||
await asyncio.sleep(0.05)
|
||||
assert probes == settled
|
||||
|
||||
|
||||
async def test_guided_lists_the_names_assigned_so_far(hass: HomeAssistant):
|
||||
"""The only orientation available on a long walk -- the programs still to
|
||||
do are unnamed by definition, so 'done so far' is all there is to show.
|
||||
It doubles as duplicate avoidance, since the form rejects a repeat."""
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
|
||||
assert handler._cloud_progress_placeholders(coordinator)["named_list"] == "none yet"
|
||||
|
||||
coordinator.apply_cloud_courses({"55": "Sports", "6B": "Jeans"}, "87")
|
||||
await _flush(hass)
|
||||
placeholders = handler._cloud_progress_placeholders(coordinator)
|
||||
assert placeholders["named"] == "2"
|
||||
assert placeholders["total"] == "9"
|
||||
# The appliance's own advertised order, not naming order: 6B precedes 55
|
||||
# in CloudExtraCourse_0A5C286B2D0C55301A.
|
||||
assert placeholders["named_list"] == "Jeans, Sports"
|
||||
|
||||
|
||||
async def test_the_name_form_shows_the_other_names_while_typing(hass: HomeAssistant):
|
||||
coordinator = await _coordinator(hass)
|
||||
coordinator.apply_cloud_courses({"6B": "Jeans"}, "87")
|
||||
await _flush(hass)
|
||||
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
_stub_probe(coordinator, ["55"])
|
||||
await _run_wait(handler)
|
||||
|
||||
form = await handler.async_step_cloud_name()
|
||||
assert form["description_placeholders"]["named_list"] == "Jeans"
|
||||
|
||||
|
||||
async def test_guided_naming_never_clears_a_confirmed_download_course(hass: HomeAssistant):
|
||||
"""A program needs both a name and the Download course before it can be
|
||||
offered. The guided name form says nothing about the course, and passing
|
||||
that silence through as None wiped a confirmed one -- so naming a program
|
||||
removed every already-named program from the cycle list."""
|
||||
coordinator = await _coordinator(hass)
|
||||
coordinator.apply_cloud_courses({"6B": "Jeans"}, "87")
|
||||
await _flush(hass)
|
||||
assert "cloud:6B" in _cycle_options(coordinator)
|
||||
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
_stub_probe(coordinator, ["55"])
|
||||
await _run_wait(handler)
|
||||
await handler.async_step_cloud_name({"name": "Sports"})
|
||||
await _flush(hass)
|
||||
|
||||
assert coordinator.cloud_courses.snapshot()["download_course"] == "87"
|
||||
assert {"cloud:55", "cloud:6B"} <= set(_cycle_options(coordinator))
|
||||
|
||||
|
||||
async def test_guided_setup_alone_produces_a_selectable_cycle(hass: HomeAssistant):
|
||||
"""The walk has to stand on its own: someone who only ever uses guided
|
||||
setup must end up with something in the cycle list. So the first name
|
||||
form also asks for the Download course, prefilled from what was just
|
||||
observed, and drops the field once it is confirmed."""
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
_stub_probe(coordinator, ["55"])
|
||||
await _run_wait(handler)
|
||||
|
||||
first = await handler.async_step_cloud_name()
|
||||
assert "download_course" in str(first["data_schema"].schema)
|
||||
# Prefilled once a load has actually been watched -- in real use the
|
||||
# guided probe loop feeds observe() and produces exactly this.
|
||||
_observe_program_load(coordinator, SPORTS)
|
||||
assert handler._cloud_course == "87"
|
||||
|
||||
await handler.async_step_cloud_name({"name": "Sports", "download_course": "87"})
|
||||
await _flush(hass)
|
||||
assert "cloud:55" in _cycle_options(coordinator)
|
||||
|
||||
# Confirmed now, so the next program is asked for its name only.
|
||||
handler._cloud_slot = "6B"
|
||||
second = await handler.async_step_cloud_name()
|
||||
assert "download_course" not in str(second["data_schema"].schema)
|
||||
|
||||
|
||||
async def test_guided_rejects_a_download_course_the_device_does_not_offer(hass: HomeAssistant):
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
_stub_probe(coordinator, ["55"])
|
||||
await _run_wait(handler)
|
||||
|
||||
result = await handler.async_step_cloud_name({"name": "Sports", "download_course": "FF"})
|
||||
assert result["errors"] == {"base": "cloud_course_unknown_course"}
|
||||
assert coordinator.cloud_courses.snapshot()["download_course"] is None
|
||||
|
||||
|
||||
async def test_guided_rejects_a_name_another_program_already_has(hass: HomeAssistant):
|
||||
"""Guided setup submits one program at a time, so a within-form check
|
||||
can't see the others. Two programs sharing a label resolve to whichever
|
||||
option comes first, meaning picking the second would run the first one's
|
||||
payload."""
|
||||
coordinator = await _coordinator(hass)
|
||||
coordinator.apply_cloud_courses({"6B": "Sports"}, "87")
|
||||
await _flush(hass)
|
||||
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
_stub_probe(coordinator, ["55"])
|
||||
await _run_wait(handler)
|
||||
|
||||
result = await handler.async_step_cloud_name({"name": "Sports"})
|
||||
await _flush(hass)
|
||||
assert result["errors"] == {"base": "cloud_course_name_duplicate"}
|
||||
assert coordinator.cloud_courses.named() == {"6B": "Sports"}
|
||||
|
||||
|
||||
async def test_renaming_a_program_to_its_own_name_is_allowed(hass: HomeAssistant):
|
||||
"""The slot being edited is excluded from the taken set, or confirming an
|
||||
unchanged name would reject itself."""
|
||||
coordinator = await _coordinator(hass)
|
||||
coordinator.apply_cloud_courses({"55": "Sports"}, "87")
|
||||
await _flush(hass)
|
||||
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
_stub_probe(coordinator, ["55"])
|
||||
await _run_wait(handler)
|
||||
|
||||
result = await handler.async_step_cloud_name({"name": "Sports"})
|
||||
assert result["type"] == "progress" # accepted, straight back to waiting
|
||||
|
||||
|
||||
async def test_the_timeout_screen_fills_in_its_counters(hass: HomeAssistant):
|
||||
"""Its copy interpolates the same placeholders as the other screens, so
|
||||
without them the dialog renders literal braces."""
|
||||
coordinator = await _coordinator(hass)
|
||||
coordinator.apply_cloud_courses({"55": "Sports"}, "87")
|
||||
await _flush(hass)
|
||||
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
result = await handler.async_step_cloud_timeout()
|
||||
assert result["description_placeholders"]["named"] == "1"
|
||||
assert result["description_placeholders"]["named_list"] == "Sports"
|
||||
|
||||
|
||||
async def test_guided_ignores_a_payload_the_store_would_not_record(hass: HomeAssistant):
|
||||
"""The probe reports whatever payload is loaded; observe() declines one
|
||||
whose slot the device doesn't advertise. Offering to name that would take
|
||||
a name and discard it -- there is no record to hang it on."""
|
||||
coordinator = await _coordinator(hass)
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
await handler.async_step_cloud_guided()
|
||||
|
||||
# 'ZZ' is not in this appliance's CloudExtraCourse_ list.
|
||||
_stub_probe(coordinator, ["ZZ"])
|
||||
result = await _run_wait(handler)
|
||||
assert result["step_id"] == "cloud_timeout"
|
||||
|
||||
|
||||
async def test_the_prefilled_course_is_always_one_the_dropdown_offers(hass: HomeAssistant):
|
||||
"""An observed candidate the appliance's course list no longer contains
|
||||
would prefill a value the selector rejects, failing validation on
|
||||
something the user never chose."""
|
||||
coordinator = await _coordinator(hass)
|
||||
coordinator.cloud_courses._candidates["FF"] = 99 # not in the course list
|
||||
handler = await _options_handler(hass, coordinator)
|
||||
|
||||
offered = handler._cloud_course_selector(coordinator).config["options"]
|
||||
assert handler._cloud_course is None or handler._cloud_course in offered
|
||||
@@ -0,0 +1,76 @@
|
||||
"""Regression tests for a handful of call sites in coordinator.py that used
|
||||
to let a smartthings-local exception (EndpointError, SessionError,
|
||||
SessionTimeoutError, SessionClosedError, ... -- or the equivalent bare
|
||||
ConnectionError/TimeoutError/OSError an older library version raised) escape
|
||||
uncaught instead of going through this integration's own reconnect/logging
|
||||
or getting translated into a HomeAssistantError for a service caller.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from homeassistant.core import HomeAssistant
|
||||
from pytest_homeassistant_custom_component.common import MockConfigEntry
|
||||
|
||||
from custom_components.localthings.const import (
|
||||
CONF_HOST,
|
||||
CONF_LEAF_CERT_PEM,
|
||||
CONF_LEAF_KEY_PEM,
|
||||
CONF_PORT,
|
||||
DOMAIN,
|
||||
)
|
||||
from custom_components.localthings.coordinator import LocalThingsCoordinator
|
||||
|
||||
ENTRY_DATA = {
|
||||
CONF_HOST: "10.0.0.198",
|
||||
CONF_PORT: 49154,
|
||||
CONF_LEAF_CERT_PEM: "-----BEGIN CERTIFICATE-----\nTEST-LEAF\n-----END CERTIFICATE-----",
|
||||
CONF_LEAF_KEY_PEM: "-----BEGIN PRIVATE KEY-----\nTEST-LEAF-KEY\n-----END PRIVATE KEY-----",
|
||||
}
|
||||
|
||||
|
||||
def _coordinator(hass: HomeAssistant) -> LocalThingsCoordinator:
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
data=ENTRY_DATA,
|
||||
unique_id="localthings_ERRHANDLING-TEST",
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
return LocalThingsCoordinator(hass, entry)
|
||||
|
||||
|
||||
async def test_subdevice_enumeration_failure_does_not_abort_first_discovery(
|
||||
hass: HomeAssistant, monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
"""_enumerate_subdevices_blocking's own _connect_session() call only
|
||||
fires if the session the poll above just used got closed out from under
|
||||
it within the same cycle -- rare, but until this fix, unguarded: an
|
||||
exception there escaped _async_update_data entirely instead of going
|
||||
through this integration's own logging, matching what already happens
|
||||
for the main poll's own reconnect.
|
||||
|
||||
Not a one-cycle blip once caught, though: `_discovered` flips True this
|
||||
same cycle regardless (gating first discovery, not subdevice success),
|
||||
so this is the *only* attempt a composite appliance's siblings ever get
|
||||
without a config-entry reload -- logged at warning for exactly that
|
||||
reason, not debug.
|
||||
|
||||
Empty resources keep _run_discovery from binding anything (hot/warm
|
||||
hrefs stay empty), so _attempt_observe_mode's own session touch never
|
||||
runs either -- this test is purely about the enumeration failure not
|
||||
escaping _async_update_data.
|
||||
"""
|
||||
coordinator = _coordinator(hass)
|
||||
monkeypatch.setattr(coordinator, "_poll_once", dict)
|
||||
|
||||
def _boom(_resources):
|
||||
raise ConnectionError("session closed")
|
||||
|
||||
monkeypatch.setattr(coordinator, "_enumerate_subdevices_blocking", _boom)
|
||||
|
||||
with caplog.at_level("WARNING"):
|
||||
result = await coordinator._async_update_data()
|
||||
|
||||
assert coordinator._discovered is True
|
||||
assert result == {}
|
||||
assert "subdevice enumeration failed" in caplog.text
|
||||
@@ -201,3 +201,33 @@ async def test_main_climate_write_unaffected_by_subdevice_translation(coordinato
|
||||
|
||||
posted_path, _ = coordinator._session.post_calls[0]
|
||||
assert posted_path == ["power", "vs", "0"]
|
||||
|
||||
|
||||
async def test_indexed_subdevice_climate_write_quantizes_with_its_own_temperature_step(
|
||||
coordinator,
|
||||
) -> None:
|
||||
"""A composite AC's write_fn (airconditioner._climate_write) reads the
|
||||
temperature step off write_fn's own `resources` argument -- if
|
||||
async_send_command handed it the raw cache snapshot (real, on-the-wire
|
||||
hrefs) instead of this subdevice's canonical_resources() view, the
|
||||
subdevice's own /temperature/control/vs/1 would be invisible under the
|
||||
canonical HREF_TEMP_CONTROL key, and the write would quantize against
|
||||
the master's step (or none at all) instead of its own."""
|
||||
sub1 = Subdevice(kind="indexed", key="1", seed_path=("device", "1"))
|
||||
coordinator._observe.apply(
|
||||
"/temperature/control/vs/0",
|
||||
{"x.com.samsung.da.increment": "1"},
|
||||
source="poll",
|
||||
)
|
||||
coordinator._observe.apply(
|
||||
"/temperature/control/vs/1",
|
||||
{"x.com.samsung.da.increment": "0.5"},
|
||||
source="poll",
|
||||
)
|
||||
bound = _climate_bound("/mode/vs/1", sub1)
|
||||
|
||||
await coordinator.async_send_command(bound, ("temperature_ocf", 24.5))
|
||||
|
||||
posted_path, posted_bytes = coordinator._session.post_calls[0]
|
||||
assert posted_path == ["temperature", "desired", "1"]
|
||||
assert cbor2.loads(posted_bytes) == {"temperature": 24.5}
|
||||
@@ -5,8 +5,8 @@ cycle_options, cycle_write) is tested in test_laundry_capabilities.py; here we
|
||||
check the dishwasher wiring and its device-specific options.
|
||||
"""
|
||||
|
||||
from custom_components.localthings.registry.capabilities import dishwasher, laundry
|
||||
from custom_components.localthings.registry.entities import SwitchDesc
|
||||
from custom_components.localthings.registry.capabilities import dishwasher
|
||||
from custom_components.localthings.registry.entities import SensorDesc, SwitchDesc
|
||||
|
||||
|
||||
class TestCycleOptions:
|
||||
@@ -15,7 +15,8 @@ class TestCycleOptions:
|
||||
|
||||
def test_cycle_desc_uses_shared_cycle_options(self):
|
||||
desc = self._cycle()
|
||||
assert desc.options is laundry.cycle_options
|
||||
live = {"/wm/editcourse/vs/0": {"x.com.samsung.da.editCourseList": "EditCourseList_0E82"}}
|
||||
assert desc.options(live) == ["0E", "82"]
|
||||
assert desc.translation_key == "dishwasher_cycle"
|
||||
|
||||
def test_exists_only_when_edit_course_list_is_live(self):
|
||||
@@ -59,3 +60,14 @@ class TestDishwasherOptions:
|
||||
assert desc.exists_fn is not None
|
||||
assert desc.exists_fn({"x.com.samsung.da.options": []}, {}) is False
|
||||
assert desc.exists_fn({"x.com.samsung.da.options": ["AutoDoorRelease_On"]}, {}) is True
|
||||
|
||||
|
||||
def test_diagnosis_status_is_a_translatable_enum():
|
||||
desc = next(
|
||||
e
|
||||
for e in dishwasher.DIAGNOSIS.entities
|
||||
if e.key == "diagnosis_status" and isinstance(e, SensorDesc)
|
||||
)
|
||||
assert desc.device_class == "enum"
|
||||
assert desc.options == ("ready",)
|
||||
assert desc.value_fn("Ready") == "ready"
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from custom_components.localthings.registry.adapter import flatten
|
||||
from custom_components.localthings.registry.by_type import for_device_by_model
|
||||
from custom_components.localthings.registry.capabilities import dryer, ignored, laundry
|
||||
from custom_components.localthings.registry.capabilities import dryer, ignored
|
||||
from custom_components.localthings.registry.discovery import discover
|
||||
from custom_components.localthings.registry.entities import SelectDesc
|
||||
from tests.conftest import _load_device
|
||||
@@ -82,12 +82,27 @@ def test_course_bound_to_shared_course_vs_0():
|
||||
table_03 = {"/st/dryercourse/vs/0": {"x.com.samsung.da.st.courseTable": "Table_03"}}
|
||||
assert desc.translation_key(table_03) == "dryer_cycle_table_03"
|
||||
assert desc.translation_key({}) == "cycle"
|
||||
assert desc.options is laundry.cycle_options
|
||||
live = {"/wm/editcourse/vs/0": {"x.com.samsung.da.editCourseList": "EditCourseList_1620"}}
|
||||
assert desc.options(live) == ["16", "20"]
|
||||
rep = {"x.com.samsung.da.options": ["Course_16", "GMT_02"]}
|
||||
assert desc.rep_fn is not None
|
||||
assert desc.rep_fn(rep) == "16"
|
||||
|
||||
|
||||
def test_reported_table_00_course_codes_are_translated():
|
||||
"""The reporter confirmed these codes on a DVE45R6300W/A3 by selecting
|
||||
each cycle and reading back the raw course code (issue #357)."""
|
||||
from custom_components.localthings.catalog import translated_states
|
||||
|
||||
desc = next(
|
||||
e for e in dryer.DRYER_COURSE.entities if e.key == "cycle" and isinstance(e, SelectDesc)
|
||||
)
|
||||
table_00 = {"/st/dryercourse/vs/0": {"x.com.samsung.da.st.courseTable": "Table_00"}}
|
||||
assert desc.translation_key(table_00) == "dryer_cycle_table_00"
|
||||
confirmed = {"01", "9c", "a5", "9e", "9b", "27", "a0", "a4", "a6", "a3", "a2"}
|
||||
assert confirmed <= translated_states("select", "dryer_cycle_table_00")
|
||||
|
||||
|
||||
def test_st_dryercourse_is_ignored():
|
||||
"""/st/dryercourse/vs/0 re-encodes the course exposed via /course/vs/0 and
|
||||
is globally ignored -- the mirror of /st/washercourse/vs/0."""
|
||||
|
||||
@@ -29,6 +29,15 @@ class _FakeCoordinator:
|
||||
# subdevices (issue #177).
|
||||
return self.last_resources
|
||||
|
||||
# _is_included judges existence against the discovery view, which is the
|
||||
# live cache for everything but an offline load (issue #295).
|
||||
@property
|
||||
def discovery_resources(self):
|
||||
return self.last_resources
|
||||
|
||||
def discovery_canonical(self, subdevice):
|
||||
return self.canonical_resources(subdevice)
|
||||
|
||||
|
||||
def _coord(last_resources) -> LocalThingsCoordinator:
|
||||
return cast(LocalThingsCoordinator, _FakeCoordinator(last_resources))
|
||||
|
||||
@@ -1132,12 +1132,16 @@ def test_registry_reproduces_golden_state_keys_for_airconditioner_fac_bora():
|
||||
)
|
||||
|
||||
|
||||
def _new_subdevice_aware_state_keys(name):
|
||||
def _new_subdevice_aware_state_keys(name, device_types=()):
|
||||
"""Like _new_state_keys, but runs the full subdevice-aware pipeline
|
||||
(enumerate_subdevices + discover_partitioned, issue #177) instead of a
|
||||
single discover() call, so the golden for a composite-device fixture
|
||||
captures every materialized subdevice's keys
|
||||
(subdevice1_-/subdevice_<uuid>_-prefixed), not just the master's."""
|
||||
(subdevice1_-/subdevice_<uuid>_-prefixed), not just the master's.
|
||||
|
||||
`device_types` threads through to discover_partitioned's own
|
||||
`oic_device_types` -- needed for a board with no /information/vs/0 at
|
||||
all to route from (issue #324's range)."""
|
||||
from custom_components.localthings.registry.adapter import flatten
|
||||
from tests.conftest import _discover_full, _load_device_full
|
||||
|
||||
@@ -1146,6 +1150,7 @@ def _new_subdevice_aware_state_keys(name):
|
||||
resources,
|
||||
oic_res,
|
||||
seeds,
|
||||
device_types,
|
||||
)
|
||||
state = flatten(bound, full_resources)
|
||||
return sorted(state.keys())
|
||||
@@ -1407,6 +1412,78 @@ def test_registry_reproduces_golden_state_keys_for_refrigerator_tp1x_ref_21k_def
|
||||
)
|
||||
|
||||
|
||||
def test_registry_reproduces_golden_state_keys_for_refrigerator_tp1x_ref_21k_autodoor():
|
||||
"""TP1X_REF_21K, single-freezer-door Auto Door Open variant (issue
|
||||
#328): /autodoor/single/vs/0 + /autodoor/timer/vs/0, plus
|
||||
STATUS_LOCK's ado.voicecontrol sibling toggle."""
|
||||
from tests.conftest import _load_device
|
||||
|
||||
resources = _load_device("refrigerator_tp1x_ref_21k_autodoor")
|
||||
golden = json.loads((GOLDEN / "refrigerator_tp1x_ref_21k_autodoor.json").read_text())
|
||||
state_keys = _new_state_keys("refrigerator_tp1x_ref_21k_autodoor", resources)
|
||||
assert set(state_keys) == set(golden["state_keys"]), (
|
||||
f"state_keys mismatch:\n"
|
||||
f" extra: {sorted(set(state_keys) - set(golden['state_keys']))}\n"
|
||||
f" missing: {sorted(set(golden['state_keys']) - set(state_keys))}"
|
||||
)
|
||||
|
||||
|
||||
def test_registry_reproduces_golden_state_keys_for_refrigerator_tp1x_ref_21k_kimchi():
|
||||
"""Kimchi-refrigerator Auto Door Open variant (issue #328) -- resolves
|
||||
via /oic/d's oic.d.krefrigerator, not modelNum (the board is the same
|
||||
TP1X_REF_21K as the regular fridge, so only the OCF type tells them
|
||||
apart before checking hrefs)."""
|
||||
from tests.conftest import _load_device
|
||||
|
||||
resources = _load_device("refrigerator_tp1x_ref_21k_kimchi")
|
||||
golden = json.loads((GOLDEN / "refrigerator_tp1x_ref_21k_kimchi.json").read_text())
|
||||
state_keys = _new_state_keys(
|
||||
"refrigerator_tp1x_ref_21k_kimchi",
|
||||
resources,
|
||||
device_types=("oic.wk.d", "oic.d.krefrigerator"),
|
||||
)
|
||||
assert set(state_keys) == set(golden["state_keys"]), (
|
||||
f"state_keys mismatch:\n"
|
||||
f" extra: {sorted(set(state_keys) - set(golden['state_keys']))}\n"
|
||||
f" missing: {sorted(set(golden['state_keys']) - set(state_keys))}"
|
||||
)
|
||||
|
||||
|
||||
def test_registry_reproduces_golden_state_keys_for_refrigerator_winecellar():
|
||||
"""Wine-cellar refrigerator variant (issue #328) -- resolves via /oic/d's
|
||||
x.com.st.d.winecellar, same TP1X_REF_21K board as the other two. Adds
|
||||
the deodorizing filter at its own href, the multi-compartment pantry
|
||||
select, and the table-revision info resource."""
|
||||
from tests.conftest import _load_device
|
||||
|
||||
resources = _load_device("refrigerator_winecellar")
|
||||
golden = json.loads((GOLDEN / "refrigerator_winecellar.json").read_text())
|
||||
state_keys = _new_state_keys(
|
||||
"refrigerator_winecellar",
|
||||
resources,
|
||||
device_types=("oic.wk.d", "x.com.st.d.winecellar"),
|
||||
)
|
||||
assert set(state_keys) == set(golden["state_keys"]), (
|
||||
f"state_keys mismatch:\n"
|
||||
f" extra: {sorted(set(state_keys) - set(golden['state_keys']))}\n"
|
||||
f" missing: {sorted(set(golden['state_keys']) - set(state_keys))}"
|
||||
)
|
||||
|
||||
|
||||
def test_registry_reproduces_golden_state_keys_for_range_tp1x_da_ks_range_0101x():
|
||||
"""Dual-cavity range (issue #324): no /information/vs/0 at all, so
|
||||
routing depends entirely on /oic/d's oic.d.range -- and the second
|
||||
cavity is a genuine Pattern A indexed subdevice at /device/1."""
|
||||
name = "range_tp1x_da_ks_range_0101x"
|
||||
golden = json.loads((GOLDEN / f"{name}.json").read_text())
|
||||
state_keys = _new_subdevice_aware_state_keys(name, device_types=("oic.wk.d", "oic.d.range"))
|
||||
assert set(state_keys) == set(golden["state_keys"]), (
|
||||
f"state_keys mismatch:\n"
|
||||
f" extra: {sorted(set(state_keys) - set(golden['state_keys']))}\n"
|
||||
f" missing: {sorted(set(golden['state_keys']) - set(state_keys))}"
|
||||
)
|
||||
|
||||
|
||||
def test_resources_from_batch_preferred_over_flat():
|
||||
from tests.conftest import _resources_from_dump
|
||||
|
||||
@@ -1419,3 +1496,46 @@ def test_resources_from_batch_preferred_over_flat():
|
||||
}
|
||||
result = _resources_from_dump(dump)
|
||||
assert result == {"/foo": {"x": 1}}
|
||||
|
||||
|
||||
def test_registry_reproduces_golden_state_keys_for_washer_ww5000c_cloud():
|
||||
"""The issue #342 reporter's WW5000C (DA_WM_TP1_21_COMMON, Table_02),
|
||||
captured while sitting on its Download course with a one-time Jeans
|
||||
program loaded over a saved Sports default.
|
||||
|
||||
The cloud "Download" programs it advertises add no entity of their own
|
||||
-- they ride in the existing cycle select -- so this golden is the guard
|
||||
that discovering them never grows the entity set.
|
||||
|
||||
Its /wm/editcourse/vs/0 is empty, so its course list comes from the
|
||||
supportedOptions fallback (issue #1)."""
|
||||
from tests.conftest import _load_device
|
||||
|
||||
resources = _load_device("washer_ww5000c_cloud")
|
||||
golden = json.loads((GOLDEN / "washer_ww5000c_cloud.json").read_text())
|
||||
state_keys = _new_state_keys("washer_ww5000c_cloud", resources)
|
||||
assert set(state_keys) == set(golden["state_keys"]), (
|
||||
f"state_keys mismatch:\n"
|
||||
f" extra: {sorted(set(state_keys) - set(golden['state_keys']))}\n"
|
||||
f" missing: {sorted(set(golden['state_keys']) - set(state_keys))}"
|
||||
)
|
||||
|
||||
|
||||
def test_registry_reproduces_golden_state_keys_for_dishwasher_dw5000c_cloud():
|
||||
"""A DW5000C dishwasher (issues #113/#123) that advertises four
|
||||
downloaded programs it has never loaded -- CloudExtraCourse_ with no
|
||||
CloudCourse_/OneTimeCloudCourse_ payload alongside it (issue #342).
|
||||
|
||||
Proves the cloud-cycle machinery is not washer-only and, more usefully,
|
||||
that a device can advertise programs whose payloads have never been
|
||||
seen. It adds no entity of its own either way."""
|
||||
from tests.conftest import _load_device
|
||||
|
||||
resources = _load_device("dishwasher_dw5000c_cloud")
|
||||
golden = json.loads((GOLDEN / "dishwasher_dw5000c_cloud.json").read_text())
|
||||
state_keys = _new_state_keys("dishwasher_dw5000c_cloud", resources)
|
||||
assert set(state_keys) == set(golden["state_keys"]), (
|
||||
f"state_keys mismatch:\n"
|
||||
f" extra: {sorted(set(state_keys) - set(golden['state_keys']))}\n"
|
||||
f" missing: {sorted(set(golden['state_keys']) - set(state_keys))}"
|
||||
)
|
||||
@@ -54,11 +54,99 @@ class TestCourseHelpers:
|
||||
assert laundry.cycle_options({}) == []
|
||||
assert laundry.cycle_options({"/wm/editcourse/vs/0": {}}) == []
|
||||
|
||||
def test_decodes_reported_washer_course_table_including_personal_slots(self):
|
||||
"""Real DA_WM_TP1_21_COMMON diagnostics, with every selectable
|
||||
standard and personal-course code preserved in the device's order.
|
||||
F1/F3 are part of the packed list; their labels come from the
|
||||
companion personal-course resource tested below.
|
||||
"""
|
||||
resources = {
|
||||
"/wm/editcourse/vs/0": {
|
||||
"x.com.samsung.da.editCourseList": (
|
||||
"EditCourseList_696F73757801719688706D6A76726C6E6B777479F1F3"
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
assert laundry.cycle_options(resources) == [
|
||||
"69",
|
||||
"6F",
|
||||
"73",
|
||||
"75",
|
||||
"78",
|
||||
"01",
|
||||
"71",
|
||||
"96",
|
||||
"88",
|
||||
"70",
|
||||
"6D",
|
||||
"6A",
|
||||
"76",
|
||||
"72",
|
||||
"6C",
|
||||
"6E",
|
||||
"6B",
|
||||
"77",
|
||||
"74",
|
||||
"79",
|
||||
"F1",
|
||||
"F3",
|
||||
]
|
||||
|
||||
def test_option_value(self):
|
||||
opts = ["DeviceType_0167", "Course_1C", "GMT_04"]
|
||||
assert laundry.option_value(opts, "Course") == "1C"
|
||||
assert laundry.option_value(opts, "Missing") is None
|
||||
|
||||
def test_decodes_device_provided_personal_course_names(self):
|
||||
"""Real /wm/personalcourse/vs/0 entries from the reported washer.
|
||||
|
||||
The first TLV field contains a byte-counted UTF-8 name. It is the only
|
||||
course-name metadata in the diagnostics and is safe to display without
|
||||
assigning an inferred meaning to any standard course code.
|
||||
"""
|
||||
resources = {
|
||||
"/wm/personalcourse/vs/0": {
|
||||
"x.com.samsung.da.courses": [
|
||||
"F1_0106EC868DEC98B7021EED8CACED8BB020EB93B1",
|
||||
"F2_00",
|
||||
"F3_0109EC9A94EAB8B0EBB3B40220ECA084EC9AA9",
|
||||
],
|
||||
},
|
||||
}
|
||||
first_name = bytes.fromhex("EC868DEC98B7").decode("utf-8")
|
||||
second_name = bytes.fromhex("EC9A94EAB8B0EBB3B4").decode("utf-8")
|
||||
assert laundry.personal_course_labels(resources) == {
|
||||
"F1": first_name,
|
||||
"F3": second_name,
|
||||
}
|
||||
|
||||
def test_personal_course_names_reject_malformed_payloads(self):
|
||||
resources = {
|
||||
"/wm/personalcourse/vs/0": {
|
||||
"x.com.samsung.da.courses": [
|
||||
"F1_not-hex",
|
||||
"F2_0106AA",
|
||||
"F3_020141",
|
||||
None,
|
||||
],
|
||||
},
|
||||
}
|
||||
assert laundry.personal_course_labels(resources) == {}
|
||||
|
||||
def test_washer_cycle_fallback_only_labels_personal_courses(self):
|
||||
"""No invented English label for an unrecognized code (PR #251 review)."""
|
||||
resources = {
|
||||
"/wm/personalcourse/vs/0": {
|
||||
"x.com.samsung.da.courses": ["F1_0106EC868DEC98B7"],
|
||||
},
|
||||
}
|
||||
expected = bytes.fromhex("EC868DEC98B7").decode("utf-8")
|
||||
assert laundry.washer_cycle_fallback("F1", resources) == expected
|
||||
assert laundry.washer_cycle_fallback("69", resources) is None
|
||||
assert laundry.washer_cycle_fallback("6f", resources) is None
|
||||
assert laundry.washer_cycle_fallback("Normal", resources) is None
|
||||
|
||||
|
||||
class TestCourseCodesFromSupportedOptions:
|
||||
"""cycle_options()'s fallback for boards that populate
|
||||
@@ -177,6 +265,37 @@ class TestCourseCodesFromSupportedOptions:
|
||||
"8F",
|
||||
]
|
||||
|
||||
def test_decodes_reported_dishwasher_course_table_without_editcourse(self):
|
||||
"""Real DA_DW_A51_20_COMMON diagnostics: the board has no
|
||||
/wm/editcourse/vs/0, so every selectable code must come from its
|
||||
packed supportedOptions table, including the newer 82/8A/A7/A8/8C
|
||||
family that previously appeared as raw UI text.
|
||||
"""
|
||||
resources = {
|
||||
"/course/vs/0": {
|
||||
"x.com.samsung.da.options": ["Course_82"],
|
||||
"x.com.samsung.da.supportedOptions": [
|
||||
"482E0026002F00270028AE0026002F0027002A7E0026002F00270028"
|
||||
"0E0006000F0027000A8E0026002F002700288E0006000F00070008C"
|
||||
"E0026002F00270028DE0026002F00270028EE0006000F00270028FE"
|
||||
"0006002F0027002"
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
assert laundry.cycle_options(resources) == [
|
||||
"82",
|
||||
"8A",
|
||||
"A7",
|
||||
"80",
|
||||
"A8",
|
||||
"88",
|
||||
"8C",
|
||||
"8D",
|
||||
"8E",
|
||||
"8F",
|
||||
]
|
||||
|
||||
|
||||
class TestCycleSelect:
|
||||
def test_builds_labelled_cycle_select(self):
|
||||
@@ -184,7 +303,10 @@ class TestCycleSelect:
|
||||
assert desc.key == "cycle"
|
||||
assert desc.translation_key == "dryer_cycle"
|
||||
assert desc.icon == "mdi:tumble-dryer"
|
||||
assert desc.options is laundry.cycle_options
|
||||
# Behavior, not identity: the option list is the device's own live
|
||||
# course list (plus any named cloud programs -- see cycle_select).
|
||||
live = {"/wm/editcourse/vs/0": {"x.com.samsung.da.editCourseList": "EditCourseList_161C"}}
|
||||
assert desc.options(live) == ["16", "1C"]
|
||||
|
||||
def test_reads_raw_course_code_from_options(self):
|
||||
desc = laundry.cycle_select(translation_key="dryer_cycle", icon="x")
|
||||
@@ -247,7 +369,7 @@ class TestCycleSelectTableGating:
|
||||
def test_untranslated_table_uses_generic_cycle_key(self):
|
||||
"""An unknown table does not claim another board's state labels."""
|
||||
desc = self._desc()
|
||||
resources = {"/st/washercourse/vs/0": {"x.com.samsung.da.st.courseTable": "Table_00"}}
|
||||
resources = {"/st/washercourse/vs/0": {"x.com.samsung.da.st.courseTable": "Table_99"}}
|
||||
assert desc.translation_key(resources) == "cycle"
|
||||
|
||||
def test_resolves_to_generic_cycle_when_table_id_is_unknown(self):
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
"""Unit tests for operational state capabilities."""
|
||||
|
||||
from custom_components.localthings.registry.capabilities.operational import OPERATIONAL_STATE
|
||||
from custom_components.localthings.registry.entities import NumberDesc
|
||||
from custom_components.localthings.registry.capabilities.operational import (
|
||||
OPERATIONAL_STATE,
|
||||
_just_finished,
|
||||
_new_cycle_running,
|
||||
)
|
||||
from custom_components.localthings.registry.entities import NumberDesc, SensorDesc
|
||||
|
||||
|
||||
def test_machine_state_maps_samsung_to_ocf():
|
||||
@@ -11,6 +15,89 @@ def test_machine_state_maps_samsung_to_ocf():
|
||||
assert ms.value_fn("Ready") == "idle"
|
||||
|
||||
|
||||
class TestJustFinished:
|
||||
"""`_just_finished` is progress/progress_percentage's sticky_fn arm
|
||||
condition (issue #345) -- see sensor.py's _apply_sticky."""
|
||||
|
||||
def test_true_when_progress_is_finish_while_active(self):
|
||||
assert _just_finished(
|
||||
{"x.com.samsung.da.state": "Run", "x.com.samsung.da.progress": "Finish"}
|
||||
)
|
||||
|
||||
def test_true_even_once_state_has_already_left_active(self):
|
||||
"""The exact issue #345 scenario this exists for: a washer's
|
||||
`state` can already read idle by the time `progress` is observed
|
||||
at 'Finish' -- unlike _is_active, this must still arm."""
|
||||
assert _just_finished(
|
||||
{"x.com.samsung.da.state": "Ready", "x.com.samsung.da.progress": "Finish"}
|
||||
)
|
||||
|
||||
def test_false_while_active_but_not_yet_finished(self):
|
||||
assert not _just_finished(
|
||||
{"x.com.samsung.da.state": "Run", "x.com.samsung.da.progress": "Spin"}
|
||||
)
|
||||
|
||||
def test_false_when_progress_absent(self):
|
||||
assert not _just_finished({"x.com.samsung.da.state": "Run"})
|
||||
|
||||
|
||||
class TestNewCycleRunning:
|
||||
"""`_new_cycle_running` is progress/progress_percentage's
|
||||
sticky_bypass_fn -- the early-release condition for the #345 hold.
|
||||
See sensor.py's _apply_sticky."""
|
||||
|
||||
def test_true_for_a_concrete_non_finish_code_while_active(self):
|
||||
assert _new_cycle_running(
|
||||
{"x.com.samsung.da.state": "Run", "x.com.samsung.da.progress": "Wash"}
|
||||
)
|
||||
|
||||
def test_false_for_a_running_stage_reported_after_state_left_active(self):
|
||||
"""Issue #358, the whole reason for the `state` gate: the reporting
|
||||
dryer replays a running stage ('Drying', its first supportedProgress
|
||||
entry) for a few seconds after Finish while winding down. That is
|
||||
the finished cycle's tail, not a new cycle -- releasing the hold on
|
||||
it is what produced 'Drying, Cooling, Finish, Drying, Idle'."""
|
||||
assert not _new_cycle_running(
|
||||
{"x.com.samsung.da.state": "Ready", "x.com.samsung.da.progress": "Drying"}
|
||||
)
|
||||
|
||||
def test_false_while_paused(self):
|
||||
"""Paused is not evidence a new cycle is running, and the tail
|
||||
above can't be told apart from it. rep_fn shows 'Idle' whenever
|
||||
state isn't active anyway, so there is no live value being
|
||||
withheld here -- only a hold that expires on its own instead of
|
||||
being released early."""
|
||||
assert not _new_cycle_running(
|
||||
{"x.com.samsung.da.state": "Pause", "x.com.samsung.da.progress": "Wash"}
|
||||
)
|
||||
|
||||
def test_false_for_finish(self):
|
||||
assert not _new_cycle_running(
|
||||
{"x.com.samsung.da.state": "Run", "x.com.samsung.da.progress": "Finish"}
|
||||
)
|
||||
|
||||
def test_false_when_absent_or_none(self):
|
||||
assert not _new_cycle_running({})
|
||||
assert not _new_cycle_running(
|
||||
{"x.com.samsung.da.state": "Run", "x.com.samsung.da.progress": "None"}
|
||||
)
|
||||
|
||||
|
||||
def test_progress_is_a_translatable_enum():
|
||||
desc = next(
|
||||
e for e in OPERATIONAL_STATE.entities if e.key == "progress" and isinstance(e, SensorDesc)
|
||||
)
|
||||
assert desc.device_class == "enum"
|
||||
assert desc.options is not None
|
||||
assert "rinse" in desc.options
|
||||
assert "Rinse" not in desc.options
|
||||
assert desc.rep_fn is not None
|
||||
assert (
|
||||
desc.rep_fn({"x.com.samsung.da.state": "Run", "x.com.samsung.da.progress": "Rinse"})
|
||||
== "rinse"
|
||||
)
|
||||
|
||||
|
||||
class TestProgressPercentage:
|
||||
"""issue #9: device firmware leaves progressPercentage stale (e.g. '1')
|
||||
after a cycle ends instead of resetting it, so it must be gated on
|
||||
@@ -139,7 +226,7 @@ class TestDelayFieldFallback:
|
||||
assert result is not None
|
||||
path, body = result
|
||||
assert path == ["operational", "state", "vs", "0"]
|
||||
assert body == {"x.com.samsung.da.delayEndTime": "1:30:00"}
|
||||
assert body == {"x.com.samsung.da.delayEndTime": "01:30:00"}
|
||||
|
||||
def test_write_targets_delay_start_time_by_default(self):
|
||||
from custom_components.localthings.registry.capabilities.operational import (
|
||||
@@ -156,4 +243,4 @@ class TestDelayFieldFallback:
|
||||
result = desc.write_fn(1.5, rep)
|
||||
assert result is not None
|
||||
_path, body = result
|
||||
assert body == {"x.com.samsung.da.delayStartTime": "1:30:00"}
|
||||
assert body == {"x.com.samsung.da.delayStartTime": "01:30:00"}
|
||||
@@ -0,0 +1,92 @@
|
||||
"""Dual-cavity range (TP1X_DA-KS-RANGE-0101X, NE63T8751SG/AA-class, issue
|
||||
#324): no /information/vs/0 at all, so the modelNum-based fallback has
|
||||
nothing to read -- routing depends entirely on /oic/d's own device type
|
||||
(`oic.d.range`), read separately from the /device/0 batch (see
|
||||
registry/identity.py and by_type/__init__.py's `_OIC_TYPE_TO_KEY`).
|
||||
|
||||
The second oven cavity answers as an indexed sibling at /device/1 (Pattern
|
||||
A, same mechanism as the AC family's issue #177 fixtures) -- the master's
|
||||
/mode/vs/0 (defaultMode 'UpperConvectionBake') is the upper cavity, the
|
||||
subdevice's canonical /mode/vs/0 (defaultMode 'LowerConvectionBake') is the
|
||||
lower one.
|
||||
"""
|
||||
|
||||
from custom_components.localthings.registry.adapter import flatten
|
||||
from custom_components.localthings.registry.by_type import for_device_by_oic_type, resolve
|
||||
from tests.conftest import _discover_full, _load_device_full
|
||||
|
||||
FIXTURE = "range_tp1x_da_ks_range_0101x"
|
||||
DEVICE_TYPES = ("oic.wk.d", "oic.d.range")
|
||||
|
||||
|
||||
def _discover():
|
||||
resources, oic_res, seeds = _load_device_full(FIXTURE)
|
||||
return _discover_full(resources, oic_res, seeds, DEVICE_TYPES)
|
||||
|
||||
|
||||
def test_resolves_via_oic_type():
|
||||
reg = for_device_by_oic_type(DEVICE_TYPES)
|
||||
assert reg is not None and reg.name == "range"
|
||||
|
||||
|
||||
def test_resolves_via_the_full_resolve_entrypoint():
|
||||
resources, _oic_res, _seeds = _load_device_full(FIXTURE)
|
||||
reg = resolve(resources, device_types=DEVICE_TYPES)
|
||||
assert reg is not None and reg.name == "range"
|
||||
|
||||
|
||||
def test_no_unbound_hrefs():
|
||||
"""Every resource in the issue #324 dump binds or is ignored, on both
|
||||
the master (upper cavity) and the materialized second cavity -- clears
|
||||
the coverage-gap repair."""
|
||||
resources, oic_res, seeds = _load_device_full(FIXTURE)
|
||||
unbound = []
|
||||
from custom_components.localthings.registry.registry import CAPABILITIES
|
||||
from custom_components.localthings.registry.subdevices import (
|
||||
discover_partitioned,
|
||||
enumerate_subdevices,
|
||||
)
|
||||
from tests.conftest import FakeCoapSession
|
||||
|
||||
sess = FakeCoapSession(seeds)
|
||||
candidates, extra = enumerate_subdevices(sess, resources, oic_res)
|
||||
full_resources = {**resources, **extra}
|
||||
discover_partitioned(
|
||||
full_resources,
|
||||
candidates,
|
||||
resolve,
|
||||
CAPABILITIES,
|
||||
log=unbound.append,
|
||||
oic_device_types=DEVICE_TYPES,
|
||||
)
|
||||
assert unbound == []
|
||||
|
||||
|
||||
def test_second_cavity_materializes_as_an_indexed_subdevice():
|
||||
_bound, materialized, skipped, _full_resources, device_type_name = _discover()
|
||||
assert device_type_name == "range"
|
||||
assert skipped == []
|
||||
assert [(s.kind, s.key) for s in materialized] == [("indexed", "1")]
|
||||
assert materialized[0].seed_path == ("device", "1")
|
||||
|
||||
|
||||
def test_both_cavities_expose_distinct_oven_state():
|
||||
bound, _materialized, _skipped, full_resources, _name = _discover()
|
||||
state = flatten(bound, full_resources)
|
||||
for key in ("oven_mode", "oven_setpoint", "oven_state", "machine_state", "door_open"):
|
||||
assert key in state, key
|
||||
# Second cavity's entities carry the subdevice1_ prefix (adapter._key) --
|
||||
# the master's own keys stay unprefixed, so both cavities get distinct
|
||||
# unique_ids rather than colliding on the same entity key.
|
||||
assert "subdevice1_oven_mode" in state
|
||||
assert "subdevice1_oven_setpoint" in state
|
||||
|
||||
|
||||
def test_cooktop_monitoring_present_on_the_master_only():
|
||||
"""The cooktop half belongs to the appliance as a whole, not either oven
|
||||
cavity -- /cooktopmonitoring/vs/0 has no per-cavity index."""
|
||||
bound, _materialized, _skipped, full_resources, _name = _discover()
|
||||
state = flatten(bound, full_resources)
|
||||
assert "cooktop_running_state" in state
|
||||
assert "warming_center_state" in state
|
||||
assert "subdevice1_cooktop_running_state" not in state
|
||||
@@ -0,0 +1,80 @@
|
||||
"""Auto Door Open (issue #328, TP1X_REF_21K single-freezer-door variant).
|
||||
|
||||
`/status/lock/vs/0`'s ado.devicecontrol switch was already modeled
|
||||
(STATUS_LOCK.auto_door_opener); this dump adds the paired voice-feedback
|
||||
toggle, the door-hold timer, and the per-variant capability declaration
|
||||
href -- see fridge.py's AUTO_DOOR_TIMER/AUTO_DOOR_VARIANT comments.
|
||||
"""
|
||||
|
||||
from custom_components.localthings.registry.adapter import flatten
|
||||
from custom_components.localthings.registry.by_type import for_device_by_model
|
||||
from custom_components.localthings.registry.capabilities import fridge
|
||||
from custom_components.localthings.registry.discovery import discover
|
||||
from custom_components.localthings.registry.entities import SelectDesc
|
||||
from tests.conftest import _load_device
|
||||
|
||||
FIXTURE = "refrigerator_tp1x_ref_21k_autodoor"
|
||||
|
||||
|
||||
def _fridge():
|
||||
resources = _load_device(FIXTURE)
|
||||
info = resources["/information/vs/0"]
|
||||
reg = for_device_by_model(
|
||||
info["x.com.samsung.da.modelNum"], info["x.com.samsung.da.description"]
|
||||
)
|
||||
return reg, resources
|
||||
|
||||
|
||||
def _state():
|
||||
reg, resources = _fridge()
|
||||
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
|
||||
return flatten(bound, resources)
|
||||
|
||||
|
||||
def test_resolves_to_refrigerator_registry():
|
||||
reg, _ = _fridge()
|
||||
assert reg is not None and reg.name == "refrigerator"
|
||||
|
||||
|
||||
def test_no_unbound_hrefs():
|
||||
reg, resources = _fridge()
|
||||
unbound = []
|
||||
discover(resources, reg.capabilities, reg.pattern_capabilities, log=unbound.append)
|
||||
assert unbound == []
|
||||
|
||||
|
||||
def test_auto_door_voice_control_reads_status_lock():
|
||||
state = _state()
|
||||
assert state["auto_door_opener"] is False
|
||||
assert state["auto_door_voice_control"] is False
|
||||
# This variant's dump has no ado.soundcontrol field -- gated absent.
|
||||
assert "auto_door_sound_control" not in state
|
||||
|
||||
|
||||
def test_auto_door_timer_reads_its_own_options():
|
||||
desc = next(
|
||||
e
|
||||
for e in fridge.AUTO_DOOR_TIMER.entities
|
||||
if e.key == "auto_door_timer" and isinstance(e, SelectDesc)
|
||||
)
|
||||
rep = {
|
||||
"x.com.samsung.da.time.desired": "1",
|
||||
"x.com.samsung.da.time.supportedOptions": ["1", "2", "3", "4", "5", "6"],
|
||||
}
|
||||
assert desc.value_fn(rep["x.com.samsung.da.time.desired"]) == "1"
|
||||
assert desc.options_field == "x.com.samsung.da.time.supportedOptions"
|
||||
assert desc.write_fn is not None
|
||||
assert desc.write_fn("3", rep) == (
|
||||
["autodoor", "timer", "vs", "0"],
|
||||
{"x.com.samsung.da.time.desired": "3"},
|
||||
)
|
||||
|
||||
|
||||
def test_auto_door_single_variant_href_bound_with_no_entities():
|
||||
"""/autodoor/single/vs/0 only ever declares openOptions=['Single'] --
|
||||
no paired current/desired field to expose, so it's coverage-only via
|
||||
the shared AUTO_DOOR_VARIANT pattern cap, not an entry of its own."""
|
||||
assert fridge.AUTO_DOOR_VARIANT.entities == ()
|
||||
assert fridge.AUTO_DOOR_VARIANT.match_fn is not None
|
||||
_reg, resources = _fridge()
|
||||
assert fridge.AUTO_DOOR_VARIANT.match_fn(resources["/autodoor/single/vs/0"], resources)
|
||||
@@ -0,0 +1,57 @@
|
||||
"""Kimchi-refrigerator Auto Door Open variant (issue #328,
|
||||
oic.d.krefrigerator device type -- TP1X_REF_21K board, single kimchi
|
||||
compartment). Same STATUS_LOCK/AUTO_DOOR_TIMER shape as the regular
|
||||
TP1X_REF_21K, at the kimchi-specific /autodoor/kimchi/vs/0 declaration
|
||||
href.
|
||||
"""
|
||||
|
||||
from custom_components.localthings.registry.adapter import flatten
|
||||
from custom_components.localthings.registry.by_type import for_device_by_oic_type, resolve
|
||||
from custom_components.localthings.registry.capabilities import fridge
|
||||
from custom_components.localthings.registry.discovery import discover
|
||||
from tests.conftest import _load_device
|
||||
|
||||
FIXTURE = "refrigerator_tp1x_ref_21k_kimchi"
|
||||
DEVICE_TYPES = ("oic.wk.d", "oic.d.krefrigerator")
|
||||
|
||||
|
||||
def _fridge():
|
||||
resources = _load_device(FIXTURE)
|
||||
reg = resolve(resources, device_types=DEVICE_TYPES)
|
||||
return reg, resources
|
||||
|
||||
|
||||
def _state():
|
||||
reg, resources = _fridge()
|
||||
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
|
||||
return flatten(bound, resources)
|
||||
|
||||
|
||||
def test_resolves_via_oic_type():
|
||||
reg = for_device_by_oic_type(DEVICE_TYPES)
|
||||
assert reg is not None and reg.name == "refrigerator"
|
||||
|
||||
|
||||
def test_resolves_to_refrigerator_registry():
|
||||
reg, _ = _fridge()
|
||||
assert reg is not None and reg.name == "refrigerator"
|
||||
|
||||
|
||||
def test_no_unbound_hrefs():
|
||||
reg, resources = _fridge()
|
||||
unbound = []
|
||||
discover(resources, reg.capabilities, reg.pattern_capabilities, log=unbound.append)
|
||||
assert unbound == []
|
||||
|
||||
|
||||
def test_auto_door_opener_present():
|
||||
state = _state()
|
||||
assert "auto_door_opener" in state
|
||||
assert "auto_door_timer" in state
|
||||
|
||||
|
||||
def test_auto_door_kimchi_variant_href_bound_with_no_entities():
|
||||
assert fridge.AUTO_DOOR_VARIANT.entities == ()
|
||||
assert fridge.AUTO_DOOR_VARIANT.match_fn is not None
|
||||
_reg, resources = _fridge()
|
||||
assert fridge.AUTO_DOOR_VARIANT.match_fn(resources["/autodoor/kimchi/vs/0"], resources)
|
||||
@@ -0,0 +1,90 @@
|
||||
"""Wine-cellar refrigerator variant (issue #328, x.com.st.d.winecellar
|
||||
device type -- RW33C99B1TFG-class, TP1X_REF_21K board). Auto Door Open's
|
||||
winecellar-specific declaration href, a deodorizing filter reported at a
|
||||
different href than the regular AIR_FILTER, a multi-compartment pantry
|
||||
select, and a table-revision info resource -- all new coverage this dump
|
||||
surfaced.
|
||||
"""
|
||||
|
||||
from custom_components.localthings.registry.adapter import flatten
|
||||
from custom_components.localthings.registry.by_type import for_device_by_oic_type, resolve
|
||||
from custom_components.localthings.registry.capabilities import fridge
|
||||
from custom_components.localthings.registry.discovery import discover
|
||||
from custom_components.localthings.registry.entities import SelectDesc
|
||||
from tests.conftest import _load_device
|
||||
|
||||
FIXTURE = "refrigerator_winecellar"
|
||||
DEVICE_TYPES = ("oic.wk.d", "x.com.st.d.winecellar")
|
||||
|
||||
|
||||
def _fridge():
|
||||
resources = _load_device(FIXTURE)
|
||||
reg = resolve(resources, device_types=DEVICE_TYPES)
|
||||
return reg, resources
|
||||
|
||||
|
||||
def _state():
|
||||
reg, resources = _fridge()
|
||||
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
|
||||
return flatten(bound, resources)
|
||||
|
||||
|
||||
def test_resolves_via_oic_type():
|
||||
reg = for_device_by_oic_type(DEVICE_TYPES)
|
||||
assert reg is not None and reg.name == "refrigerator"
|
||||
|
||||
|
||||
def test_no_unbound_hrefs():
|
||||
reg, resources = _fridge()
|
||||
unbound = []
|
||||
discover(resources, reg.capabilities, reg.pattern_capabilities, log=unbound.append)
|
||||
assert unbound == []
|
||||
|
||||
|
||||
def test_auto_door_sound_control_present_here_only():
|
||||
"""This variant's dump is the only one that carries
|
||||
ado.soundcontrol -- the other TP1X_REF_21K auto-door fixtures don't."""
|
||||
state = _state()
|
||||
assert state["auto_door_sound_control"] is True
|
||||
assert state["auto_door_voice_control"] is False
|
||||
|
||||
|
||||
def test_deodor_filter_has_its_own_keys_not_air_filters():
|
||||
"""Same shape/reasoning as fridge.AIR_FILTER (percentage-not-raw-count,
|
||||
see its own comment) but its own 'deodor_'-prefixed keys, not a shared
|
||||
tuple -- AIR_FILTER's own docstring picked 'air_' specifically to avoid
|
||||
colliding with WATER_FILTER's filter_usage/filter_status, and reusing
|
||||
AIR_FILTER.entities verbatim here would silently recreate that same
|
||||
collision if a unit ever reports both hrefs."""
|
||||
assert fridge.DEODOR_FILTER.entities != fridge.AIR_FILTER.entities
|
||||
state = _state()
|
||||
assert state["deodor_filter_status"] == "normal"
|
||||
# The device's own sentinel, relayed as-is -- not a real 0-100 reading
|
||||
# on this unit, and no second dump to say what else -1 could mean.
|
||||
assert state["deodor_filter_usage"] == -1
|
||||
assert "air_filter_usage" not in state
|
||||
assert "air_filter_status" not in state
|
||||
|
||||
|
||||
def test_winecellar_pantry_zone_mode_options_and_write():
|
||||
desc = next(
|
||||
e
|
||||
for e in fridge.WINECELLAR_PANTRY_ZONE.entities
|
||||
if e.key == "winecellar_pantry_zone_mode" and isinstance(e, SelectDesc)
|
||||
)
|
||||
assert desc.options_field == "x.com.samsung.da.supportedOptions"
|
||||
assert desc.write_fn is not None
|
||||
assert desc.write_fn("Cheese", {}) == (
|
||||
["status", "winecellar", "pantry", "one", "vs", "0"],
|
||||
{"x.com.samsung.da.mode": "Cheese"},
|
||||
)
|
||||
state = _state()
|
||||
assert state["winecellar_pantry_zone_mode"] == "Fruit"
|
||||
|
||||
|
||||
def test_winecellar_variant_and_info_hrefs_bound_with_no_entities():
|
||||
assert fridge.AUTO_DOOR_VARIANT.entities == ()
|
||||
assert fridge.WINECELLAR_INFO.entities == ()
|
||||
assert fridge.AUTO_DOOR_VARIANT.match_fn is not None
|
||||
_reg, resources = _fridge()
|
||||
assert fridge.AUTO_DOOR_VARIANT.match_fn(resources["/autodoor/winecellar/vs/0"], resources)
|
||||
@@ -46,3 +46,23 @@ def test_known_camel_case_state_uses_snake_case_translation_key():
|
||||
|
||||
def test_display_passes_through_non_string_values():
|
||||
assert _display(None, _UNTRANSLATED) is None
|
||||
|
||||
|
||||
def test_display_uses_fallback_when_translation_has_no_state_table():
|
||||
assert _display("69", "cycle", lambda value: f"Unknown (0x{value})") == ("Unknown (0x69)")
|
||||
|
||||
|
||||
def test_uncatalogued_value_stays_raw_when_the_fallback_declines_it():
|
||||
"""The "no state table" escape hatch keys off whether anything actually
|
||||
named the value, not off whether a fallback was supplied.
|
||||
|
||||
laundry.cycle_select always supplies one now (it labels cloud "Download"
|
||||
programs) and returns None for everything else. Keyed on the fallback's
|
||||
presence instead, every dryer/dishwasher/air-dresser on an unrecognized
|
||||
course table would have its options and state cosmetically reshaped --
|
||||
course '0E' rendered '0 E' -- silently breaking automations and recorder
|
||||
history."""
|
||||
assert _display("0E", "cycle", None) == "0E"
|
||||
assert _display("0E", "cycle", lambda value: None) == "0E"
|
||||
# A fallback that does name the value still wins.
|
||||
assert _display("0E", "cycle", lambda value: f"Course {value}") == "Course 0E"
|
||||
@@ -6,6 +6,11 @@ and callable forms of SelectDesc.options.
|
||||
from typing import ClassVar, cast
|
||||
|
||||
from custom_components.localthings.coordinator import LocalThingsCoordinator
|
||||
from custom_components.localthings.registry.capabilities.laundry import (
|
||||
BUZZER_SOUND,
|
||||
cycle_select,
|
||||
washer_cycle_fallback,
|
||||
)
|
||||
from custom_components.localthings.registry.capability import Capability
|
||||
from custom_components.localthings.registry.discovery import BoundEntity
|
||||
from custom_components.localthings.registry.entities import SelectDesc
|
||||
@@ -43,6 +48,25 @@ def test_options_field_unaffected():
|
||||
assert entity.options == ["Lo", "Hi"]
|
||||
|
||||
|
||||
def test_buzzer_volume_options_normalize_to_translation_keys():
|
||||
desc = next(e for e in BUZZER_SOUND.entities if e.key == "buzzer_sound")
|
||||
entity = _make_select(
|
||||
desc,
|
||||
"/buzzersound/vs/0",
|
||||
{
|
||||
"/buzzersound/vs/0": {
|
||||
"supportedBuzzerSound": [
|
||||
"Volume_Off",
|
||||
"Volume_Low",
|
||||
"Volume_Med",
|
||||
"Volume_High",
|
||||
]
|
||||
}
|
||||
},
|
||||
)
|
||||
assert entity.options == ["volume_off", "volume_low", "volume_med", "volume_high"]
|
||||
|
||||
|
||||
def test_callable_options_receives_full_resource_snapshot():
|
||||
"""A callable options is handed the coordinator's full href->rep
|
||||
snapshot, not just this entity's own href's rep -- needed for course
|
||||
@@ -113,3 +137,79 @@ async def test_unknown_vendor_option_round_trips_to_exact_raw_value():
|
||||
assert entity.options[-1] == "Future Vendor Mode"
|
||||
await entity.async_select_option("Future Vendor Mode")
|
||||
assert coordinator.writes == ["FutureVendorMode"]
|
||||
|
||||
|
||||
async def test_washer_diagnostic_cycle_values_share_one_display_and_write_path():
|
||||
"""Regression for Course_69/EditCourseList_696F... from real hardware."""
|
||||
|
||||
class _WritableCoordinator(_FakeCoordinator):
|
||||
data: ClassVar[dict] = {"cycle": "69"}
|
||||
|
||||
def __init__(self, last_resources):
|
||||
super().__init__(last_resources)
|
||||
self.writes = []
|
||||
|
||||
async def async_send_command(self, bound, value):
|
||||
self.writes.append(value)
|
||||
|
||||
desc = cycle_select(
|
||||
translation_key="washer_cycle",
|
||||
icon="mdi:washing-machine",
|
||||
table_href="/st/washercourse/vs/0",
|
||||
display_fn=washer_cycle_fallback,
|
||||
)
|
||||
capability = Capability(href="/course/vs/0", entities=(desc,))
|
||||
bound = BoundEntity(href="/course/vs/0", capability=capability, desc=desc)
|
||||
resources = {
|
||||
"/course/vs/0": {"x.com.samsung.da.options": ["Course_69"]},
|
||||
"/st/washercourse/vs/0": {
|
||||
"x.com.samsung.da.st.courseTable": "Table_02",
|
||||
},
|
||||
"/wm/editcourse/vs/0": {
|
||||
"x.com.samsung.da.editCourseList": (
|
||||
"EditCourseList_696F757801719688706D6A7376726C6E6B777479F1F3"
|
||||
),
|
||||
},
|
||||
"/wm/personalcourse/vs/0": {
|
||||
"x.com.samsung.da.courses": [
|
||||
"F1_0106EC868DEC98B7",
|
||||
"F3_0109EC9A94EAB8B0EBB3B4",
|
||||
],
|
||||
},
|
||||
}
|
||||
coordinator = _WritableCoordinator(resources)
|
||||
entity = LocalThingsSelect(cast(LocalThingsCoordinator, coordinator), bound)
|
||||
first_name = bytes.fromhex("EC868DEC98B7").decode("utf-8")
|
||||
second_name = bytes.fromhex("EC9A94EAB8B0EBB3B4").decode("utf-8")
|
||||
|
||||
# Known catalog states stay as HA translation keys; the frontend renders
|
||||
# this confirmed Table_02 mapping as "AI Wash".
|
||||
assert entity.current_option == "69"
|
||||
assert entity.options == [
|
||||
"69",
|
||||
"6f",
|
||||
"75",
|
||||
"78",
|
||||
"01",
|
||||
"71",
|
||||
"96",
|
||||
"88",
|
||||
"70",
|
||||
"6d",
|
||||
"6a",
|
||||
"73",
|
||||
"76",
|
||||
"72",
|
||||
"6c",
|
||||
"6e",
|
||||
"6b",
|
||||
"77",
|
||||
"74",
|
||||
"79",
|
||||
first_name,
|
||||
second_name,
|
||||
]
|
||||
|
||||
await entity.async_select_option("6f")
|
||||
await entity.async_select_option(first_name)
|
||||
assert coordinator.writes == ["6F", "F1"]
|
||||
@@ -0,0 +1,94 @@
|
||||
"""Guards against a SensorDesc unit Home Assistant won't accept for the
|
||||
device_class it's paired with.
|
||||
|
||||
Unlike the SwitchDesc case (issue #349), a bad sensor unit doesn't raise --
|
||||
sensor.py hands `unit` to `_attr_native_unit_of_measurement` and HA only
|
||||
logs a warning per entity, once, telling the user to report a bug against
|
||||
this integration. So the failure mode is a quiet stream of "not a valid
|
||||
unit for the device class" warnings plus a support burden, with nothing in
|
||||
the UI to hint anything is wrong.
|
||||
|
||||
The specific trap this exists for: HA spells its micrograms-per-cubic-metre
|
||||
unit with U+03BC GREEK SMALL LETTER MU, and DEVICE_CLASS_UNITS holds only
|
||||
that spelling. U+00B5 MICRO SIGN renders identically in an editor, in a
|
||||
terminal, and in a code review diff, but is a different string and fails
|
||||
the membership test. PR #365 shipped all three particulate units with
|
||||
U+00B5.
|
||||
|
||||
Mirrors test_switch_device_class.py: scans every by_type registry rather
|
||||
than a fixture, so a new capability making the same mistake fails here.
|
||||
"""
|
||||
|
||||
import importlib
|
||||
import pkgutil
|
||||
|
||||
from homeassistant.components.sensor.const import DEVICE_CLASS_UNITS, SensorDeviceClass
|
||||
|
||||
from custom_components.localthings.registry import by_type
|
||||
from custom_components.localthings.registry.entities import SensorDesc
|
||||
|
||||
|
||||
def _all_registries():
|
||||
for mod_info in pkgutil.iter_modules(by_type.__path__):
|
||||
if mod_info.name.startswith("_"):
|
||||
continue
|
||||
mod = importlib.import_module(
|
||||
f"custom_components.localthings.registry.by_type.{mod_info.name}"
|
||||
)
|
||||
reg = getattr(mod, "REGISTRY", None)
|
||||
if reg is not None:
|
||||
yield reg
|
||||
|
||||
|
||||
def _sensor_descs():
|
||||
seen = set()
|
||||
for reg in _all_registries():
|
||||
caps = [c for cs in reg.capabilities.values() for c in cs] + list(reg.pattern_capabilities)
|
||||
for cap in caps:
|
||||
for entity in cap.entities:
|
||||
if isinstance(entity, SensorDesc) and (reg.name, entity.key) not in seen:
|
||||
seen.add((reg.name, entity.key))
|
||||
yield reg.name, entity
|
||||
|
||||
|
||||
def test_every_sensordesc_device_class_is_valid_for_ha():
|
||||
bad = []
|
||||
for reg_name, desc in _sensor_descs():
|
||||
if desc.device_class is None:
|
||||
continue
|
||||
try:
|
||||
SensorDeviceClass(desc.device_class)
|
||||
except ValueError:
|
||||
bad.append((reg_name, desc.key, desc.device_class))
|
||||
assert bad == []
|
||||
|
||||
|
||||
def test_every_declared_unit_is_valid_for_its_device_class():
|
||||
"""Descriptors carrying a `unit_fn` are exempt: those resolve their unit
|
||||
from the live rep (a device reporting Celsius vs Fahrenheit), so there
|
||||
is no static value to check here."""
|
||||
bad = []
|
||||
for reg_name, desc in _sensor_descs():
|
||||
if desc.device_class is None or desc.unit_fn is not None:
|
||||
continue
|
||||
units = DEVICE_CLASS_UNITS.get(SensorDeviceClass(desc.device_class))
|
||||
if units is not None and desc.unit not in units:
|
||||
bad.append(
|
||||
(reg_name, desc.key, desc.device_class, desc.unit, sorted(str(u) for u in units))
|
||||
)
|
||||
assert bad == []
|
||||
|
||||
|
||||
def test_particulate_units_use_has_own_mu_codepoint():
|
||||
"""The membership test above already fails on U+00B5, but only while a
|
||||
PM device_class is attached. Asserting the codepoint directly keeps the
|
||||
reason legible when someone re-types the literal."""
|
||||
from custom_components.localthings.registry.capabilities import air_purifier
|
||||
|
||||
micro_sign, greek_mu = chr(0x00B5), chr(0x03BC)
|
||||
for _key, _icon, _type, _state_class, device_class, unit in air_purifier._AIR_QUALITY_SENSORS:
|
||||
if device_class is None:
|
||||
continue
|
||||
assert unit is not None, device_class
|
||||
assert unit == f"{greek_mu}g/m³", (device_class, [hex(ord(c)) for c in unit])
|
||||
assert micro_sign not in unit, device_class
|
||||
Loaded 100 of 110 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user