Jump to content

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


  • 0

Light turing on and off fast with scene


Question

Posted

I've created two scene's one to shutdown the lights at 21:00 and in the morning turing it on at 9:00, but enabling both scripts results in turing on and off very fast and won't stopping this action, what i'm doing wrong here?

 

Scene power on at 09:00

Please login or register to see this code.

Scene turn off at 21:00

Please login or register to see this code.

Please login or register to see this attachment.

2 answers to this question

Recommended Posts

  • 0
Posted

I believe the problem is that you have the same device as  a trigger

--[[
%% autostart
%% properties
30 value
%% globals
--]]

 

Your scenes run in a loop (%% autostart) and do not need any additional trigger.

What happens that every time you're switching the light another instance of each scene executed...

Please remove the trigger (marked red above) and see what happens.

 

May I suggest instead of using scenes ( which creates instances and other unwanted side effects ) use Virtual Device main loop, which automatically executes every ~3 seconds.

Another benefit using VD , is that you can add buttons to over ride events - in your case you can create a button which can turn on or off light manually.

I have created TimeEVents VD, which executes a lot of time depended actions. No need to add more scenes for additional time events. 

See example below for your device:

Please login or register to see this code.

Example of mine additional few events
 
-- Set living room lights'  dimmer maximum value
if ( currentTime == "07:00") then
  fibaro:setGlobal("salonLightVal","50") -- value during the day
end
if ( currentTime == "17:00") then -- value during evening and night
  fibaro:setGlobal("salonLightVal","99")
end
 

-- Arm alarm at 1 AM

if ( currentTime == "01:00") then
  fibaro:startScene(jT.scene.arm)
end
  • 0
  • Inquirer
  • Posted

    Sorry for the late reply, but thanks for you post this has cleared for me how to use block scenes and got it working! I'm trying to learn Lua scripting but it's a high learning curve for me.

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...