Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team

Question
sarf77 11
Hi all,
I am trying to incorporate a previous state into a lua lighting scene.
For example, if I trigger the scene, it takes reference of the current state of relay ID 81 and also 'value' of Dimmers ID 114 and 109 .
Scene will then call Relay54 'turnOn' and Dimmer 114 setValue 10 and 109 to 'setvalue', 100
I then wish to return those two loads to their previous state or level after 15 mins.
Could somebody please help with this code. Dimmers are behaving properly (ID 114 and 109) but I'm having troubles with value, set value etc for the relay.
At the end of the scene, the relay 54 stays turned on even if it was off before.
%% properties
%% events
%% globals
--]]
local dining
local garage
local backyard
dining = tonumber (fibaro:getValue (114, 'value'));
fibaro:setGlobal ('dining', dining);
fibaro:debug ("dining level set")
fibaro:debug (dining)
backyard = tonumber (fibaro:getValue (109, 'value'));
fibaro:setGlobal ('backyard', backyard);
fibaro:debug ("backyard level set")
fibaro:debug (backyard)
garage = tonumber ( fibaro:getValue(54, "value"));
fibaro:setGlobal ('garage', garage);
fibaro:debug ("garage level set")
fibaro:debug (garage)
fibaro:call(114, 'setValue', '10');
fibaro:call(109, 'setValue', '100');
fibaro:call(54, 'turnOn');
fibaro:debug ("all lights on from scene activation")
fibaro:debug ("I will now wait 20 seconds")
fibaro:sleep (20000);
fibaro:debug ("wait over set all lights back to previous levels")
fibaro:call(114, 'setValue', dining );
fibaro:call(109, 'setValue', backyard );
fibaro:call(54, 'setValue', garage );
fibaro:debug ("all lights back to previous levels")
Edited by sarf778 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.