Porting Guide β Adding a Vacuum Brand¶
This guide is for developers adapting eufy_vacuum to a different vacuum brand that has a Home Assistant integration exposing named-room cleaning (Roborock, Ecovacs, Dreame, etc.).
Read 01 β Architecture Overview and
22 β The Adapter Contract first β this guide is the workflow,
those are the reference. The per-field schema is not written at all: ADAPTER-CONFIG.generated.md is
generated from adapters/config_schema.py, which makes it the complete block list and the
one page here that cannot go stale. The three shipped brands are worked examples: 23 β The Eufy
Adapter, 24 β The Roborock
Adapter and 24a β The Dreame
Adapter.
1. What you're actually doing¶
eufy_vacuum is not fundamentally a Eufy integration. It is a room-management, queue-orchestration, learning, and automation layer that sits on top of any HA vacuum entity capable of cleaning named rooms. Roughly all of the framework and all of the frontend have zero brand knowledge.
Everything brand-specific lives in a per-vacuum adapter config β a single dict the framework reads from the adapter registry at runtime. Porting a new brand means writing an adapter (a config dict plus a few small brand modules) and registering it at setup. You do not maintain a fork β the brand-adapter abstraction already exists.
You do not change core BEHAVIOUR. You may add an entry at a declared extension point. Those are different acts and the distinction is the whole architecture:
| you may | you must not |
|---|---|
add a row to BRAND_REGISTRARS (adapters/brands.py) |
change existing core logic |
register a new dispatch engine (queue/dispatch_engines.py, Β§4) |
make core branch on your brand |
register a new map segmenter (mapping/segmenter_engines.py, Β§8) |
add a brand name or brand value to a core comparison |
register a new job segmenter (learning/job_segmenter_engines.py, Β§9) |
change a shared default so your brand fits |
register a new room attributor (learning/room_attribution_engines.py, Β§6a) |
name a brand-agnostic engine after your brand (eufy_cv_v1 became cv_image_v1, eufy_counter_v1 became counter_plateau_v1, for exactly that reason) |
Those five files are plugin registries, not core semantics. Adding an entry
is registration β the same act as the BRAND_REGISTRARS row, and no more a core
edit than declaring a config field is. What makes core "untouched" is that no
existing behaviour changes when your brand arrives: nothing above the adapter
learns your brand's name, vocabulary, or limits.
If you find yourself editing anything else outside adapters/<brand>/, stop β
that is the signal you are reaching for something that should be yours or should
be passed to you (see 22 β The Adapter Contract, which
carries the same rule and the one known historical exception).
The reference adapter lives at custom_components/eufy_vacuum/adapters/eufy/.
A new brand is a sibling package, adapters/<brand>/, that produces the same
config shape.
For a second worked example β a brand whose discovery, dispatch, and clean-order behave nothing like Eufy's β see 24 β The Roborock Adapter. Reading the two side by side is the fastest way to see which config values are brand facts versus framework contract.
2. The adapter, end to end¶
An adapter is a small package mirroring adapters/eufy/. The table below is the
Eufy reference β the maximal surface, not a required checklist: most files
are optional. A divergent brand ships only what it needs β Roborock, for example,
is adapter.py / const.py / entities.py / vocabulary.py /
model_catalog.py / maintenance_components.py / dock.py plus its upkeep tables
(upkeep_catalog.py, upkeep_regimes.py, upkeep_keys.py) β no
buttons / lifecycle / water_config / segmentor, and no room_profiles.py
(it declares that block inline in adapter.py). Dreame is leaner still: no
dock.py, no segmentor, and all three engine seams declared explicitly off. See the
24 β The Roborock Adapter Β§2 for that minimal-surface
example.
| File (eufy) | Purpose |
|---|---|
adapter.py |
Builds the config dict and calls register_adapter_config(...). Entry point: register_eufy_adapter_for_vacuum(hass, vacuum_entity_id). |
entities.py |
Entity-ID naming convention (role β entity_id). |
vocabulary.py |
Brand state-string vocabulary sets. |
lifecycle.py |
Brand lifecycle signal helpers. |
buttons.py |
Dock-action and replacement-reset button candidate/token lists (the single source adapter.py builds dock_events.action_controls and maintenance_components[*].reset_button from). |
room_profiles.py |
The brand's room-profile vocabulary β the one block that resolves nothing when it is missing (Β§10). |
maintenance_components.py, upkeep_catalog.py, upkeep_regimes.py, upkeep_keys.py, water_config.py, model_catalog.py, const.py, constants.py |
Static per-model catalogs, the model-regime table the upkeep cards are derived from, and tuned constants. |
segmentor.py |
(Optional) brand CV map segmentor. |
Upkeep text is no longer authored per brand. A brand declares a MODEL REGIME table
(upkeep_regimes.py β mop type, dock tier, tanks, one row per model) and
upkeep_keys.py derives the card from it at import. That replaced the hand-authored
per-product-line guide families and their language packs, so a new model is one row
rather than new prose plus eighteen translations: the keys it derives come from the
shared, already-translated set. Do not author a <brand>_upkeep_guides.py or an
upkeep_guides_i18n/ β those are gone, and the regime table is the authority rather
than a cache of the answer.
The config dict it builds must match the schema in
adapters/config_schema.py. Registration is one call:
from custom_components.eufy_vacuum.adapters.registry import register_adapter_config
register_adapter_config(vacuum_entity_id, config)
async_setup_entry resolves the brand through adapters/brands.py::resolve_brand β
the vacuum entity's ENTITY-registry platform against the platforms each
BRAND_REGISTRARS row declares, first win takes it, no default arm β and calls that
row's register_*_for_vacuum per managed vacuum. A row may also carry prepare:
optional blocking initialisation, always run through HA's executor and never on the
event loop. Roborock uses it to load its dock truth table.
registry._validate_adapter(config) runs at registration and returns a list of issue
strings; a declared dispatch.template that doesn't resolve to a registered engine, or
a bad mapping.segmenter_engine, is flagged here.
β For a code adapter those issues are WARNINGS, and registration still succeeds.
register_adapter_confighard-raises on them only whensource == "config"(a user-saved config). Your brand declaressource: "code", so every issue β including an absentroom_profilesblock β is logged and the adapter registers anyway. The schema walk (config_schema.py::validate_adapter_config, which is what rejects unknown keys) has exactly one caller, the config-save service, and never sees a code adapter at all. Nothing at runtime holds your brand to this contract;tests/adapters/test_adapter_contract.pydoes β see Β§12. This asymmetry is 22 β The Adapter Contract Β§1, and the first row of its Β§7 table of wrong assumptions.
3. The config blocks you fill in¶
These are the real "coupling points" β all data, no code in core. Every field is in the
generated ADAPTER-CONFIG.generated.md; doc 22 covers what a schema cannot say β which rules actually run,
and what an omission means in practice. This is the orientation.
| Block | Required | What it carries |
|---|---|---|
adapter_id, source |
yes | identity (source: "code" for a shipped adapter) |
entities |
yes | role β HA entity-ID map (task_status, dock_status, active_map, battery, charging, cleaning_area, β¦). Absent entities degrade the dependent feature; they never raise. Do NOT supply robot_position_x/y β it is an Eufy-only raw field, not a pose source; see 23 β The Eufy Adapter. Live pose comes from map_state_source.live_pose and arrives as robot_anchor. |
dispatch |
yes | how to send a clean job (Β§4) |
vocabulary + completion |
no (recommended) | the raw state strings your vacuum reports (Β§5) |
capabilities |
no | feature flags (Β§6) |
discovery |
no | how the room list is exposed (Β§7) |
mapping |
no | pluggable map segmenter β image β room polygons (Β§8) |
job_segmenter + live_transition |
no | pluggable job/run segmenter β counter stream β per-room boundaries β plus live-rollover orchestration (Β§9) |
room_profiles |
YES by contract β but a code adapter is only WARNED | your brand's room-profile vocabulary (Β§10). Core carries no catalog, so an adapter declaring none cannot resolve a room β and per the warning in Β§2 the hard raise fires only for a user-saved config, so for your brand the absence surfaces at the first clean, not at startup. The conformance suite is the gate that catches it. It was nominally optional until 2026-08-07, and omitting it inherited the framework catalog β which was EUFY'S β so rooms were created with another brand's words and applied nothing. See Β§10. |
dock_events, post_job_wash_amendment, error_tracking, maintenance_components, upkeep_catalog, water_model_configs |
no | dock/error/maintenance catalogs β graceful degradation when absent |
The schema carries thirty-six top-level blocks, so the table above is a tour of the
load-bearing ones rather than the list. Optional blocks this guide does not walk, each degrading to nothing when
absent: charging (low-battery mid-job return), setup (which onboarding steps run),
settings_selects (global selects mirroring the current room's per-room values),
external_run and external_mid_run_statuses, device_clean_order (Β§6a), anomaly,
wash_frequency_bounds, cleaning_time_unit, model_family, display_name / brand,
and capability_hints β declarations fed into capability detection, a different
dictionary from capabilities with a different consumer, validated at registration
against a frozenset in core/capabilities.py.
4. Dispatch β pick (or add) an engine¶
dispatch.template selects a dispatch engine in
queue/dispatch_engines.py. Each engine produces a different payload
structure (not just renamed fields); the per-room field vocabulary
(room_fields: rename + value_map) is shared across all of them.
| Template | Wire structure | Brands |
|---|---|---|
eufy_room_clean |
rows β list of per-room dicts | Eufy |
roborock_segment_clean |
flat ids + batch scalar β {segments:[ints], repeat:n} |
Roborock |
generic_room_ids |
flat ids + batch scalar (e.g. Ecovacs {rooms:[ints], cleanings:n}) |
Ecovacs / fallback |
dreame_room_clean |
columns β positional parallel arrays | Dreame |
If your brand fits an existing shape, just configure the field names /
value maps β no new code. Roborock (app_segment_clean):
"dispatch": {
"template": "roborock_segment_clean",
"service_domain": "vacuum", "service_name": "send_command",
"command": "app_segment_clean",
"rooms_field": "segments", "clean_passes_field": "repeat",
# app_segment_clean wants `params` LIST-wrapped on the wire β without
# this the bare dict reaches the device and the clean does not start.
"params_as_list": True,
},
# β {"command": "app_segment_clean", "params": [{"segments": [16, 17], "repeat": 2}]}
Dreame (vacuum_clean_segment) is the columns shape, and it is worth reading in
two parts because the shipped adapter does not use the obvious half of it.
The dreame_room_clean engine transposes each declared room_fields entry into a
full-length aligned array (field_name: None is how you omit a field the brand does not
accept), and a value_map keys on the CANONICAL value, lower-case, never on the label
the card shows:
"room_fields": {
"fan_speed": {"field_name": "suction_level",
# canonical token -> wire int. Dreame's own labels for these four are
# Quiet / Standard / Intense / Max β the label is not the key.
"value_map": {"quiet": 0, "standard": 1, "strong": 2, "turbo": 3}},
},
The shipped Dreame adapter does not use that transpose, and the reason is worth
reading before you copy either shape. Its clean call carries room ids only, and every
per-room setting rides a separate bulk service call declared in dispatch.settings_write
β one vacuum_set_custom_cleaning with index-aligned int arrays over the queued rooms,
each field optionally gated on the per-room entity existing (gate_room_suffix), with a
filler for a room whose canonical value is empty:
"dispatch": {
"template": "dreame_room_clean",
"service_domain": "dreame_vacuum", "service_name": "vacuum_clean_segment",
"command": None, # see below β declared, NOT omitted
"rooms_field": "segments",
"clean_passes_field": None, # passes ride settings_write; the wire param is ignored
"passes_max": 3, "passes_is_global": False,
"settings_write": {
"domain": "dreame_vacuum", "service": "vacuum_set_custom_cleaning",
"segment_id_field": "segment_id",
"fields": [
{"canonical": "fan_speed", "wire": "suction_level",
"value_map": vocabulary.FAN_SPEED_WIRE_MAP, "required": True, "filler": 0},
{"canonical": "water_level", "wire": "wetness_level", "clamp": [1, 32],
"filler": 16, "gate_room_suffix": "wetness_level", "gate_domain": "number"},
...
],
},
},
The send-site envelope is also config-driven: a command produces the wrapped
{command, params} shape (Eufy/Roborock). A brand whose service takes its payload
directly must declare "command": None β omitting the key is not the same thing, and
is a bug that has already shipped: the default is command="room_clean", so an omitted
key sent Eufy's wrapped envelope to a Dreame service that has no command field at all.
If your wire shape is genuinely new, add an engine in
queue/dispatch_engines.py (subclass the closest one, override build_payload)
and register it under a new template name. build_room_clean_payload in
queue/queue_engine.py is the shared resolver (profile resolution +
capability gating + canonical resolved_rooms) that engines reuse β you do not
replace it.
Job model. Engines declare job_model (atomic_batch default, or
sequenced for sweep-all-then-mop-all style multi-dispatch jobs via
build_phases). See 05 β While a Run Is Live and
22 β The Adapter Contract.
5. Lifecycle vocabulary¶
The framework normalizes your vacuum's raw state strings into its internal
lifecycle vocabulary from the adapter config β you do not edit
listeners/lifecycle.py or core/manager.py.
entities.task_status/dock_status/active_cleaning_target/active_mappoint at the companion sensors.vocabularydeclares the raw strings:active_run_task_states,hard_service_states(wash/recycle/empty β hard block),drying_states(warning-only),blocked_work_mode_states, etc.completion.task_status_valueis the normalized "done" value (default"completed");completion.secondary_clear_sentinelsare the values that count the secondary signal as cleared.
Completion fires when task_status reaches the completion value, the secondary
target is cleared, and the job was observed active at least once. If your brand
has no active_cleaning_target concept, point completion.secondary_clear_entity
elsewhere or rely on task_status alone (it degrades gracefully).
6. Capabilities¶
Declare feature flags in the capabilities block:
supports_mop_features, supports_water_control, supports_path_control,
supports_edge_mopping, supports_mop_wash, supports_mop_dry,
supports_empty_dust, supports_robot_position, supports_station_water.
They gate payload fields, dock actions, and card UI.
There are also behavioural flags an entity probe can't see β
honors_clean_order, supports_room_profiles, rooms_unique_per_job,
position_lock_reliable β and the zone sub-vocabulary (supports_zone_clean,
supports_zone_repeat, zone_max, plus zone_max_side_m / zone_min_side_m for a
side-length brand or zone_max_area_m2 / zone_min_area_m2 for an area brand: the two
shipped zone brands express the limit in DIFFERENT units, so no consumer may assume one
shape). All default to True / unchanged, so Eufy omits them. A path-optimizing brand
(the Roborock S6) sets honors_clean_order=False (which gates the strict-order opt-in
and the run-start "order is advisory" note) and supports_room_profiles=False.
supports_base_station and supports_map_bounds are not declarable here. They are
derived per vacuum in core/manager.py::get_dashboard_snapshot β from
dock_events.enabled and from whether mapping.segmenter_engine names a real segmenter
β and shipped in the dashboard snapshot the card gates its tabs on.
The complete table is generated, not written:
CAPABILITY-FLAGS.generated.md carries
all 22 declarable keys, which of them a capability_hint can also feed, and which exist
only in detection output. Two it declares that this guide does not otherwise walk:
supports_goto (Β§6a) and supports_cleaning_path β the pass-density axis the card calls
Cleaning Path, which a brand declares only when it can DERIVE it, because absent means
"nobody established this" and that is a third state the card must not collapse to False.
The Eufy adapter auto-populates these by calling
core/capabilities.py::detect_capabilities() (Eufy-specific: entity-presence
probes + product-code/name model families). For a new brand, the simplest path
is to set the flags statically in your config's capabilities block based
on the hardware; provide brand-specific detection only if you need it. Either
way the flags' meaning is brand-agnostic β only detection is brand-specific.
6a. Config seams a divergent brand may need¶
The Roborock adapter exercised several config seams Eufy never touches. A
divergent brand can opt into the same behavior by declaring these β each is a
config knob, not core code. One line each here; the field schemas are in ADAPTER-CONFIG.generated.md
and the worked context in 24 β The Roborock Adapter.
dispatch.phase_timingβ settle/verify/retry timing for the strict-order per-room watchdog (a path-optimizing device may ignore a clean dispatched the instant it docks; the watchdog re-dispatches).dispatch.per_room_live_settingsβ mid-run per-room fan via a side service call (Roborockset_fan_speedas the robot enters each room). The push is idempotent: an entry whose target entity already reports the value is not sent, because the pointer driving it is non-monotonic whereverrooms_unique_per_jobis False (ISSUE #78). Optionalstate_attributenames the attribute that reports the value now; it defaults to the service's ownvalue_key, and absence never causes a skip.dispatch.passes_is_globalβ collapse per-room passes to one batch scalar for the whole run (e.g.app_segment_clean'srepeat).dispatch.resolve_live_ids_by_slugβ re-resolve each target room's name slug to its LIVE id from a fresh discovery right before send (segment ids that renumber on a re-map).dispatch.params_as_listβ list-wrap theparamspayload on the wire.completion.require_job_active_clearβ key completion on a job-active binary clearing instead of a current-room sentinel.mapping.live_map_image_entity_patternβ an HAimage/cameraentity-id pattern for a live-map backdrop in the card.dispatch.global_pre_callsβ push a setting once before an atomic dispatch for a brand that exposes it only globally (e.g. a singleset_fan_speed). Each entry reads a canonical per-room field across the selected rooms and applies the max-wins value via a side service call (mirrors the batch-passes rule). Best-effort. Use this for a global-only setting; useper_room_live_settings(above) when the device honors mid-run per-room changes.map_state_source/map_renderβ read a provider's own map segmentation (authoritative room bboxes + dock/robot anchors) into normalized, VA-owned geometry, plus the in-memory live pose for the moving overlays.map_renderdeclares how the card sources the raster for its own VA-owned backdrop (the source pointer is reused frommap_state_source, no duplicate schema). Both brands declare both: Eufy against the eufy-clean fork's storage backend, Roborock against the HA-core integration's in-memory parsed map (amemorybackend + theroborock_raw_map_v1render decode).room_attributionβ a pluggable engine that recovers which managed rooms an external (undispatched) run cleaned, from a per-tick pose time-series. A different axis from the job/run segmenter (Β§9): that one owns time/area boundaries, this one owns room identity. Eufy and Roborock both declareswept_area_winding_v1; Dreame declaresnoop_room_attributionbecause it reports native per-room progress. Absent or unknown falls back to the winding engine, not to noop β so a brand that wants no attribution must say so.dispatch.zone_command+capabilities.supports_zone_cleanβ ad-hoc free-form zone cleaning (draw a box on the live map, clean that rectangle). The verb is thesend_commandcommand name (dispatch/manager.py::dispatch_zone_cleanreads it); absence means zone cleaning is unsupported for the brand. A brand whose zone clean is its OWN service rather than asend_commandverb declares the top-levelzoneblock instead (service_domain / service_name, zone_field / repeats_field, zone_coords, zone_passes_max) β Dreame'svacuum_clean_zone. Same capability flag, same consumer, two declaration shapes.goto+capabilities.supports_gotoβ cruise to a point (service_domain / service_name plusx_field/y_fieldfor the device-mm coordinate), read bydispatch/manager.py::dispatch_goto.device_clean_orderβ the order the ROBOT itself will clean in, which on a path-optimising brand overrides its own optimisation. Absent (orenabled: False) means the brand has no such concept: no read, and no clean-order sensor is created.read.vianames the acquisition strategy and is the repoint seam; an unimplementedviareads as unavailable, never as an empty order.
A divergent brand can thus opt into: the strict-order per-run sequenced clean, the live-map backdrop, a VA-owned provider-map source with live pose, external-run room attribution, ad-hoc zone cleaning, name-slug room-identity reconciliation, and a per-vacuum panel rename β without forking core.
7. Discovery¶
The discovery block tells the framework how the room list is exposed. There
are two sources, selected by discovery.source ("entity_attribute" default,
or "service_response"); both flatten into the same list-of-dicts the
normalizer expects, so everything downstream (slug, dedupe, int-coerce) is
unchanged. See rooms/source_refresh.py.
entity_attribute (default β Eufy). The room list is a live attribute on an
HA entity; the sync discovery path reads it directly.
room_list_entityβ"vacuum_entity"to read an attribute off the vacuum entity (Eufysegments, Ecovacsrooms), or a full entity ID.room_list_attribute,room_id_key,room_name_keyβ where the id/name live in each room dict.
service_response (Roborock). The idβname map exists only in the response
of a service call (roborock.get_maps), never as an entity attribute. An async
refresher calls the service at the async discovery boundaries, flattens the
{segment_id_str: name} mapping per map, and caches it for the sync path:
"discovery": {
"source": "service_response",
"maps_service": {"domain": "roborock", "service": "get_maps"},
"maps_rooms_key": "rooms",
"map_name_key": "name", # cache keyed by the active-map NAME
"room_id_key": "segment_id",
"room_name_key": "name",
},
See the 24 β The Roborock Adapter Β§4 for the worked
example. Brands that expose rooms via HA Areas (the 2026.3 vacuum.clean_area
integrations) read those instead. None of these need CV segmentation β the Eufy
CV segmentor exists only because Eufy exposes no structured room geometry.
8. Map segmentor (optional)¶
This is the map segmenter (image β room polygons). It is a different subsystem from the job/run segmenter in Β§9 β do not conflate the two: this one turns a map image into geometry; that one turns a run's counter stream into per-room timing boundaries.
mapping.segmenter_engine selects a map-image segmenter by name from
mapping/segmenter_engines.py (cv_image_v1, or noop_fallback to disable the
polygonal overlay while trace-based bounds keep working). The Eufy CV pipeline
lives in adapters/eufy/segmentor.py (detect_room_segments) and is built on
the brand-agnostic primitives in mapping/segment_primitives.py.
A new brand that ships structured room geometry (most lidar brands) does not
need a CV segmentor at all β declare noop_fallback. If you do want an
image-based overlay, write a new segmenter engine using segment_primitives.py
(polygon math, mask ops, HSV helpers, alignment) and register it; copy
adapters/eufy/segmentor.py as the reference and re-tune its HSV thresholds /
scoring heuristics for your brand's map palette.
9. Job/run segmentor (optional)¶
Separate from the map segmentor (Β§8): this is the job (run) segmenter, which
turns a single run's progress stream into ordered per-room cleaning bouts so
learning can attribute time/area to each room. It lives in
learning/job_segmenter_engines.py and mirrors the dispatch-engine seam exactly
β a brand registers an engine under a string name and selects it via
job_segmenter.engine in the adapter config.
The counter-plateau engine (counter_plateau_v1, the Eufy default) detects per-room
boundaries by watching the cleaning_time / cleaning_area counters plateau and
jump (Eufy exposes no
native per-room transition events; coordinates drift). A lidar brand that emits
a native "now cleaning room N" signal implements find_candidates by reading
those events instead and returns the same boundary/segment shape, so the
three consumers (live rollover, external-run ingest, learned history) never
change.
The contract β two TypedDicts. Every engine speaks
JobBoundaryCandidate (id, position, gap_s, area_after_m2, kind,
strength, confident, t) and JobSegment (index, boundary_id,
t_start/t_end, ct_start/ct_end, area_*_m2, time_active_s,
time_wall_s, gap_before_s, battery_delta, boundary, increment_count).
These are the cross-engine union; consumers read only these fields.
The JobSegmenter Protocol β what the brand implements:
| Method | Brand owns? | Purpose |
|---|---|---|
engine_name |
yes | the registry key (e.g. "counter_plateau_v1") |
validate_tuning(tuning) |
yes | return issue strings ([] = valid); run at registration |
find_candidates(samples, *, tuning) |
yes | every boundary in the stream, in cleaning order β no discards |
build_segments(samples, active, *, tuning) |
yes | the ordered per-room JobSegments for a chosen boundary set |
segment_legacy(samples, *, expected_rooms, tuning) |
yes | one-shot detect β select β build (live-disabled path + learned history) |
select_active is NOT on the engine β the brand does not implement it. The
middle stage (ranking/filtering candidates down to the chosen boundary set) is
the brand-agnostic framework function counter_segmentation.select_active; it
reads only kind / confident / strength / id off the candidate shape, so
the external-review wizard's count/toggle logic stays uniform across brands. The
engine owns only the two brand-specific stages (find_candidates,
build_segments) plus the segment_legacy composition.
Kind literals stay at the call sites, not in the engine. The counter engine's kind
vocabulary ("wash_plateau" / "transit" / "area_jump" / "weak" /
"recharge_dock") is produced by find_candidates and referenced by the Eufy-specific
call sites (the live rollover_kinds list and the legacy
{"wash_plateau", "area_jump"} filter). A brand with a different kind vocabulary
supplies its own engine and its own kind literals at those sites β there is no kind
indirection to configure.
Note the third state in that vocabulary, because a new engine will want it.
"weak" is reported and selectable (a short delayed step, flat area β most likely a
multi-pass turn, not a boundary unless the user splits it), while "recharge_dock" (a
gap past stall_wall_s with the battery RISING β the robot ran flat, docked, charged
and resumed the same room) is reported so the dock trip stays visible but sits in
_NEVER_BOUNDARY_KINDS and is filtered out of every selection mode, including an
explicit active_ids toggle. Reported, selectable, and never-a-boundary are three
different answers, and a kind that would satisfy wash_plateau in full needs checking
BEFORE it.
Counter-plateau fallback, not noop (mind the asymmetry with Β§8). Unlike the map
seam, get_job_segmenter_engine(name) falls back to counter_plateau_v1 for an absent
or unknown name β like the dispatch seam, not a noop β because the historical
no-adapter default is counter segmentation and live rollover + history must
keep working byte-for-byte. A noop_job_fallback engine is registered for a
future brand that genuinely emits no segmentable signal, but you must declare it
explicitly; it is never the silent default. An unknown (non-empty) name logs a
warning.
Adapter config. Declare the engine and its thresholds in a job_segmenter
block; live_transition carries only the live-rollover orchestration knobs:
"job_segmenter": {
"engine": "counter_plateau_v1",
# The SINGLE in-code source of the gap/area/cadence thresholds β live
# rollover, external-run ingest, AND learned history all read these.
"tuning": {
"gap_delayed_s": 35.0, "gap_transit_s": 60.0, "gap_plateau_s": 90.0,
"area_jump_m2": 2.0, "cadence_s": 30.0,
# A gap longer than this between cleaning_time ticks INSIDE a segment
# is a firmware freeze / over-long dock β carved out of time_wall_s.
"stall_wall_s": 600.0,
},
},
"live_transition": {
# Orchestration only β NOT thresholds (those moved to job_segmenter.tuning).
"enabled": True, # kill-switch
"rollover_kinds": ["wash_plateau", "transit", "area_jump"],
# A brand with a native per-room signal sets True to follow the device's
# current-room sensor directly (filtered to the job's target rooms,
# suppressed for sequenced/strict-order jobs). Eufy leaves it False and
# uses counter-plateau inference.
"native_transition_source": False,
},
A brand whose device reports its live room directly (e.g. Roborock's
_current_room sensor) sets native_transition_source: True; the framework then
follows that signal β name-slug matched, order-agnostic, transit rooms ignored β
instead of the counter/timing heuristic. Both Roborock and Dreame declare it; Eufy is
the only shipped brand left on the counter heuristic. The worked examples are
24 β The Roborock Adapter and
24a β The Dreame Adapter.
Threshold home moved. The six gap/area/cadence/stall thresholds (
gap_delayed_s,gap_transit_s,gap_plateau_s,area_jump_m2,cadence_s,stall_wall_s) now live only injob_segmenter.tuning. They are no longer carried inlive_transitionβ any older note that listed them there is stale.
registry._validate_adapter validates a declared job_segmenter block (mirrors
the mapping check): engine is required when the block is present, must be a
known engine name (known_job_engine_names()), and tuning is checked by the
engine's own validate_tuning.
If your brand has no segmentable run signal, declare
{"engine": "noop_job_fallback"} to opt out explicitly (every stage returns
[]); learning then accumulates no per-room boundaries for that brand.
Byte-identical by delegation. CounterPlateauSegmenter delegates
verbatim to the existing counter_segmentation primitives, and its
DEFAULT_TUNING is defined by reference to that module's constants β so the
Eufy path is byte-for-byte identical to the pre-engine code, and drift is a
compile-time impossibility rather than a vigilance task. Copy this engine as the
shape reference for a new brand.
The engine was renamed, and the old id is not for new code. It was
eufy_counter_v1(classEufyCounterSegmenter) until 2026-08-30, when Dreame became the second brand to reach for it and a brand-named key in a brand-agnostic registry stopped being tenable.counter_plateau_v1is the name; the legacy id is dual-accepted so a stored config is not stranded, and is slated for removal. Declare the new one. The same rename took the map segmenter fromeufy_cv_v1tocv_image_v1(Β§8) and the room attributor fromeufy_anchor_winding_v1toswept_area_winding_v1(Β§6a).
9a. ORDER YOUR OPTION LISTS β least effort first¶
This is a standard VA sets, not a convention inferred from the shipped brands. Declare every ordered option list ascending:
index
0= LEAST effort Β· index{max}= MOST effort
One sentence covers all of them:
| list | 0 |
{max} |
|---|---|---|
fan_speed_options |
quietest | most suction |
water_level_options |
least water (often "off") | most water |
clean_intensity_options |
fastest (widest pass spacing) | slowest (closest passes, most thorough) |
{max} is whatever YOUR brand's top rung happens to be β there is no fixed
count. Eufy declares four suction levels and Roborock five; both are correct,
because a canonical setting refers to a POSITION in your list, never to a fixed
integer and never to another brand's word.
clean_mode_options is the exception: it is an ENUMERATION, not a ladder.
Its order is identity, not magnitude β vacuum is not "less" than mop β so
declare the modes your brand supports in any sensible order and expect exact
matching rather than nearest-rung resolution.
Why this matters even though nothing enforces it. Framework defaults refer to a position, so a list declared high-to-low silently inverts every default your rooms are created with: the "gentle default" becomes maximum suction, and no test can catch it β ordering is semantic and unverifiable. The shipped brands all conform, so copying their shape keeps you right.
10. Room-profile vocabulary (REQUIRED)¶
Your brand's room-profile vocabulary. Core carries no catalog of its own, so an adapter that declares none cannot resolve a single room and fails registration.
What core does own is the four profile KEYS (PROTECTED_ROOM_PROFILE_NAMES) and
DEFAULT_ROOM_PROFILE_NAME, which names WHICH profile a new room starts on and never
what is inside one. Every value is yours.
"room_profiles": {
"default_profile": "vacuum_quick",
"builtins": {...}, "custom_template": {...}, "legacy_aliases": {...},
"floor_type_water_defaults": {...}, "floor_type_fan_defaults": {...},
"normalize_defaults": {...},
},
resolve_profile_catalog(block) carries exactly what you declared β no merge, no
inherited defaults. An undeclared key resolves EMPTY.
The gate is the block, not each key. Declaring some and not others is fine: the
rest resolve empty, which is a defined answer. Declaring one EMPTY (legacy_aliases: {},
as Roborock does) states "this brand supplies none", and is deliberately distinguishable
from omitting it β collapse the two and "this brand has none" reads the same as "the
porter forgot". Only an absent or wholly empty block fails registration.
Use the same four profile KEYS every brand declares (vacuum_quick, vacuum_deep,
vacuum_mop_quick, vacuum_mop_deep) so a stored room and the card's profile picker
survive a brand switch. Omit an axis your brand does not have β Roborock omits
clean_intensity from every profile β so nothing inert is written onto its rooms.
Note floor_type_water_defaults: the resolver reads its carpet entry as your brand's
no-water word (no_water_value()), because carpet is the one surface the framework
guarantees dry. Get that entry right and every "suppress water" path in core uses your
word instead of somebody else's.
Where it's consumed. The per-vacuum catalog is resolved (via
resolve_profile_catalog on the vacuum's registered room_profiles block) at
three consumers: the dispatch path
(queue/queue_engine.py::build_room_clean_payload threads it into per-room
profile resolution + capability gating), profile application
(profiles/manager.py::apply_room_profile resolves the vacuum's catalog so an
omitted field fills from the brand's normalize_defaults), room CRUD
(_finalize_room_update / _match_profile_from_fields / _protected_room_config, each
of which now takes a required vacuum_entity_id), the profile library
(get_room_profiles), and new-room defaults
(rooms/room_defaults.py::resolve_new_room_defaults_for_vacuum, used by the
room-creation call sites).
An unregistered adapter resolves an EMPTY catalog, and resolving a profile against one
raises UndeclaredProfileCatalogError naming the missing declaration. It used to resolve
the in-code framework catalog, which was Eufy's β that is the bug this contract exists to
prevent, not a fallback to rely on.
11. What ports for free (zero changes)¶
These subsystems operate entirely on the internal data model / HA service calls and need no brand work:
- Learning (
learning/) β consumes canonicalresolved_rooms+ lifecycle events. Per-room run segmentation (Β§9) and external-run room attribution (Β§6a;learning/room_attribution_engines.py) are the pluggable seams here; the rest (history store, external ingest, accumulation) is brand-agnostic. - Queue engine (
queue/queue_engine.py) β ordering, enabled-room filtering, access graph, blocker/modifier rules, start protection. - Room rules (
rooms/,queue/) β blockers, modifiers, access graph, preflight. HA state reads only. - Mapping/bounds (
mapping/) β trace-based bounds from position sensors (coordinate units may need adjustment per brand). - HA entity platforms β
button.py,switch.py,number.py,sensor/(the integration registers six platforms:binary_sensor,button,switch,select,number,sensor). - Listeners (
listeners/package) β lifecycle/finalize, job progress, dock events, path blockers, pause timeout. Driven by adapter config. - Card frontend, theme system, profile system β fully brand-agnostic.
12. Validate with the contract harness¶
There is no fork to maintain. The brand-agnostic adapter conformance suite
(tests/adapters/test_adapter_contract.py) validates any adapter's config
against the documented schema and runtime expectations. Add your brand to the
ADAPTER_BUILDERS registry in tests/adapters/conftest.py and the entire
contract suite runs against it automatically β schema conformance, dispatch
shape, entity-ID format, registry validation. Brand-specific deep tests (your
CV segmentor, your model catalog) live under tests/adapters/<brand>/.
Run it with scripts\test.bat tests/adapters on Windows β the suite needs Linux,
because pytest-homeassistant-custom-component imports fcntl β or
python -m pytest tests/adapters on Linux/macOS. Naming the directory only scopes the
run β tests/adapters is in the default testpaths in pytest.ini, so a bare pytest
collects it too. See
Building and testing a change.
13. Port checklist¶
Each step is independently testable.
- Map the HA entities your vacuum exposes to the
entitiesrole keys (task_status,dock_status,active_map,battery, position sensors, β¦). Document the IDs before writing code. - Write the
vocabulary+completionblocks β every raw state string, sorted intoactive_run_task_states/hard_service_states/drying_states/ blocked sets, and the completion value. Ensure at least one state marks the job "observed active." - Choose a
dispatch.template. If an existing shape fits, configure field names + value maps. If not, add an engine indispatch_engines.py. - Set
capabilitiesflags for the hardware. Setdiscoveryfor how rooms are listed. Setmapping.segmenter_enginetonoop_fallbackunless you wrote a map segmentor (Β§8). - Decide the job/run segmenter (Β§9). If you can reuse the shared
counter-plateau engine, declare
job_segmenter.{engine: "counter_plateau_v1", tuning}and thelive_transitionorchestration knobs. If your brand emits native room-transition events, write aJobSegmenterengine (find_candidatesplusbuild_segmentsplusvalidate_tuning, returning theJobBoundaryCandidate/JobSegmentshape βselect_activeis framework-provided), register it in_JOB_SEGMENTER_ENGINES, and name it here. To opt out, declarenoop_job_fallback. (Optional β an absent block falls back tocounter_plateau_v1.) Declare aroom_profilescatalog (Β§10) β required by the contract, and warned-not-raised for a code adapter, so Β§12 is what catches its absence. - Build the config dict in
adapters/<brand>/adapter.pyand register it fromasync_setup_entry. - Add the brand to
ADAPTER_BUILDERSand run the conformance suite (Β§12) β it must pass. - Run a real job with learning disabled: confirm the dispatch reaches the vacuum, the job is observed active, it auto-finalizes, and the active-job record clears. Then enable learning and confirm per-room timing accumulates into the per-room segments your job segmenter produced.
- (Optional) Map overlay: place a PNG at the maps path and use the card's bounds calibration, or rely on colour-coded bounds boxes with no image.
If the brand has a real user base, ship the adapter upstream as a new
adapters/<brand>/ package rather than keeping it local β that is the whole
point of the adapter boundary.