Skip to content

Add read-only washer and TP1X fridge descriptors; configurable env file and log cap in compose - #127

Merged
QuiteYellow merged 6 commits into
QuiteYellow:mainfrom
dalbrekt:feat/washer-fridge-tp1x-env-file
Nov 7, 2026
Merged

QuiteYellow merged 6 commits into
QuiteYellow:mainfrom
dalbrekt:feat/washer-fridge-tp1x-env-file

Conversation

@dalbrekt

@dalbrekt dalbrekt commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Four commits, each standing on its own.

feat(compose): let the env file live outside the checkout. env_file: - .env was fixed, so the bridge's config had to sit in the compose directory. docker compose --env-file does not move it: that flag feeds only the ${...} interpolation (here SMARTTHINGS_LOCAL_APPDATA_DIR), never the container, so the volume came from one file and the appliance keys from another. The path is now ${SMARTTHINGS_LOCAL_ENV_FILE:-.env}; set that key inside the file you pass and one flag drives both. Unset, it is .env as before, which is what deploy.sh ships. Prefixed for the same reason as SMARTTHINGS_LOCAL_APPDATA_DIR. Checked with docker compose config only.

feat(compose): cap the container log at 3 × 10 MB. The bridge logs to stdout only and the compose file set no logging:, so on a stock host the json-file driver keeps every line until the disk fills. A running washer or dryer cycle logs about a line a second (project() moves the countdown on every hot poll and bridge.py:834 logs each changed publish), and DEBUG_BRIDGE=1 adds every representation. 3 × 10 MB holds roughly a week at normal levels; that is an estimate from the log calls, not a measurement. Checked with docker compose config.

feat(mqtt_demo): a washer descriptor, and a fridge_tp1x one. Both were written against an older samsung_appliance tree and are ported to the current descriptor API: helpers from ..descriptor, PollTier from smartthings_local.ocf.poll_scheduler, and command_handlers taking the state argument bridge.py:275 now passes (without it the bridge fails at startup with a TypeError).

Their resource maps were measured with capture_resources.py on 2026-07-02, on a WW11DB7B34GWU3 washer and a TP1X_REF_21K fridge. Their writes were not: none has been sent through these descriptors, the washer's Remote-Control gating is carried over from the dryer, and the fridge's setpoint write follows the oven's items-array pattern without having been tried on the fridge. So each ships with WRITES_ENABLED = False. In that mode it registers no command handlers, so the bridge drops every command topic as unknown; it publishes the settings as plain sensors; and it retires any button, select, switch or number a writable build left retained on the broker. Flipping the flag reverses both.

fridge_tp1x is not an alias for fridge. fridge is the ARTIK051 family (REF_17K) with a different resource tree (/doors/vs/0, /mode/vs/0, /sabbath/vs/0) and writes measured only there; the two share five resources out of roughly a dozen each. The name follows the TP1X label the oven already carries.

What this does not claim:

  • Neither descriptor has yet run against its appliance through this bridge. The tests pin the flatten mapping and the read-only discovery on synthetic links.
  • The washer course is the raw Table_02 code; no code-to-name mapping has been captured.
  • README.md:735 calls the three existing descriptors "frozen reference implementations". I have left that wording alone, since whether new classes belong in mqtt_demo/samples/ at all is your call. Happy to move them or drop that commit pair if not.

1353 pass on 3.12; I have not run the 3.11–3.14 matrix or the floor job locally. Share safety passes on the changed files.

`env_file: - .env` was fixed, so the bridge's config had to sit inside the
compose directory. `docker compose --env-file` does not move it: that flag
feeds only the ${...} interpolation (here SMARTTHINGS_LOCAL_APPDATA_DIR),
never the container, so the volume came from one file and the appliance
keys from another, and a missing mqtt_demo/.env still failed the run.

The path is now ${SMARTTHINGS_LOCAL_ENV_FILE:-.env}. Set that key inside
the file you pass, and one flag drives both:

  docker compose --env-file /opt/smartthings-local/bridge.env up -d

Unset, it is .env as before, which is what deploy.sh ships. Prefixed for
the same reason as SMARTTHINGS_LOCAL_APPDATA_DIR: a shell-exported value
wins over the file.

Checked with `docker compose config`: with only an outside file, the
appliance keys reach the container and /config mounts from the directory
that file names.
Ported from an older samsung_appliance tree to the current descriptor
API: helpers from ..descriptor, PollTier from
smartthings_local.ocf.poll_scheduler, and command_handlers taking the
state argument bridge.py now passes. Without the last, the bridge fails
at startup with a TypeError.

The resource map was measured (capture_resources.py, 2026-07-02, on a
WW11DB7B34GWU3). The writes were not: no Start/Pause/Stop or option
write has been sent through this descriptor, and the Remote-Control
gating is carried over from the dryer. So it ships with WRITES_ENABLED
off. In that mode it registers no command handlers, so the bridge drops
every command topic as unknown; publishes water temperature, spin level
and rinse cycles as plain sensors; and retires any button or select a
writable build left retained on the broker. Flipping the flag reverses
both, retiring the plain sensors instead.

The course is still surfaced as the raw Table_02 code; no code-to-name
mapping has been captured.
Ported from the same older tree as the washer, with the same three API
fixes.

fridge_tp1x is not an alias for fridge. fridge is the older ARTIK051
family (REF_17K) with a different resource tree (/doors/vs/0,
/mode/vs/0, /sabbath/vs/0), and its writes were measured only there.
The name follows the TP1X family label already used for the oven, and
appears in the appliance's own model string (TP1X_REF_21K).

The resource map was measured (capture_resources.py, 2026-07-02). The
writes were not: the setpoint write follows the oven's items-array
read-modify-write and the toggles are single-field writes, but none has
been sent to this fridge. So it ships with WRITES_ENABLED off, as the
washer does: no command handlers; setpoints, Power Cool/Freeze and the
ice maker as plain sensors; any switch or number left retained on the
broker retired.
The bridge logs to stdout only, so rotation falls to Docker, and the
compose file set none. The json-file driver's default is unbounded
unless the host's daemon.json says otherwise, so a stock host keeps
every line until the disk fills.

The rate is not trivial. maybe_publish_state logs each publish whose
sensors changed (bridge.py:834), and during a washer or dryer cycle
project() moves the countdown every second, so a running cycle logs
about a line a second. DEBUG_BRIDGE=1 adds every representation.

3 x 10 MB holds roughly a week at normal levels. That figure is an
estimate from the log calls and ~200 bytes per json-file line, not a
measurement; raise max-size for longer. It takes effect when the
container is recreated.

Checked with `docker compose config`.
@dalbrekt dalbrekt changed the title Add read-only washer and TP1X fridge descriptors, and a configurable env file path Add read-only washer and TP1X fridge descriptors; configurable env file and log cap in compose Oct 27, 2026

@QuiteYellow QuiteYellow left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. The two compose commits look good to me as they are.

The washer was ported from dryer.py as it was before 65be6ef, so it misses that commit's fixes (details inline). Could you rebase the washer on the current dryer?

LocalThings has a cross-checked Table_02 course catalogue (washer_cycle_table_02 in their translations/en.json, sources listed in registry/capabilities/washer.py). Your example Table_02_Course_1C is in it as "Eco 40-60", so the course sensor can show the cycle name.

I'll update the README's "frozen reference implementations" wording separately.

