Dali2 input device events - #25029
Open
murfett-au wants to merge 2 commits into
Open
murfett-au wants to merge 2 commits into
murfett-au wants to merge 2 commits into
Conversation
Input devices such as push buttons (IEC 62386-301), occupancy sensors
(303) and light sensors (304) communicate with 24-bit event messages.
Tasmota logged these frames at log level 4 and discarded them, so it
could not react to any DALI-2 switch or sensor on the bus.
Decode the 24-bit frame according to the five IEC 62386-103 addressing
schemes and publish the result for rules and MQTT, for example
{"DALI":{"Event":"0x82840B","Scheme":"Instance","Type":1,"Instance":1,
"Info":11,"Name":"LongPressRepeat"}}
Push button events carry the part 301 event name, occupancy events the
Movement/Occupied/Repeat/Sensor flags and light sensor events the
Illuminance value. 24-bit frames with bit 16 set are commands from
another application controller and are ignored.
Tested with a zencontrol zc-switch rotary on an ESP32-S3-Pico with the
Waveshare Pico-DALI2, driving one channel of a DA4-T DT6 driver via
rules.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Control devices (IEC 62386-103) such as push buttons and sensors are
addressed with 24-bit frames and have their own short address space,
separate from control gear. Until now they could only be commissioned
by hand with raw DaliSend255 frames.
Add DaliDeviceScan 1|2[,<max_count>] which assigns short addresses using
the 24-bit INITIALISE / RANDOMISE / COMPARE / PROGRAM SHORT ADDRESS
sequence. The existing binary search used by DaliScan is shared through
a device flag so control gear commissioning is unchanged. Mode 2 probes
the bus first so addresses already in use are never reassigned.
Add DaliDevice which lists addressed control devices, reports one
device's version, status and instances (type, enabled, event scheme),
and sets the event scheme of all its instances, for example
{"DaliDevice":{"Device":1,"Version":"2.0","Status":0,"Instances":[
{"Instance":0,"Type":1,"Name":"PushButton","Enabled":1,"Scheme":"Instance"}]}}
Input devices default to the Instance event scheme which carries no
short address, so DaliDevice <device>,2 switches them to DeviceInstance
events that identify the sending device.
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.
Description:
Related issue (if applicable): n/a
Second of three DALI-2 input device changes. Depends on #1 (event message decoding); review only the last commit until that merges.
DALI-2 control devices (IEC 62386-103) such as push buttons, occupancy and light sensors use 24-bit frames and have their own short address space, separate from control gear. Until now they could only be commissioned with raw
DaliSend255frames.New commands
DaliDeviceScan 1|2[,<max_count>]assigns short addresses with the 24-bit INITIALISE / RANDOMISE / COMPARE / PROGRAM SHORT ADDRESS sequence. Mode 1 clears all control device short addresses first. Mode 2 probes the bus and only addresses devices without one, so existing addresses are never reused. Returns the number assigned, likeDaliScan.DaliDevicelists control devices that answer on short addresses 1..64, in the same form asDaliGear.DaliDevice <device>reports version, status and each instance's type, enabled flag and event scheme.DaliDevice <device>,<scheme>sets the event scheme on all instances of a device (0 = broadcast). Input devices default to the Instance scheme, which carries no short address, so scheme 2 (DeviceInstance) is what makes commissioning useful: every event then identifies the device that sent it.Implementation notes
DaliScangained adeviceflag defaulting to false, so control gear commissioning is unchanged.Tested with: zencontrol zc-switch rotary (3 push button instances) on an ESP32-S3-Pico with the Waveshare Pico-DALI2. Sequence:
Backlog DaliDeviceScan 1; DaliDevice; DaliDevice 1; DaliDevice 1,2, then confirmed rotation events arrive with"Scheme":"DeviceInstance"and anAddressfield.Documentation for the Commands section of
docs/DALI.mdwill follow in tasmota/docs.Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass