Page 1 of 1

date + Hour no work (Resolved)

Posted: Thursday 06 June 2019 10:45
by Hydci
Hello,

My dzvent no work i can not find the problem if anyone could help me

Ps: i'm french my english is no good

Code: Select all

return {
    on = { devices = { 'Capteur Toilette','Interrupteur Toilette','Toilette1'},
        timer = {'at 21:00-07:59','at 08:00-20:59'}
        },
	
	execute = function(domoticz, timer, item, device)
	   if item.state == "Open" or item.state == "Click" and domoticz.time.matchesRule('at 21:00-07:59') then
	       domoticz.devices("Toilette1").dimTo(15)
    end
    if item.state == "Open" or item.state == "Click" and domoticz.time.matchesRule('at 08:00-20:59') then
        domoticz.devices("Toilette1").dimTo(99)
        domoticz.devices("Toilette2").switchOn()
    end
    if item.state == "Open" or item.state == "Click" and domoticz.devices('Toilette1') == 'On' then
        domoticz.devices("Toilette1").switchOff()
        domoticz.devices("Toilette2").switchOff()
        end
end
}

Re: date + Hour no work

Posted: Thursday 06 June 2019 11:23
by waaren
Hydci wrote: Thursday 06 June 2019 10:45 My dzVents no work i can not find the problem if anyone could help me
Not 100% sure if this is what you want but please try.

Code: Select all

return {
        on = 
        { 
            devices = { 'Capteur Toilette', 'Interrupteur Toilette', 'Toilette1' },
        },

        logging =
       {
            level   =   domoticz.LOG_DEBUG,
            marker  =   'Toilette control',
       },

    execute = function(dz, item )
        Toilette1 = dz.devices('Toilette1')
        Toilette2 = dz.devices('Toilette2')
      

        if item.state == 'Open' or item.state == 'Click' then
            if Toilette1.state == 'On' then
                Toilette1.switchOff().silent()
                Toilette2.switchOff().silent()
            elseif dz.time.matchesRule('at 21:00-07:59') then
                Toilette1.dimTo(15).silent()
            else
                Toilette1.dimTo(99).silent()
                Toilette2.switchOn().silent()
            end
        end
    end
}

Re: date + Hour no work  [Solved]

Posted: Thursday 06 June 2019 11:37
by Hydci
the script works great thanks for your help i understand better how i should write my next script