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

Probably a really stupid question... sorry


tvs
 Share

Question

Hi, 

After many years using a HC2 I've now moved into a new house and have a HC3.

 

I was pretty okay at LUA on HC2 but i'm completely lost now on HC3.

 

My stupid question:

I have a few scenes that set the indoor lights, I also want these scenes to switch the outdoor lights on, only if its night. So I've set a variable isitnight and I thought I could create a block scene which checks this variable, ifitsnight = 1 then switch on the lights. Problem is its just not working, in either block scene or LUA.

 

Please see attached screen shot and LUA below. Any help would be much appreciated.

 

thanks

 

tom

 

{
  conditions = { {
      isTrigger = false,
      operator = "==",
      property = "isitnight",
      type = "global-variable",
      value = "1"
    } },
  operator = "all"
}
 
fibaro.call({[1] = 147, [2] = 162, }, 'setValue'100)
fibaro.call(189'turnOn')

Please login or register to see this attachment.

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • thanks for the fast reply!

     

    I dont want it to trigger the lights to switch on though, I want to run this scene from another scene (So that will effectively be the trigger) does that make sense?

    Link to comment
    Share on other sites

    • 0

    if you run the scene manually it will run?

    so the other scene has a command run thos scene? please show screenshot.

     

    other thing you can do:

    create new var: outsidelights on and off (or 1 and 0)

    remove the start scene in youre other scene

    add set var outsidelights to on (or 1)

     

    change the other scene

    the var you had to outsidelights is on (or 1)

    and tick the trigger box, the it must work

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • So basically I have a scene called Cozy which sets various indoor lights. If i run that scene in the day i dont want it to switch the outdoor lights on. But if I run it at night I want them on.

     

    In the past (HC2) I just made a scene called outsidelight which checked a global variable called isitnight, and if isitnight = 1 then it would switch the outside lights on. It worked really well as i could run the outsidelight scene from a few different scenes

     

    attached is a screen shot of cozy, and isitnight.

     

    thanks

     

    tom

     

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    if cozy is a block scene on it's own, it has no trigger so it will never run

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • cozy is a block scene that i run from the app, ir with google assistant 

    so cozy works well, the problem is that the outside lights come on regardless of the time of day, its almost like its not chekcing the variable 

    Link to comment
    Share on other sites

    • 0

    i'm having toubles to see the whole picture

     

    so cozy is run manually and starts the garden lights scene? that should be set var to 1, because that will trigger that scene

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Sorry I've not been clear.

     

    these are the scenes i have:

    • a scene which sets the isitnight variable to 1 when its 60min after sunset.
    • a scene which sets the isitnight variable to 0 at sunrise
    • Cozy which switches a load of indoor lights on, and runs my garden Lights v1 cozy is alweays trigged via the app or google
    • garden Lights v1 which checks the isitnight variable, andf if its 1 then switches the outside lights on.

     

    The problem i have is that garden Lights v1 doesnt check the variabvle and seems to justr switch the lights on regardless.

     

    hope thats clearer

     

    Link to comment
    Share on other sites

    • 0
    15 minutes ago, akatar said:

    i'm having toubles to see the whole picture

     

    so cozy is run manually and starts the garden lights scene? that should be set var to 1, because that will trigger that scene

    That is correct, run a scen will always run that scene without checking trigger.

    thats's why change it to this

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • sorry change it to what?

     

    Link to comment
    Share on other sites

    • 0
    33 minutes ago, akatar said:

    if you run the scene manually it will run?

    so the other scene has a command run thos scene? please show screenshot.

     

    other thing you can do:

    create new var: outsidelights on and off (or 1 and 0)

    remove the start scene in youre other scene

    add set var outsidelights to on (or 1)

     

    change the other scene

    the var you had to outsidelights is on (or 1)

    and tick the trigger box, the it must work

    remove the start scene block, and let the other scene trigger on a variable

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • sorry for being dumb, what do you mean with " remove start scene block":

    Link to comment
    Share on other sites

    • 0

    you have a start scene block, so the scene will always start. and that is not what you want

     

    18 minutes ago, tvs said:

     

     

    The problem i have is that garden Lights v1 doesnt check the variabvle and seems to justr switch the lights on regardless.

     

     

     

     

    Link to comment
    Share on other sites

    • 0

    Hi tvs,

     

    I think what you're trying to do doesn't work with manually started block scene. Starting a scene from another scene is a manual scene start. When a block scene is started manually it only runs the actions and does not check the conditions.

    If you need to check conditions with a manual started scene start you need LUA. There the conditions can be checked in the LUA code (action window). Try the LUA scene below for 'Garden Lights v1'. Since you used LUA on HC2 you know how it works.

     

    Condtions:

    {}
     
    Actions:
    if fibaro.getGlobalVariable("ItisNight") == "1" then
        print('it is night, lights on')
        fibaro.call({[1] = 147, [2] = 162, }, 'setValue', 100)
        fibaro.call(189, 'turnOn')
    else
        print('it is day, so no lights on')
    end
     
    Hope this helps you to get the Cozy lights on at night 😉
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks to both of you! the LUA above works perfectly and makes sense based on the HC2. 

    I just need to get my head around the new split screen LUA coding setup.

     

    Thanks!

     

    tom

     

     

    Link to comment
    Share on other sites

    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.

     Share

    ×
    ×
    • Create New...