The 3 Ampere devices are updating on a regular basic, but suddenly the script stopped to be trigger, nothing happen after 19:40 , while the 3 devices are still updated !
Feb 11 14:30:18 pi3 domoticz[722876]: 2025-02-11 14:30:18.737 dzVents: ------ Finished Consolidate-Current.lua
Feb 11 14:45:19 pi3 domoticz[722876]: 2025-02-11 14:45:19.377 dzVents: ------ Start external script: Consolidate-Current.lua: Device: "General Ampere Phase 1 (Zigbee)", Index: 96
Feb 11 14:45:19 pi3 domoticz[722876]: 2025-02-11 14:45:19.385 dzVents: ------ Finished Consolidate-Current.lua
Feb 11 15:50:19 pi3 domoticz[722876]: 2025-02-11 15:50:19.109 dzVents: ------ Start external script: Consolidate-Current.lua: Device: "General Ampere Phase 2 (Zigbee)", Index: 100
Feb 11 15:50:19 pi3 domoticz[722876]: 2025-02-11 15:50:19.117 dzVents: ------ Finished Consolidate-Current.lua
Feb 11 17:00:18 pi3 domoticz[722876]: 2025-02-11 17:00:18.762 dzVents: ------ Start external script: Consolidate-Current.lua: Device: "General Ampere Phase 2 (Zigbee)", Index: 100
Feb 11 17:00:18 pi3 domoticz[722876]: 2025-02-11 17:00:18.769 dzVents: ------ Finished Consolidate-Current.lua
Feb 11 17:10:18 pi3 domoticz[722876]: 2025-02-11 17:10:18.830 dzVents: ------ Start external script: Consolidate-Current.lua: Device: "General Ampere Phase 1 (Zigbee)", Index: 96
Feb 11 17:10:18 pi3 domoticz[722876]: 2025-02-11 17:10:18.839 dzVents: ------ Finished Consolidate-Current.lua
Feb 11 19:40:28 pi3 domoticz[722876]: 2025-02-11 19:40:28.732 dzVents: ------ Start external script: Consolidate-Current.lua: Device: "General Ampere Phase 2 (Zigbee)", Index: 100
Feb 11 19:40:28 pi3 domoticz[722876]: 2025-02-11 19:40:28.740 dzVents: ------ Finished Consolidate-Current.lua
Code: Select all
local CURRENT_PHASE1 = 'General Ampere Phase 1'
local CURRENT_PHASE2 = 'General Ampere Phase 2'
local CURRENT_PHASE3 = 'General Ampere Phase 3'
local CURRENT_CONSOLIDATE = 'General Ampere'
return {
active = true, -- Enables the script
on = {
devices = {
CURRENT_PHASE1,
CURRENT_PHASE2,
CURRENT_PHASE3
} -- Trigger on changes to the three phases
},
execute = function(domoticz, device)
domoticz.log('Script triggered by device: ' .. device.name, domoticz.LOG_INFO)
-- Retrieve the three phase devices
local phase1 = domoticz.devices(CURRENT_PHASE1)
local phase2 = domoticz.devices(CURRENT_PHASE2)
local phase3 = domoticz.devices(CURRENT_PHASE3)
if phase1 and phase2 and phase3 then
-- Log the current states of each phase
domoticz.log('Phase 1: ' .. phase1.state, domoticz.LOG_INFO)
domoticz.log('Phase 2: ' .. phase2.state, domoticz.LOG_INFO)
domoticz.log('Phase 3: ' .. phase3.state, domoticz.LOG_INFO)
-- Update the consolidated device
local consolidatedDevice = domoticz.devices( CURRENT_CONSOLIDATE )
if consolidatedDevice then
consolidatedDevice.updateCurrent(phase1.state, phase2.state, phase3.state)
else
domoticz.log('Error: Consolidated Phase device not found!', domoticz.LOG_ERROR)
end
else
domoticz.log('Error: One or more phase devices are missing!', domoticz.LOG_ERROR)
end
end
}