Add kimchi-refrigerator compartment coverage (issue #26)
TP2X_REF_20K-class 3-compartment kimchi refrigerators report each compartment's storage mode and ripening status/timer on /status/kimchi/<slot>/vs/0, plus a top-compartment door sensor on /kimchidoors/top/vs/0 -- all previously unbound. Bind them as pattern capabilities (fridge.KIMCHI_ZONE, fridge.KIMCHI_DOOR_GENERIC), deriving the per-compartment entity key and display name from the href's top/middle/bottom segment, the same way DOOR_GENERIC/TEMP_CURRENT_GENERIC already do. Storage-mode option labels were translated directly from the reporter's own SmartThings app screenshots rather than guessed from the raw device codes or their English paraphrase, confirming the on-screen option order matches supportMode's array order (including the freezer triplet's -19/-21/-17°C -> Standard/Strong/Weak mapping). Also tighten FLEX_ZONE's exists_fn: this device's /mode/vs/0 also populates modes/supportedOptions, but with a token shape that never overlaps (a "_[n]:[n]" suffix supportedOptions carries that modes never repeats), so the existing "supportedOptions is nonempty" check let the entity bind anyway and get stuck permanently on "unknown". Requiring an actual resolvable value keeps it working for the RF9000/Bespoke-class fridges it was built for while leaving it absent here.
This commit is contained in:
8 files changed
+579
-2
No files matched your search
@@ -36,5 +36,7 @@ REGISTRY = DeviceRegistry(
|
||||
fridge.TEMP_SETPOINT,
|
||||
fridge.ICEMAKER_GENERIC,
|
||||
fridge.DOOR_GENERIC,
|
||||
fridge.KIMCHI_ZONE,
|
||||
fridge.KIMCHI_DOOR_GENERIC,
|
||||
],
|
||||
)
|
||||
@@ -590,8 +590,17 @@ FLEX_ZONE = Capability(
|
||||
translation_key='flex_zone_mode',
|
||||
entity_category='config',
|
||||
options_field='x.com.samsung.da.supportedOptions',
|
||||
exists_fn=lambda rep, resources: bool(
|
||||
rep.get('x.com.samsung.da.supportedOptions')),
|
||||
# A nonempty supportedOptions alone isn't sufficient: the
|
||||
# kimchi-refrigerator family (issue #26) also populates
|
||||
# /mode/vs/0's modes/supportedOptions with real data, but
|
||||
# its tokens carry a "_[n]:[n]" parameter suffix on
|
||||
# supportedOptions that modes never repeats, so no item
|
||||
# ever overlaps -- the RF9000/Bespoke-class overlap this
|
||||
# capability was built for never happens there. Require an
|
||||
# actual resolvable value instead of just a populated
|
||||
# list, so this stays absent on that family rather than
|
||||
# showing a select permanently stuck on "unknown".
|
||||
exists_fn=lambda rep, resources: _flex_zone_current(rep) is not None,
|
||||
rep_fn=_flex_zone_current,
|
||||
write_fn=_flex_zone_write),
|
||||
),
|
||||
@@ -625,6 +634,99 @@ DOOR_GENERIC = Capability(
|
||||
),
|
||||
)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Kimchi refrigerator compartments (TP2X_REF_20K-class 3-compartment kimchi
|
||||
# units, issue #26) -- top/middle/bottom each report their own storage mode
|
||||
# plus a ripening status/timer on /status/kimchi/<slot>/vs/0, all three in
|
||||
# an identical shape; modeled as a pattern capability the same way
|
||||
# DOOR_GENERIC/TEMP_CURRENT_GENERIC above are, deriving the per-compartment
|
||||
# key and {instance_name} from the href's top/middle/bottom segment. Only
|
||||
# the top compartment's door has been seen reported separately (kimchidoors);
|
||||
# middle/bottom apparently have no contact switch of their own, so that's
|
||||
# its own narrower pattern cap rather than assumed universal.
|
||||
#
|
||||
# The same state is also mirrored -- packed into single tokens like
|
||||
# "KIMCHIT_KIMCHI_STORAGE_NORMAL" (T/M/B prefix per compartment) with
|
||||
# bracketed parameters -- on /mode/vs/0, the same resource FLEX_ZONE reads
|
||||
# for RF9000-class fridges. /status/kimchi/<slot>/vs/0's plain currentMode/
|
||||
# supportMode fields are unpacked and self-describing, so that's what this
|
||||
# binds to instead.
|
||||
#
|
||||
# Write path is unconfirmed (no live write against a real unit) -- same
|
||||
# "write the same field back to the entity's own href" convention as
|
||||
# PANTRY_ZONE/BEVERAGE_ZONE above, first real-world write is also the test.
|
||||
#
|
||||
# translations/en.json's kimchi_zone_mode state labels were translated
|
||||
# directly from the reporter's own (Korean-language) SmartThings app
|
||||
# screenshots, not guessed from the codes or from their English paraphrase.
|
||||
# Cross-checking the screenshots against supportMode confirms the on-screen
|
||||
# option order matches the array order everywhere it's verifiable: the top
|
||||
# compartment's freezer triplet (표준/강냉/약냉 = Standard/Strong/Weak, at
|
||||
# -19/-21/-17°C) lines up 1:1 with STORAGE_FREEZER_NORMAL/COLD/WARM, and the
|
||||
# middle/bottom compartments' full 8-entry kimchi-storage list, 2-entry
|
||||
# ripening list, and 4-entry custom-storage list each line up 1:1 with their
|
||||
# supportMode order too -- so COLD/WARM consistently means Strong/Weak (a
|
||||
# colder or warmer preset around the NORMAL setpoint) everywhere that suffix
|
||||
# appears, including on STORAGE_FRIDGE_* and the low-salt kimchi variants,
|
||||
# which weren't directly screenshotted but share the same NORMAL/COLD/WARM
|
||||
# vocabulary as the two confirmed triplets. CRUNFCH (아삭, "crisp/crunchy")
|
||||
# and BUY (구입, "purchased") are also confirmed exact matches, not
|
||||
# abbreviation guesses.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def _kimchi_mode_write(p, rep, href=None):
|
||||
if not href:
|
||||
return None
|
||||
return [s for s in href.strip('/').split('/') if s], {
|
||||
'x.com.samsung.da.currentMode': p,
|
||||
}
|
||||
|
||||
|
||||
KIMCHI_ZONE = Capability(
|
||||
href=None,
|
||||
href_prefix='/status/kimchi/',
|
||||
strip_prefix_in_key=True,
|
||||
poll_tier='warm',
|
||||
entities=(
|
||||
SelectDesc(key='mode', field='x.com.samsung.da.currentMode',
|
||||
use_instance_name=True, icon='mdi:fridge-outline',
|
||||
translation_key='kimchi_zone_mode',
|
||||
entity_category='config',
|
||||
options_field='x.com.samsung.da.supportMode',
|
||||
write_fn=_kimchi_mode_write),
|
||||
SensorDesc(key='ripening_status', field='x.com.samsung.da.ripeStatus',
|
||||
use_instance_name=True, icon='mdi:progress-clock',
|
||||
translation_key='kimchi_ripening_status',
|
||||
entity_category='diagnostic',
|
||||
value_fn=lambda v: v.lower() if isinstance(v, str) else v),
|
||||
SensorDesc(key='ripening_remaining', field='x.com.samsung.da.ripeRemaintime',
|
||||
use_instance_name=True, icon='mdi:timer-sand',
|
||||
translation_key='kimchi_ripening_remaining',
|
||||
entity_category='diagnostic',
|
||||
# No dump has this nonzero (ripeStatus is always "Off" so
|
||||
# far) -- device-reported unit unconfirmed, so this stays
|
||||
# a bare number rather than asserting minutes or hours.
|
||||
value_fn=_int),
|
||||
SensorDesc(key='rack_count', field='x.com.samsung.da.rackCount',
|
||||
use_instance_name=True, icon='mdi:tray-full',
|
||||
translation_key='kimchi_rack_count',
|
||||
entity_category='diagnostic', enabled_default=False,
|
||||
value_fn=_int),
|
||||
),
|
||||
)
|
||||
|
||||
KIMCHI_DOOR_GENERIC = Capability(
|
||||
href=None,
|
||||
href_prefix='/kimchidoors/',
|
||||
strip_prefix_in_key=True,
|
||||
poll_tier='hot',
|
||||
entities=(
|
||||
BinarySensorDesc(key='open', rep_fn=_door_open_state,
|
||||
translation_key='instance_open',
|
||||
use_instance_name=True, device_class='door'),
|
||||
),
|
||||
)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Aggregate-resource fallbacks
|
||||
#
|
||||
|
||||
@@ -381,6 +381,37 @@
|
||||
"operating_mode": {
|
||||
"name": "Operating mode"
|
||||
},
|
||||
"kimchi_zone_mode": {
|
||||
"name": "{instance_name} storage mode",
|
||||
"state": {
|
||||
"off": "Off",
|
||||
"kimchi_storage_normal": "Kimchi",
|
||||
"kimchi_storage_cold": "Kimchi, strong",
|
||||
"kimchi_storage_warm": "Kimchi, weak",
|
||||
"kimchi_storage_low_salt_normal": "Low-salt kimchi",
|
||||
"kimchi_storage_low_salt_cold": "Low-salt kimchi, strong",
|
||||
"kimchi_storage_low_salt_warm": "Low-salt kimchi, weak",
|
||||
"kimchi_storage_crunfch": "Crisp kimchi",
|
||||
"kimchi_storage_buy": "Purchased kimchi",
|
||||
"storage_fridge_normal": "Fridge",
|
||||
"storage_fridge_cold": "Fridge, strong",
|
||||
"storage_fridge_warm": "Fridge, weak",
|
||||
"storage_freezer_normal": "Freezer",
|
||||
"storage_freezer_cold": "Freezer, strong",
|
||||
"storage_freezer_warm": "Freezer, weak",
|
||||
"kimchi_ripe_low_temp": "Kimchi ripening, low temperature",
|
||||
"kimchi_ripe_normal_temp": "Kimchi ripening, room temperature",
|
||||
"kimchi_ripe_kkakdugi": "Kkakdugi ripening",
|
||||
"kimchi_ripe_dongchimi": "Dongchimi ripening",
|
||||
"meat_ripe_normal": "Meat ripening",
|
||||
"storage_meat": "Meat & fish",
|
||||
"storage_fridge_vegetables_fruit": "Fruit & vegetables",
|
||||
"storage_fresh_cereal": "Grains",
|
||||
"storage_fridge_drink": "Beverages",
|
||||
"storage_fresh_wine": "Wine",
|
||||
"storage_fresh_potato_banana": "Potato & banana"
|
||||
}
|
||||
},
|
||||
"pantry_zone_mode": {
|
||||
"name": "Pantry zone mode",
|
||||
"state": {
|
||||
@@ -678,6 +709,15 @@
|
||||
"fridge_temperature": {
|
||||
"name": "Fridge temperature"
|
||||
},
|
||||
"kimchi_ripening_status": {
|
||||
"name": "{instance_name} ripening status"
|
||||
},
|
||||
"kimchi_ripening_remaining": {
|
||||
"name": "{instance_name} ripening time remaining"
|
||||
},
|
||||
"kimchi_rack_count": {
|
||||
"name": "{instance_name} rack count"
|
||||
},
|
||||
"hood_filter_capacity": {
|
||||
"name": "Filter capacity"
|
||||
},
|
||||
|
||||
@@ -381,6 +381,37 @@
|
||||
"operating_mode": {
|
||||
"name": "Bedrijfsmodus"
|
||||
},
|
||||
"kimchi_zone_mode": {
|
||||
"name": "{instance_name} opslagmodus",
|
||||
"state": {
|
||||
"off": "Uit",
|
||||
"kimchi_storage_normal": "Kimchi",
|
||||
"kimchi_storage_cold": "Kimchi, sterk",
|
||||
"kimchi_storage_warm": "Kimchi, zwak",
|
||||
"kimchi_storage_low_salt_normal": "Kimchi met weinig zout",
|
||||
"kimchi_storage_low_salt_cold": "Kimchi met weinig zout, sterk",
|
||||
"kimchi_storage_low_salt_warm": "Kimchi met weinig zout, zwak",
|
||||
"kimchi_storage_crunfch": "Knapperige kimchi",
|
||||
"kimchi_storage_buy": "Gekochte kimchi",
|
||||
"storage_fridge_normal": "Koelkast",
|
||||
"storage_fridge_cold": "Koelkast, sterk",
|
||||
"storage_fridge_warm": "Koelkast, zwak",
|
||||
"storage_freezer_normal": "Vriezer",
|
||||
"storage_freezer_cold": "Vriezer, sterk",
|
||||
"storage_freezer_warm": "Vriezer, zwak",
|
||||
"kimchi_ripe_low_temp": "Kimchi rijpen, lage temperatuur",
|
||||
"kimchi_ripe_normal_temp": "Kimchi rijpen, kamertemperatuur",
|
||||
"kimchi_ripe_kkakdugi": "Kkakdugi rijpen",
|
||||
"kimchi_ripe_dongchimi": "Dongchimi rijpen",
|
||||
"meat_ripe_normal": "Vlees rijpen",
|
||||
"storage_meat": "Vlees en vis",
|
||||
"storage_fridge_vegetables_fruit": "Groenten en fruit",
|
||||
"storage_fresh_cereal": "Granen",
|
||||
"storage_fridge_drink": "Dranken",
|
||||
"storage_fresh_wine": "Wijn",
|
||||
"storage_fresh_potato_banana": "Aardappelen en bananen"
|
||||
}
|
||||
},
|
||||
"pantry_zone_mode": {
|
||||
"name": "Modus voorraadzone",
|
||||
"state": {
|
||||
@@ -678,6 +709,15 @@
|
||||
"fridge_temperature": {
|
||||
"name": "Koelkasttemperatuur"
|
||||
},
|
||||
"kimchi_ripening_status": {
|
||||
"name": "{instance_name} rijpingsstatus"
|
||||
},
|
||||
"kimchi_ripening_remaining": {
|
||||
"name": "{instance_name} resterende rijptijd"
|
||||
},
|
||||
"kimchi_rack_count": {
|
||||
"name": "{instance_name} aantal rekken"
|
||||
},
|
||||
"hood_filter_capacity": {
|
||||
"name": "Filtercapaciteit"
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user