Default light percentage every day

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

Moderator: leecollings

Post Reply
User avatar
djdevil
Posts: 101
Joined: Friday 26 July 2019 18:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Default light percentage every day

Post by djdevil »

Hi everyone, is there a script that every morning brings me 100% values of all dimmable lights without turning them on?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Default light percentage every day

Post 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 !]
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
djdevil
Posts: 101
Joined: Friday 26 July 2019 18:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Default light percentage every day

Post 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
}  
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest