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
dw89 8
Hi Guys,
Getting the error: ERROR: Line 25: '=' expected near tonumber on my nested IF and I don't get what's up with it. Tried various things and get same error. Basically it's just a scene to check that two motion sensors are breached, check a global, set a timer, turn light on, wait five mins, turn off light and change global so that it can start again.
Why it's not working I don't know but it's bugging me big time! Obviuosly some intricacy I'm not aware of coding wise. Any help appreciated:
--[[
%% autostart
%% properties
84 value
55 value
69 value
%% globals
--]]
local startSource = fibaro:getSourceTrigger();
if (
( tonumber(fibaro:getValue(84, "value")) > 0 )
and
( tonumber(fibaro:getValue(55, "value")) > 0 )
and
( tonumber(fibaro:getValue(69, "value")) <= 100 )
or
startSource["type"] == "other"
)
then
local _mins = 5;
local _id = 89;
local _global = fibaro:getGlobalValue("bed5LightTimer");
IF tonumber(_global) == 1 THEN
fibaro:abort();
ELSE
-- set global to '1' to prevent firing again til 5mins up
fibaro:setGlobal("bed5LightTimer", 1);
-- turn bedside light on to 75%
fibaro:call (_id, "turnOn");
fibaro:call (_id, "setValue", 75);
-- set timer for 5 minutes
fibaro:sleep = 60*1000*(tonumber(_mins));
-- turn off light;
fibaro:call (_id, "turnOff");
-- set global to '0' to allow firing again next time motion breached
global:bed5LightTimer = 0;
END;
END;
8 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.