Page 1 of 1
Return to previous brightness value
Posted: Friday 25 September 2020 16:43
by eleutscher
Hello
Is it possible in Blocky (or scripting) to set the brightness of a lamp that is already on at 25% to 80% for x minutes and after this time to set it back to its previous value at 25%?
Is there a entry that saves the previous value so that you can use this again?
Thx, Erik
Re: Return to previous brightness value
Posted: Friday 25 September 2020 17:03
by waaren
eleutscher wrote: ↑Friday 25 September 2020 16:43
Is it possible in Blocky (or scripting) to set the brightness of a lamp that is already on at 25% to 80% for x minutes and after this time to set it back to its previous value at 25%?
Is there a entry that saves the previous value so that you can use this again?
I would not know how to do this in Blockly but it is possible to restore the brightness to a previous state using dzVents. What would trigger the Brightness increase and what is the condition for it to return to the previous state ?
Re: Return to previous brightness value
Posted: Monday 28 September 2020 19:44
by eleutscher
Hai Waaren,
For example. I have my outside lights at 25% brightness and I would like them to go to 100% for 5 minutes after a PIR gets triggered or another event/button. After the 5 min they have to back to the 25%. But I do not want to think about what their previous value was. Just the value before the event. Hope you can help. Thx, Erik
Re: Return to previous brightness value
Posted: Monday 28 September 2020 20:45
by waaren
eleutscher wrote: ↑Monday 28 September 2020 19:44
I have my outside lights at 25% brightness and I would like them to go to 100% for 5 minutes after a PIR gets triggered or another event/button. After the 5 min they have to back to the 25%. But I do not want to think about what their previous value was.
Can you try with below dzVents script?
When not yet familiar with dzVents please start with reading
Get started Before implementing (~ 5 minutes). Special attention please for "In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents enabled' is checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."
Code: Select all
return
{
on =
{
devices =
{
'PIR', -- change to name of PIR or other triggering device
},
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR when all ok
marker = 'restore brightness',
},
execute = function(dz, item)
if item.active then
local light = dz.devices('outside light') -- change to name of light
local currentLevel = ( light.active and light.level ) or 0
light.cancelQueuedCommands()
light.dimTo(100)
light.dimTo(currentLevel).afterSec(300)
end
end
}
Re: Return to previous brightness value
Posted: Tuesday 10 November 2020 11:27
by eleutscher
Hai Waaren, Thanks for your reply and this seems to work.
But I have multiple outside light with corresponding values. Is it possible to extend this script for let's say 5 lights? With light 1 has an initial level of 25 and light 2 an level of 40 ad light 3 can only be on or off, etc.
I hope you understand this and can help me with this.
Re: Return to previous brightness value
Posted: Tuesday 10 November 2020 12:40
by waaren
eleutscher wrote: ↑Tuesday 10 November 2020 11:27
I have multiple outside light with corresponding values. Is it possible to extend this script for let's say 5 lights? With light 1 has an initial level of 25 and light 2 an level of 40 ad light 3 can only be on or off, etc.
Please try with below script
Code: Select all
return
{
on =
{
devices =
{
'PIR', -- change to name of PIR or other triggering device
},
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR when all ok
marker = 'restore brightness',
},
execute = function(dz, item)
local DIMMER = 1
local SWITCH = 2
local delay = 300
local lights =
{ -- name, TYPE
['outside light'] = DIMMER, -- Change to your device names and add the type of devices
['outside light2'] = DIMMER,
['outside light2'] = SWITCH,
}
if item.active then
for name, type in pairs(lights) do
local light = dz.devices(name)
light.cancelQueuedCommands()
if type == DIMMER then
local currentLevel = ( light.active and light.level ) or 0
light.dimTo(100)
light.dimTo(currentLevel).afterSec(delay)
elseif type == SWITCH then
if light.state == 'Off' then
light.switchOn()
light.switchOff().afterSec(delay)
end
else
dz.log(name .. ' Has an unknown type: ',dz.LOG_ERROR)
end
end
end
end
}
Re: Return to previous brightness value [Solved]
Posted: Tuesday 10 November 2020 13:07
by eleutscher

Yep, this is working! Thx @waaren