Comment thread mqtt_demo/samples/washer.py Outdated
return
try:
h, m, s = rem.split(':')
state['remaining_anchor'] = (time.time(),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This re-anchors on every hot poll, so the countdown sits still for a minute and then jumps. The current dryer anchors only when remainingTime changes, publishes minutes plus a finish_at timestamp, drops the anchor at cycle end, and zeroes progressPercentage while idle.

# (key, friendly name, extra-config-dict)
_SENSORS = [
('fridge_temp_c', 'Fridge temperature',
{'unit_of_measurement': '°C', 'device_class': 'temperature',

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every temperature here is published as °C. LocalThings reads the units field per resource, because the same fields come back in °F on some fridges.

The washer was ported from dryer.py as it stood before 65be6ef, so it
re-anchored the countdown on every hot poll: the clock sat still for a
minute, then jumped. It now imports the dryer's on_observation and
project instead of carrying a copy, so it anchors only when
remainingTime changes, publishes minutes plus a `finish_at` timestamp,
and drops the anchor at cycle end. A later dryer fix reaches both.

Also from that commit: progressPercentage is zeroed while idle (this
board parks it at "1" while Ready, as the dryer's does), `job_state` is
gone, `job_begin_status` becomes the dryer's `job_beginning_status`,
`machine_state` and `progress` are enum sensors, and the alarm,
firmware-update and Wi-Fi sensors are added. The progress options are
this washer's own `supportedProgress` from washer-capture.json.

The alarm and firmware sensors read resources present in the washer
capture. /rm/wifi/vs/0 is not: it sits outside the /device/0 batch, so
the capture cannot show it either way, and it is measured only on the
dryer and oven. Polled at 120 s; if this board lacks it the cost is a
logged error per poll and an empty sensor.

Course names: the washer reports Table_02, and LocalThings keeps a
cross-checked Table_02 catalogue (`washer_cycle_table_02`,
mbillow/localthings@0b268a9, MIT). The table here is trimmed to the 23
courses this washer declares in /course/vs/0 `supportedOptions`, split
at the record width its header states, as LocalThings'
`_course_records` does. The codes are the washer's own; the names are
LocalThings', and only 0x1C (Eco 40-60) has been seen selected here. An
unlisted code is published raw.
Every temperature was published as °C. Each resource states its own
unit (`units` on the OCF /temperature/* resources,
`x.com.samsung.da.unit` on a /temperatures/vs/0 item), and LocalThings
found the same fields in °F on some fridges, so readings are now
converted from the unit they state. HA's unit is fixed at discovery, so
the published values stay °C.

A missing or unrecognised unit publishes None rather than a number in an
unknown unit. The capture states a unit on every temperature resource,
so this board is unaffected.

The setpoint write, still behind WRITES_ENABLED, now refuses when the
item reports anything but Celsius, rather than sending a °C number to a
°F board.

@QuiteYellow QuiteYellow left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both fixes are in, thanks. The washer now imports the dryer's on_observation and project, so the next fix there reaches it too.

I checked the course table against washer_cycle_table_02 at the commit you cite: all 23 codes match, so the names are the catalogue's. The suite passes here at 1363, and CI is green on all eight jobs.

Two small things I will add myself after merging. dryer.py keeps a _RETIRED list so a renamed sensor's retained config gets cleared; job_state and job_begin_status were published by the earlier revision of this branch, so an install that ran it keeps two dead entities. And /rm/wifi/vs/0 being unmeasured on this board is in your commit message but not in the module, which is where the next reader looks when a poll logs an error. The README's "frozen reference implementations" wording is still mine to fix, as well.

@QuiteYellow
QuiteYellow merged commit 9f68873 into QuiteYellow:main Nov 7, 2026
8 checks passed
QuiteYellow added a commit that referenced this pull request Nov 7, 2026
The docstring said the dryer and the oven shared the helper. #127 added
the washer as a third, so the sentence named two of three.

The shape finding it goes on to describe is still the dryer and the
oven, which are the two boards measured. That part is unchanged.
QuiteYellow added a commit that referenced this pull request Nov 7, 2026
The resource inventory said `/rm/wifi/vs/0` was "read by neither the
bridge nor localthings", status "live, unused", with "surface it in the
bridge" as the next step. 65be6ef did that for the dryer and the oven,
and the tag list for that commit starts at v0.1.19, so the row has been
wrong for six weeks. #127 added the washer as a third consumer.

The localthings half is left as written, as a claim with a date on it:
nothing here re-read their source.

The second table in this file is unaffected. Its column is "where it
shows up", so `neither surface` for this resource means neither
`/oic/res` nor the `/device/0` batch, which is still true and is the
reason a descriptor has to name the path in a poll tier.
mbillow pushed a commit to mbillow/SmartThings-Local that referenced this pull request Nov 11, 2026
The README said there were three descriptors, that they were frozen,
and that a new appliance should go to localthings instead. QuiteYellow#127 added
two more, from a contributor, here. @dalbrekt raised the contradiction
in that PR.

What was true in the sentence is kept: the samples are references, one
firmware family each, and localthings owns production appliance
support. What replaces "frozen" is the condition a new one has to meet
-- that it reaches a family or a wire behaviour the existing ones do
not, which is what makes it useful as a reference. The two new ones are
named as read-only, because their write paths are off until someone
measures them.

Three surfaces carried the claim: the file tree, the "Adding appliance
support" section, and docs/appliance-compatibility.md. The tree also
listed three sample modules and now lists five.

The paragraph no longer names a stack generation. It said "Tizen RT
3.x"; the board-era vocabulary in docs/firmware-families.md is what the
rest of the project uses, and it is the part that was measured.
mbillow pushed a commit to mbillow/SmartThings-Local that referenced this pull request Nov 11, 2026
The table listed three classes and the two new ones were missing, so a
reader choosing `APPLIANCE_<n>_CLASS` had nothing to check them
against.

Each row now says what it rests on, because a captured resource map and
a descriptor that has run against the appliance are different claims.
Both new rows carry the author's own limit from PR QuiteYellow#127: the maps were
captured on a live WW11DB7B34GWU3 and a TP1X_REF_21K on 2026-07-02, and
neither descriptor has itself run against its appliance. The "Confirmed"
column is now "Status" for the same reason.

The existing Washer row is a third board, a WW11DG on
DA_WM_TP2_20_COMMON confirmed through localthings, with no descriptor
here. Now that a `washer` class exists, that row would have read as
describing it. Each row names its class to keep the two apart.

Two sentences below the table said a new appliance means a descriptor
for the localthings registry. That is still where production support
belongs, and the samples now also take one that reaches a family they
do not cover, so both routes are named. The cross-reference to "Adding
a new appliance class" pointed at a section this page does not have;
it points at the README's "Adding appliance support" instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants