dzVents stops  [Solved]

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

Moderator: leecollings

Post Reply
User avatar
knasson
Posts: 32
Joined: Sunday 02 May 2021 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026-3
Location: France
Contact:

dzVents stops

Post by knasson »

Hi,
i am on domoticz v2026.1 (build 17920)
dzVents 3.1.11
why dzVents engine stops ?
No warnings
It is very ennoying because you expect the scripts running and not at all.
how to check easily the dzVents working?
The scipts are running for a long time and one day tonanother it stops unexpectedly.
as an example the script used

Code: Select all

return {
    active = true,

    on = {
        devices = { 'Garage_ouvert' }
    },

    logging = {
        level = domoticz.LOG_INFO,
        marker = 'GarageAutoClose'
    },

    execute = function(domoticz, device)

        local tempo = 60 -- secondes

        local contact = domoticz.devices('Garage_ouvert')
        local porte   = domoticz.devices('Porte_Garage')

        -- ==========================================
        -- PORTE OUVERTE
        -- ==========================================
        if contact.state == 'On' then

            domoticz.log('Garage_ouvert -> fermeture dans '..tempo..' sec', domoticz.LOG_INFO)

            -- évite les doublons si le contact se réactualise
            porte.cancelQueuedCommands()

            -- programme la fermeture
            porte.switchOn().afterSec(tempo)

        end

        -- ==========================================
        -- PORTE REFERMEE
        -- ==========================================
        if contact.state == 'Off' then

            domoticz.log('Porte refermee -> annulation fermeture auto', domoticz.LOG_INFO)

            -- annule la fermeture programmée
            porte.cancelQueuedCommands()

        end

    end
}
User avatar
gizmocuz
Posts: 3026
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: dzVents stops

Post by gizmocuz »

dzVents should always run, unless you make a endless loop.
But to check, just create a small timer that runs every minute and logs "Hello World"

The device "Garage_ouvert", is updating?

Start with a dummy switch that you can click, and later replace that for the real switch
Quality outlives Quantity!
User avatar
knasson
Posts: 32
Joined: Sunday 02 May 2021 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026-3
Location: France
Contact:

Re: dzVents stops

Post by knasson »

Yes for checking manually i push a switch and look at the result in the log.
but i want to be sure the dzVents script will work without any checking.
My garage door is open manually and i want to be sure it will close when i leave my house.

what do you mean by "Garage_ouvert" updating"?
When i start for the first time in the morning the device "Garage_ouvert" is "Off" when the door is open it moves to "On" until the scripts commands to close the door (after 120 s approx) and the device "Garage_ouvert" move to "Off" after 1 sec aprox.
User avatar
knasson
Posts: 32
Joined: Sunday 02 May 2021 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026-3
Location: France
Contact:

Re: dzVents stops

Post by knasson »

i need to make this script reliable.
this work all the day after rebooting.
i can't reboot my system every morning.
Most of time dzVents is stopped
what will be the tric to restart dzVents without rebooting or more what will be the tric to avoid it stopping ? :D
User avatar
madpatrick
Posts: 889
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2026.1
Location: Netherlands
Contact:

Re: dzVents stops

Post by madpatrick »

it is possible the scripts comes in a loop because it is waiting for 60 sec and when command come in

try this

Code: Select all

return {
    active = true,

    on = {
        devices = { 'Garage_ouvert' }
    },

    logging = {
        level = domoticz.LOG_INFO,
        marker = 'GarageAutoClose'
    },

    execute = function(domoticz, device)
        local tempo = 60 -- seconds
        local contact = domoticz.devices('Garage_ouvert')
        local porte   = domoticz.devices('Porte_Garage')

        -- ==========================================
        -- DOOR OPEN
        -- ==========================================
        if contact.state == 'On' then

            domoticz.log('Garage_ouvert -> closing in '..tempo..' seconds', domoticz.LOG_INFO)

            -- avoid duplicates if the contact refreshes again
            porte.cancelQueuedCommands()

            -- schedule closing
            porte.switchOn().afterSec(tempo)

        -- ==========================================
        -- DOOR CLOSED
        -- ==========================================
        elseif contact.state == 'Off' then

            domoticz.log('Door closed -> auto close cancelled', domoticz.LOG_INFO)

            -- cancel scheduled closing
            porte.cancelQueuedCommands()

        end

    end
}
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2026.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
User avatar
knasson
Posts: 32
Joined: Sunday 02 May 2021 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026-3
Location: France
Contact:

Re: dzVents stops

Post by knasson »

i modified yesterday as recommanded and this morning it is always running i will observe that during a while to see more..
User avatar
knasson
Posts: 32
Joined: Sunday 02 May 2021 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026-3
Location: France
Contact:

Re: dzVents stops

Post by knasson »

madpatrick wrote: Wednesday 20 May 2026 19:12 it is possible the scripts comes in a loop because it is waiting for 60 sec and when command come in

try this

Code: Select all

return {
    active = true,

    on = {
        devices = { 'Garage_ouvert' }
    },

    logging = {
        level = domoticz.LOG_INFO,
        marker = 'GarageAutoClose'
    },

    execute = function(domoticz, device)
        local tempo = 60 -- seconds
        local contact = domoticz.devices('Garage_ouvert')
        local porte   = domoticz.devices('Porte_Garage')

        -- ==========================================
        -- DOOR OPEN
        -- ==========================================
        if contact.state == 'On' then

            domoticz.log('Garage_ouvert -> closing in '..tempo..' seconds', domoticz.LOG_INFO)

            -- avoid duplicates if the contact refreshes again
            porte.cancelQueuedCommands()

            -- schedule closing
            porte.switchOn().afterSec(tempo)

        -- ==========================================
        -- DOOR CLOSED
        -- ==========================================
        elseif contact.state == 'Off' then

            domoticz.log('Door closed -> auto close cancelled', domoticz.LOG_INFO)

            -- cancel scheduled closing
            porte.cancelQueuedCommands()

        end

    end
}
Thank you it is ok ...but what is this magical tric? Explain more please....
User avatar
madpatrick
Posts: 889
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2026.1
Location: Netherlands
Contact:

Re: dzVents stops

Post by madpatrick »

he real potential problem

This line:

Code: Select all

porte.switchOn().afterSec(tempo)
is the dangerous part.

Why?

Because this does not actually mean:

"close the garage"

What it really means is:

"set Porte_Garage to ON after 60 seconds"

With many garage door controllers, ON is simply a pulse/toggle command.

So:

open → pulse = close
closed → pulse = open

That means the following scenario can happen:

The garage door opens
The timer starts
Someone closes the garage manually
After 60 seconds the script still executes switchOn()
The garage door opens again
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2026.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
User avatar
knasson
Posts: 32
Joined: Sunday 02 May 2021 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026-3
Location: France
Contact:

Re: dzVents stops  [Solved]

Post by knasson »

Any way since the change no more stopping , thank you so much
Post Reply