mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-11-08 05:33:03 -05:00
Add a CanLight control capability rendering a single status-aware Light toggle button. The ADC2W white light is driven via CoaxialControlIO.control (Type 1, numeric IO); the button queries live state and reflects it (amber when on). To get device state to the browser, add an opt-in two-way response path to the control protocol: zmcontrol writes a JSON result back only when a request sets wants_response (fire-and-forget commands unchanged, SIGPIPE-safe); Monitor::sendControlCommandWithResponse and ajax/control.php return it. Also adds get_config/set_config/probe to Dahua_RPC for characterising cameras, the CanLight column (migration zm_update-1.39.12.sql), edit-UI checkbox, and a config unit test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
21 lines
662 B
SQL
21 lines
662 B
SQL
--
|
|
-- Add CanLight capability column to Controls (light on/off control).
|
|
--
|
|
SELECT 'Adding CanLight to Controls' AS '';
|
|
SET @s = (SELECT IF(
|
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
|
|
WHERE table_schema = DATABASE()
|
|
AND table_name = 'Controls'
|
|
AND column_name = 'CanLight') > 0,
|
|
'SELECT ''Column CanLight already exists''',
|
|
'ALTER TABLE `Controls` ADD COLUMN `CanLight` tinyint(3) unsigned NOT NULL default ''0'' AFTER `MaxWhiteSpeed`'
|
|
));
|
|
PREPARE stmt FROM @s;
|
|
EXECUTE stmt;
|
|
DEALLOCATE PREPARE stmt;
|
|
|
|
--
|
|
-- Enable the light control on the Amcrest ADC2W row.
|
|
--
|
|
UPDATE `Controls` SET `CanLight`=1 WHERE `Name`='Amcrest ADC2W RPC';
|