Page 1 of 1

dzVents script shows strange behavior

Posted: Tuesday 08 June 2021 12:45
by Fredom
Dear members
The script below has always worked fine, but it stopped working a week ago.
The script only switches On both during the day and at night.
When I switch the lines nighttime and daytime, the script only switches Off.
How is this possible? Restoring from a backup didn't help either.

Code: Select all

--isDonker (Dummy switch) dzVentz
--Nighttime dummy switch is on (check every xx minutes)
--Daytime dummy switch is off (check every xx minutes)
--After a power failure or reset the dummy always comes back in the right position

return 
{
	active = true,
	
	on = {
		timer = {
         'every 2 minutes at daytime',
         'every 2 minutes at nighttime'
		}
	},
	execute = function(domoticz, device, triggerInfo)
	    local donker = domoticz.devices('isDonker')
                        
	    if (triggerInfo.trigger == 'every 2 minutes at nighttime')
	    then
		    donker.switchOn().checkFirst()		 
		    domoticz.log('isDonker device is switched ON by dzVentz scripts TRIGGER 1');
		elseif (triggerInfo.trigger == 'every 2 minutes at daytime')
		then
		    donker.switchOff().checkFirst()
		    domoticz.log('isDonker device is switched OFF by dzVentz scripts TRIGGER 2');
	end
end
}

Re: dzVents script shows strange behavior

Posted: Thursday 10 June 2021 15:21
by Fredom
None of the members who can solve this problem for me??

Re: dzVents script shows strange behavior

Posted: Thursday 10 June 2021 15:49
by waltervl
Did you upgrade? On what version of Domoticz are you now? Still on 2020.2 as your profile is saying?

Re: dzVents script shows strange behavior

Posted: Thursday 10 June 2021 16:29
by Fredom
waltervl wrote: Thursday 10 June 2021 15:49 Did you upgrade? On what version of Domoticz are you now? Still on 2020.2 as your profile is saying?
Thanks for your response.
Domoticz 2021-1 runs on a Rapberry pi 3b.
Nothing has been changed in the script or in any other configuration.
A week ago this script suddenly showed this behavior

Re: dzVents script shows strange behavior

Posted: Thursday 10 June 2021 18:01
by waaren
Fredom wrote: Thursday 10 June 2021 16:29 [Domoticz 2021-1 runs on a Rapberry pi 3b. Nothing has been changed in the script or in any other configuration.
A week ago this script suddenly showed this behavior
Was that before or after the update to 2021.1 ?

Can you have a look at this one ?

Code: Select all

return
{
    on =
    {
        timer =
        {
         'every 2 minutes',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'donker',
    },

    execute = function(dz)
        local astroSwitch = dz.devices('isDonker')
        local isDark = astroSwitch.state == 'On'
        local isLight = not(isDark)

        if dz.time.isNightTime and isDark  then
            astroSwitch.switchOn()
            dz.log('isDonker device is switched ON by dzVents scripts TRIGGER 1' , dz.LOG_DEBUG)
        elseif dz.time.isDayTime and isLight then
            astroSwitch.switchOff()
            dz.log('isDonker device is switched OFF by dzVents scripts TRIGGER 2' , dz.LOG_DEBUG)
        end

        dz.utils.dumpTable(dz.time)
        dz.log('dayTime in domoticz.time: ' .. tostring(dz.time.isDayTime) .. ' ; isDark in domoticz switch: ' .. tostring(isDark), dz.LOG_DEBUG )

    end
}

Re: dzVents script shows strange behavior

Posted: Thursday 10 June 2021 18:52
by Fredom
waaren wrote: Thursday 10 June 2021 18:01
Fredom wrote: Thursday 10 June 2021 16:29 [Domoticz 2021-1 runs on a Rapberry pi 3b. Nothing has been changed in the script or in any other configuration.
A week ago this script suddenly showed this behavior
Was that before or after the update to 2021.1 ?

Can you have a look at this one ?

Code: Select all

return
{
    on =
    {
        timer =
        {
         'every 2 minutes',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'donker',
    },

    execute = function(dz)
        local astroSwitch = dz.devices('isDonker')
        local isDark = astroSwitch.state == 'On'
        local isLight = not(isDark)

        if dz.time.isNightTime and isDark  then
            astroSwitch.switchOn()
            dz.log('isDonker device is switched ON by dzVents scripts TRIGGER 1' , dz.LOG_DEBUG)
        elseif dz.time.isDayTime and isLight then
            astroSwitch.switchOff()
            dz.log('isDonker device is switched OFF by dzVents scripts TRIGGER 2' , dz.LOG_DEBUG)
        end

        dz.utils.dumpTable(dz.time)
        dz.log('dayTime in domoticz.time: ' .. tostring(dz.time.isDayTime) .. ' ; isDark in domoticz switch: ' .. tostring(isDark), dz.LOG_DEBUG )

    end
}
Hi Waaren,
This is indeed after the Domoticz update. I think this script still worked after that, but I'm not sure.
Unfortunately your proposal script doesn't work either. If I manually turn on the isDark switch, it stays on and won't turn off.

Re: dzVents script shows strange behavior

Posted: Thursday 10 June 2021 20:59
by Fredom
waaren wrote: Thursday 10 June 2021 18:01
Fredom wrote: Thursday 10 June 2021 16:29 [Domoticz 2021-1 runs on a Rapberry pi 3b. Nothing has been changed in the script or in any other configuration.
A week ago this script suddenly showed this behavior
Was that before or after the update to 2021.1 ?

Can you have a look at this one ?

Code: Select all

return
{
    on =
    {
        timer =
        {
         'every 2 minutes',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'donker',
    },

    execute = function(dz)
        local astroSwitch = dz.devices('isDonker')
        local isDark = astroSwitch.state == 'On'
        local isLight = not(isDark)

        if dz.time.isNightTime and isDark  then
            astroSwitch.switchOn()
            dz.log('isDonker device is switched ON by dzVents scripts TRIGGER 1' , dz.LOG_DEBUG)
        elseif dz.time.isDayTime and isLight then
            astroSwitch.switchOff()
            dz.log('isDonker device is switched OFF by dzVents scripts TRIGGER 2' , dz.LOG_DEBUG)
        end

        dz.utils.dumpTable(dz.time)
        dz.log('dayTime in domoticz.time: ' .. tostring(dz.time.isDayTime) .. ' ; isDark in domoticz switch: ' .. tostring(isDark), dz.LOG_DEBUG )

    end
}
Hi Waaren,
I tested the script with a backup of domoticz 20.2 and there it works as intended.
It also works well when I switch the lines between daytime and nighttime.
So it has indeed to do with the new update of domoticz. Can this still be solved?

Re: dzVents script shows strange behavior

Posted: Thursday 10 June 2021 22:56
by waaren
Fredom wrote: Thursday 10 June 2021 20:59 So it has indeed to do with the new update of domoticz. Can this still be solved?
Fixed in 2021.1 - build 13192
Please check this post for hotfix in stable.

Re: dzVents script shows strange behavior

Posted: Friday 11 June 2021 22:13
by Fredom
waaren wrote: Thursday 10 June 2021 22:56
Fredom wrote: Thursday 10 June 2021 20:59 So it has indeed to do with the new update of domoticz. Can this still be solved?
Fixed in 2021.1 - build 13192
Please check this post for hotfix in stable.
Hi Waaren,
Thanks for the tip.
The problem is solved.