Repository navigation
Allow commands to ask for EnableDeviceType(0) - #175
Merged
Merged
Conversation
Device type 0 is fluorescent lamp control gear, IEC 62386-201, and its application extended commands must be preceded by EnableDeviceType(0) just like those of any other device type. Command.devicetype could not express that: 0 was the value meaning "send this command on its own", so EnableDeviceType was documented as unusable for device type 0, and part 201 could not be implemented at all. Use None for "no EnableDeviceType needed" instead, which leaves every value the standard allows for the command parameter, 0 to 254, free to mean the device type it names. The devicetype parameter of from_frame follows suit, so a frame that was not preceded by EnableDeviceType no longer decodes as one that was preceded by EnableDeviceType(0). Add dali.gear.fluorescent with the one application extended command part 201 defines, QueryExtendedVersionNumber; opcodes 224 to 254 are reserved there and control gear shall not react to them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Owner
|
Ok, this looks good to me. I'll merge this and the driver change and make a simultaneous release of both packages when I get home later today. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 2 — python-dali: allow commands to ask for EnableDeviceType(0)
Open at: https://github.com/tridonic-com/python-dali/pull/new/pr-enable-device-type-0
⚠️ Breaking change — see "Downstream impact"
Base:
sde1000/python-dali:master←tridonic-com:pr-enable-device-type-0Scope: 1 commit, 7 files, +84 / −36 · independent of the other two python-dali PRs
Split out of #171 as requested.
The problem
Device type 0 is fluorescent lamp control gear, IEC 62386-201, and its
application extended commands must be preceded by
EnableDeviceType(0)like anyother type's.
Command.devicetypecould not express that:0was the valuemeaning "send this command on its own".
The consequences were baked in —
EnableDeviceTypewas documented as unusablefor device type 0, and part 201 could not be implemented at all.
The change
Nonenow means "noEnableDeviceTypeneeded". That leaves every value thestandard allows for the parameter, 0 to 254, free to mean the device type it
names.
Command.from_frame()'sdevicetypeparameter follows suit, so a frame thatwas not preceded by
EnableDeviceTypeno longer decodes as one that waspreceded by
EnableDeviceType(0)— previously indistinguishable.Adds
dali.gear.fluorescentwith the single application extended command part201 defines,
QueryExtendedVersionNumber.Downstream impact
Code passing
devicetype=0to mean "none" must passNoneinstead.In particular the drivers test
cmd.devicetypeto decide whether to prefix:against this change an unmodified driver would prefix every general command
with
EnableDeviceType(0)rather than none of them. The companiondali-driversPR makes that testis not None, and bumps itsinstall_requiresaccordingly. That PR must not merge before this one, andthis one should land in a release the drivers can require.
With both in place,
dali-drivers' existingtest_dummy_send_no_prefix_for_general_commandstill passes: a general commandhas
devicetype is None, so it is still sent on its own.Testing
pytest dali/— 133 passedmypy --strict dali/— clean, 46 filesflake8 dali— 0🤖 Generated with Claude Code
Upstream PR coordination — DT0 / EnableDeviceType(0) / firmware transfer
Replaces
sde1000/python-dali#171andsde1000/dali-drivers#8, both of whichbundled independent features. Five PRs, each standing alone.
The five
pr-device-typespr-enable-device-type-0pr-firmwaredd-enable-device-type-0dd-32bit-framesAll five:
mypy --strictclean,flake80, working tree clean, rebased ontocurrent upstream (
python-dalie2dee11,dali-driversabd1297 / 1.0a4).The three python-dali PRs are mutually independent and can be reviewed, merged
or rejected in any order. The two dali-drivers PRs are independent of each
other, but each needs its python-dali counterpart in a release, because
install_requireshas to name it.Why PR 4 must not jump the queue
The drivers decide whether to prefix by testing
cmd.devicetype. PR 2 changesthe "no prefix" value from
0toNone. Either half alone is broken:EnableDeviceType(None)before every command →ValueError: param must be an intEnableDeviceType(0)before every commandI hit the first of these while testing, which is how the dependency got pinned
down rather than guessed.
Dropped from the original PRs
8bb9d68— DT8/DT6/DT1 application-extended sequence wrappers. Rejected bysde1000, and he is right. #161 — Markus's own commit — made the drivers
auto-prefix
EnableDeviceTypefor bare commands, so trivial wrapper sequencesare redundant; #157 was the same idea, closed by its author for the same reason.
Nothing downstream used them: the HA integration already sends
QueryDimmingCurveandQueryColourTypeFeaturesbare throughdriver.send()and they work on hardware.
misc.serial/misc.trace_loggingaliases. Upstream has since movedhid.pyout ofmisc/too, so restoring aliases runs against the direction oftravel. Our integration pins
dali-drivers==0.2, which still has the old paths,so nothing breaks until it bumps — and then it should just follow the move.
6714f15— example fixup. Moot: python-dali removed its examples ince885e7. The firmware example now ships in PR 5 instead.
What changed under us mid-flight
Both upstreams moved while this was being prepared, which invalidated the first
attempt at the split:
c6b4126 → e2dee11, includingce885e7remove examples0e7581d → abd1297(1.0a2 → 1.0a4), including171c5e7HIDdriver moved to
typed/, and upstream gained its owntests/test_hid_driver.pySo the drivers changes were rebuilt against
typed/hid.py, and the new HIDtests are appended to upstream's file rather than replacing it.
Still open
sde1000/python-dali#171andsde1000/dali-drivers#8should be closed with apointer to the replacements.