Skip to content

DALI 306 - #158

Merged
sde1000 merged 1 commit into
sde1000:masterfrom
tridonic-com:306
Oct 16, 2026
Merged

sde1000 merged 1 commit into
sde1000:masterfrom
tridonic-com:306

Conversation

@markus-becker-tridonic-com

Copy link
Copy Markdown
Contributor

Add IEC 62386-306 general sensor support

Summary

Adds support for IEC 62386-306 general sensors (instance type 6): the command and event classes, the measurement-metadata queries (resolution, magnitude, unit, quantity, signedness), and the Annex A enumerations for unit of measurement and quantity name — with tests.

What's included

  • General sensor support — GeneralSensorEvent plus the Part 306 measurement-variable queries and the UnitOfMeasurement / QuantityName enumerations from Annex A, Tables A.1 and A.2.
  • Vendor-extension unit codes 55 and 56 — Table A.1 ends at 53 (parts per million), but real hardware (Tridonic sonuSense) reports codes beyond that: 55 for A-weighted sound pressure level (dB(A)) and 56 for a manufacturer-defined probability instance. These are decoded rather than surfaced as unknown values, and are clearly marked in-code as non-306 extensions so a maintainer can drop them if upstream prefers to keep the enum strictly standard.

Testing

python3 -m pytest dali/tests/ — 114 passed, including the general-sensor decoding tests.

Note for reviewers

The second commit (vendor unit codes 55/56) is intentionally kept separate from the standards-compliant support so it can be dropped independently if you'd rather not carry non-standard vendor codes in the core enum.

Comment thread dali/device/general_sensor.py
@sde1000

sde1000 commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Can you add the version of IEC 62386-306 used when writing this code to the list in the README.rst file, please?

Implement DALI part 306 general purpose input device support, including
the UnitOfMeasurement and QuantityName enums aligned with IEC 62386-306
Annex A and the DiiA Clarifications & Recommendations: DECIBEL_A (54),
GENERAL_PURPOSE_COUNTER (59) and PEOPLE_COUNTER (60).

Document the DTR0 auto-increment behavior on QueryMeasurementVariable
so callers see it where they issue the query, and note Part 306 and the
DiiA guidelines in the README references.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@markus-becker-tridonic-com

Copy link
Copy Markdown
Contributor Author

Can you add the version of IEC 62386-306 used when writing this code to the list in the README.rst file, please?

Done. I have also dropped the non-standard internal values and added DiiA clarification values. Rebased onto master.

@sde1000
sde1000 merged commit 06c0cb5 into sde1000:master Oct 16, 2026
5 checks passed
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