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
@@ -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
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user