Verlichting Woonkamer Achter On at 45% when Schemer Schakelaar Garage achter On, Off at 23:15, Manual Override

Moderator: leecollings

Post Reply
Benneton
Posts: 111
Joined: Thursday 08 December 2016 9:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Verlichting Woonkamer Achter On at 45% when Schemer Schakelaar Garage achter On, Off at 23:15, Manual Override

Post by Benneton »

Hi,

I am a NOOB on scripts and LUA, most what I wanted I have created in Blocky and that works understandable and does most what I need.

Now I have a 'problem' that I automate lights on in the living room to 45% when the dusk sensor is switched to on.
In Blocky I have this working, only thing I cannot get to work is when I use the switch to change value to i.e. 80% Blocky will put it back to 45%.

So I thought I need a way to read the value of the switch when used manual and update the default (45%) value to new set value.

So I created this in LUA:

Code: Select all

commandArray = {}

if (devicechanged['Schemer Schakelaar Garage achter'] == 'On') then
    commandArray['Verlichting Woonkamer Achter'] = 'Set Level 45'
elseif (timeofday['Nighttime'] and timeofday['Secs'] == 85500) then
    commandArray['Verlichting Woonkamer Achter'] = 'Off'
elseif (devicechanged['Verlichting Woonkamer Achter']) then
    commandArray['Verlichting Woonkamer Achter'] = 'Set Level ' .. otherdevices_svalues['Verlichting Woonkamer Achter']
end

return commandArray
Schemer Schakelaar Garage achter = the dusksensor
Verlichting Woonkamer Achter = the dimmer that turns on the lights (FIbaro FGD212 Dimmer 2+)

I get an error on the last elseif, the one that should get the value when I use the dimmer manual to set the script to this value.

Help is much appreciated and most likely not a complex problem :)

Thank you,
Bernard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest