Page 1 of 1

Default light percentage every day

Posted: Wednesday 02 October 2019 11:21
by djdevil
Hi everyone, is there a script that every morning brings me 100% values of all dimmable lights without turning them on?

Re: Default light percentage every day

Posted: Wednesday 02 October 2019 17:04
by waaren
I don't think this is possible without a restart of domoticz. Even if you change something directly in the domoticz database , domoticz will use the value in memory when switching the light on and when you change the value in memory the light will turn on at the set dimLevel.
So by changing the value in the database (using the device.setValues(nil,'100' ) method) and a subsequent stop / start of domoticz, you might get the desired result.
[Not tested !]

Re: Default light percentage every day

Posted: Thursday 03 October 2019 12:17
by djdevil
Thx for reply I found this script on the forum and it works fine for me, how can I add more light in the same script that follow these conditions?

Code: Select all

return
{
   on =
   {
      devices = { 'Led Living' },
   },

     logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'dim based on time'
    },

   execute = function(dz, item)

        dz.log('Studio stato: ' .. item.state,dz.LOG_DEBUG)

        if item.active and item.lastUpdate.secondsAgo > 4 then 
                if dz.time.matchesRule('at 06:30-15:00') then
                    item.dimTo(20).silent()
               end
               
                if dz.time.matchesRule('at 15:00-17:00') then
                    item.dimTo(50).silent()
               end
               
                if dz.time.matchesRule('at 17:00-06:30') then
                    item.dimTo(100).silent()
               end
        elseif item.lastUpdate.secondsAgo > 4 then
            item.dimTo(0).silent()
        end
    end
}