refactor: replace exact-href door/temp/icemaker caps with generic pattern caps
Delete dead: DOOR_FRIDGE, DOOR_FREEZER, TEMP_FRIDGE/FREEZER_CURRENT/SETPOINT, ICEMAKER_ONE, ICEMAKER_TWO, ICE2_MODES, temperature bounds constants. Add: TEMP_CURRENT_GENERIC (href_prefix=/temperature/current/), TEMP_SETPOINT_GENERIC (href_prefix=/temperature/desired/, write derives CoAP path from href), ICEMAKER_GENERIC (href_prefix=/icemaker/, match_fn gates on iceMaker.state field). Key derivation strips 'vs' segments alongside digits so icemaker hrefs like /icemaker/one/vs/0 produce icemaker_one_state not icemaker_one_vs_state. write_fn signature extended: adapter now passes href as 3rd positional arg; all existing write_fns updated to accept href=None. Fridge golden: old ice1_*/ice2_*/fridge_*/freezer_* keys replaced by icemaker_one_*/icemaker_two_*/temperature_current_*/temperature_desired_*.
This commit is contained in:
1 parent
9e5a169c82
commit
785154eb83
10 files changed
+116
-189
No files matched your search
@@ -69,7 +69,7 @@ def discover(
|
||||
continue
|
||||
inst = instance_suffix(href)
|
||||
# Auto-derive key prefix from href: strip digits, join non-empty segs with '_'
|
||||
segs = [s for s in href.strip('/').split('/') if s and not s.isdigit()]
|
||||
segs = [s for s in href.strip('/').split('/') if s and not s.isdigit() and s != 'vs']
|
||||
for desc in cap.entities:
|
||||
key_override = '_'.join(segs) + '_' + desc.key
|
||||
out.append(BoundEntity(href=href, capability=cap, desc=desc,
|
||||
|
||||
Reference in new issue
Block a user