From 046764a81041bc7452dbf5a13d7a154e2a24f412 Mon Sep 17 00:00:00 2001 From: Markus Becker Date: Wed, 30 Sep 2026 12:33:32 +0200 Subject: [PATCH] Add DT8 colour and DT6 dimming-curve query sequences Add sequence helpers that wrap the application-extended queries so callers get the required EnableDeviceType prefix automatically: - QueryDT8ColourTypeFeatures and QueryDT8ColourStatus (DT8 / 62386-209) report which colour types a gear supports and which one is active. - QueryDT6DimmingCurve (DT6 / 62386-207) reports the configured dimming curve so a linear curve can be detected. Sent bare, these commands time out because the gear ignores an application-extended command without a preceding EnableDeviceType. Co-Authored-By: Claude Opus 4.8 --- dali/gear/sequences.py | 63 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/dali/gear/sequences.py b/dali/gear/sequences.py index e087e7de..73a74145 100644 --- a/dali/gear/sequences.py +++ b/dali/gear/sequences.py @@ -9,12 +9,15 @@ from dali.address import GearAddress, GearShort from dali.gear.colour import ( Activate, + QueryColourStatus, + QueryColourTypeFeatures, QueryColourValue, QueryColourValueDTR, SetTemporaryColourTemperature, StoreColourTemperatureTcLimit, ) from dali.gear.general import DTR0, DTR1, DTR2, QueryActualLevel, QueryContentDTR0 +from dali.gear.led import QueryDimmingCurve def SetDT8ColourValueTc( @@ -42,6 +45,66 @@ def SetDT8ColourValueTc( yield Activate(address) +def QueryDT8ColourTypeFeatures( + address: GearShort, +) -> Generator[command.Command, Optional[command.Response], Optional[command.Response]]: + """ + A generator sequence to query the colour type features of a DT8 control + gear (62386-209, command 249). Running it as a sequence ensures the + required "ENABLE DEVICE TYPE 8" command is sent immediately beforehand, so + the gear answers the application extended command. + + :param address: GearShort address to query + :return: The QueryColourTypeFeaturesResponse, or None if no answer + """ + # Although the proper types are expected, ints are common enough for + # addresses and their meaning is unambiguous in this context + if isinstance(address, int): + address = GearShort(address) + + return (yield QueryColourTypeFeatures(address)) + + +def QueryDT8ColourStatus( + address: GearShort, +) -> Generator[command.Command, Optional[command.Response], Optional[command.Response]]: + """ + A generator sequence to query the colour status of a DT8 control gear + (62386-209, command 248), which reports the currently active colour type. + Running it as a sequence ensures the required "ENABLE DEVICE TYPE 8" + command is sent immediately beforehand. + + :param address: GearShort address to query + :return: The QueryColourStatusResponse, or None if no answer + """ + # Although the proper types are expected, ints are common enough for + # addresses and their meaning is unambiguous in this context + if isinstance(address, int): + address = GearShort(address) + + return (yield QueryColourStatus(address)) + + +def QueryDT6DimmingCurve( + address: GearShort, +) -> Generator[command.Command, Optional[command.Response], Optional[command.Response]]: + """ + A generator sequence to query the dimming curve of a DT6 (LED) control + gear (62386-207, command 238). Running it as a sequence ensures the + required "ENABLE DEVICE TYPE 6" command is sent immediately beforehand, so + the gear answers the application extended command. + + :param address: GearShort address to query + :return: The QueryDimmingCurveResponse, or None if no answer + """ + # Although the proper types are expected, ints are common enough for + # addresses and their meaning is unambiguous in this context + if isinstance(address, int): + address = GearShort(address) + + return (yield QueryDimmingCurve(address)) + + def QueryDT8ColourValue( address: GearShort, query: QueryColourValueDTR,