Anything wrong ? The script just stopped working. Looks it is not triger anymore

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
pipiche
Posts: 2009
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Anything wrong ? The script just stopped working. Looks it is not triger anymore

Post by pipiche »

I have the here after script running. It helps to consolidate in Ampere3, 3 Ampere devices.
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 !
Screenshot 2025-02-11 at 22.16.03.png
Screenshot 2025-02-11 at 22.16.03.png (70.94 KiB) Viewed 551 times
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
}
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices

If the plugin provides you value, you can support me with a donation Paypal.

Wiki is available here.

Zigbee for Domoticz FAQ
User avatar
waltervl
Posts: 5779
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Anything wrong ? The script just stopped working. Looks it is not triger anymore

Post by waltervl »

I never have seen this before. Perhaps restart Domoticz to see if that helps.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest