feat: add AI energy level select and self-check error sensor for fridges
Adds two small, additive fridge capabilities: - AI_ENERGY_LEVEL: a select on /energy/ailevel/vs/0 exposing the AI energy-saving level, gated behind supportedAiLevel actually offering more than one choice (previously globally ignored since every dump seen only reported a single supported level). - selfcheck_error: a diagnostic sensor on the existing SELF_CHECK capability surfacing x.com.samsung.da.error from the last self-check, for hardware that reports it. This does not touch FLEX_ZONE, /mode/vs/0, or /icemaker/status/0.
This commit is contained in:
1 parent
2cd93619a4
commit
2a0a9f32ee
9 files changed
+146
-8
No files matched your search
@@ -20,6 +20,7 @@ REGISTRY = DeviceRegistry(
|
||||
dishwasher.DIAGNOSIS,
|
||||
fridge.ICEMAKER_NIGHTTIME,
|
||||
fridge.FLEX_ZONE,
|
||||
fridge.AI_ENERGY_LEVEL,
|
||||
fridge.REFRIGERATION,
|
||||
fridge.AUTOFILL,
|
||||
fridge.WELCOME_LIGHTING,
|
||||
|
||||
@@ -242,6 +242,14 @@ SELF_CHECK = Capability(
|
||||
SensorDesc(key='selfcheck_result', field='x.com.samsung.da.result',
|
||||
name='Self-check result', icon='mdi:clipboard-check-outline',
|
||||
entity_category='diagnostic'),
|
||||
# List of error codes from the last self-check; joined for display.
|
||||
# Not every fridge reports the field, hence the exists_fn.
|
||||
SensorDesc(key='selfcheck_error', field='x.com.samsung.da.error',
|
||||
name='Self-check error', icon='mdi:alert-circle-outline',
|
||||
entity_category='diagnostic',
|
||||
exists_fn=lambda rep, resources: (
|
||||
not rep or 'x.com.samsung.da.error' in rep),
|
||||
value_fn=lambda v: ', '.join(v) if isinstance(v, list) else v),
|
||||
ButtonDesc(key='selfcheck_start', field='', name='Start self-check',
|
||||
payload='Start', icon='mdi:play-circle-outline',
|
||||
entity_category='diagnostic',
|
||||
@@ -580,6 +588,31 @@ FLEX_ZONE = Capability(
|
||||
),
|
||||
)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# AI energy-saving level
|
||||
#
|
||||
# supportedAiLevel is a single-entry list ('1' only) on some hardware, where
|
||||
# a select would offer no real choice — gated to >1 supported level.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
AI_ENERGY_LEVEL = Capability(
|
||||
href='/energy/ailevel/vs/0',
|
||||
poll_tier='cold',
|
||||
entities=(
|
||||
SelectDesc(key='ai_energy_level', field='aiLevel',
|
||||
name='AI energy level', icon='mdi:leaf',
|
||||
translation_key='ai_energy_level',
|
||||
entity_category='config',
|
||||
options_field='supportedAiLevel',
|
||||
exists_fn=lambda rep, resources: (
|
||||
not rep or (
|
||||
isinstance((sl := rep.get('supportedAiLevel')), (list, tuple))
|
||||
and len(sl) > 1)),
|
||||
write_fn=lambda p, rep, href=None: (
|
||||
['energy', 'ailevel', 'vs', '0'], {'aiLevel': p})),
|
||||
),
|
||||
)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Firmware update
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -85,14 +85,9 @@ IGNORED: list[Capability] = [
|
||||
# Warranty/service-plan enrollment status — every field reads "Unknown"
|
||||
# on hardware not enrolled in a Samsung Care+ style program.
|
||||
Capability(href='/dginformation/vs/0'),
|
||||
# AI energy-saving level; only one value ('1') is ever in
|
||||
# supportedAiLevel on hardware seen so far, so there's no real choice
|
||||
# to expose. Revisit if a device surfaces more than one supported level.
|
||||
Capability(href='/energy/ailevel/vs/0'),
|
||||
# OCF-native vacation-mode flag (fridge). Only one value ('RVACATION_OFF')
|
||||
# has ever been seen in `modes` (issue #7's dump), same "no real choice
|
||||
# to expose yet" situation as /energy/ailevel/vs/0 above. Revisit if a
|
||||
# device surfaces it toggled on.
|
||||
# has ever been seen in `modes` (issue #7's dump) -- no real choice to
|
||||
# expose yet. Revisit if a device surfaces it toggled on.
|
||||
Capability(href='/mode/0'),
|
||||
# Opaque integer with no supportedModes/options list to interpret it
|
||||
# against — meaning unclear from the raw resource alone.
|
||||
|
||||
@@ -143,6 +143,12 @@
|
||||
"180": "3 hr",
|
||||
"240": "4 hr"
|
||||
}
|
||||
},
|
||||
"ai_energy_level": {
|
||||
"state": {
|
||||
"1": "Level 1",
|
||||
"2": "Level 2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
|
||||
@@ -143,6 +143,12 @@
|
||||
"180": "3 hr",
|
||||
"240": "4 hr"
|
||||
}
|
||||
},
|
||||
"ai_energy_level": {
|
||||
"state": {
|
||||
"1": "Level 1",
|
||||
"2": "Level 2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
|
||||
Reference in new issue
Block a user