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


All-in-One Scene: How to do it Better


cag014

Recommended Posts

Thank you Cag04 works perfectly, i had tried trueAct=("26","startProgram","5","") and now see why it did not work.

Please login or register to see this code.

Link to comment
Share on other sites

  • 2 weeks later...

hi cag014,

How can i monitor the state of my alarm system (Armed /disarmed?). i have to check the state of a door i know that as in `side`:value=armed but how do i get AOS to check this for me ? do i set a global variable ?

 

thanks Len

Link to comment
Share on other sites

  • Topic Author
  • like this

    Please login or register to see this code.

    See an example in

    Let me know if it helps

    Edited by cag014
    Link to comment
    Share on other sites

    yes i got that but that involves the front door being opened to check dosent it? can it be monitored without opening any doors?

     

    Thanks Len

    Link to comment
    Share on other sites

  • Topic Author
  • Yes, but do you need to perform any action when it armed/disarmed or as a condition to other action?

    If you need to monitor the state and perform actions then it just a standard jM line:

    {0,"`fronDoor`",{state="armed=true",trueAct={....},falseAct={....}}},

     

     

    Link to comment
    Share on other sites

    when i am away from home i used to check whether the alarm was armed or disarmed with a scene then a popup would tell me what the state of the alarm was. If i had not armed it i could arm it using a fibaro widget on my phone.

    hope that makes sense?

     

    Len

     

    Link to comment
    Share on other sites

  • Topic Author
  • Yes,

    So the jM line I posted suits your needs, right?

    Link to comment
    Share on other sites

    hi cag014,

    me again :)

     

    i wish to set a global variable TOD at sunrise to light and at (sunset - one hour) to dark how do i do that?

     

    Thanks

    Len

     

    Link to comment
    Share on other sites

  • Topic Author
  • It could be done in several option.

    I suggest to create blank keyword name "$timer" and use it for any time-based actions executions.

    So,

    define new keyword in

    userKeyWord={{"$timer","$HC2onLine","$dayTime"},
    {"",function() return tostring(api.get("/settings/info")["online"]) end,
     function() return  os.date("*t",os_time()).hour<6 and "Good night," or os.date("*t",os_time()).hour<12 and "Good morning," or os.date("*t",os_time()).hour<18 and "Good afternoon," or os.date("*t",os_time()).hour<=23 and "Good evening," end }}

     

    Now add new line to jM{}

     {0,"$timer",{timeSlot="$sunriseHour~,?$sunsetHour-3600?~",
          trueAct={{"TOD","setGlobal","Light","{$24clock:value=$sunriseHour}"},{"TOD","setGlobal","Dark","{$24clock:value=?$sunsetHour-3600?}"}}}},

     

    in future just add more and more actions

     

    Link to comment
    Share on other sites

    2 hours ago, cag014 said:

    It could be done in several option.

    I suggest to create blank keyword name "$timer" and use it for any time-based actions executions.

    So,

    define new keyword in

    userKeyWord={{"$timer","$HC2onLine","$dayTime"},
    {"",function() return tostring(api.get("/settings/info")["online"]) end,
     function() return  os.date("*t",os_time()).hour<6 and "Good night," or os.date("*t",os_time()).hour<12 and "Good morning," or os.date("*t",os_time()).hour<18 and "Good afternoon," or os.date("*t",os_time()).hour<=23 and "Good evening," end }}

     

    Now add new line to jM{}

     {0,"$timer",{timeSlot="$sunriseHour~,?$sunsetHour-3600?~",
          trueAct={{"TOD","setGlobal","Light","{$24clock:value=$sunriseHour}"},{"TOD","setGlobal","Dark","{$24clock:value=?$sunsetHour-3600?}"}}}},

     

    in future just add more and more actions

     

    as always perfect!

    thanks a lot

     

    Link to comment
    Share on other sites

    hi CAG014,

    how do i add a line to JM{} to interrogate the contents of a global variable TOD and act on its value? the result will be a string

     

    thanks

    Len

    Link to comment
    Share on other sites

  • Topic Author
  • (0,"&TOD",{state="value=<str_vallue>",trueAct={..},falseAct={...}, tirgAct={..}}},

     

    add any needed action...

    Link to comment
    Share on other sites

    hi Cag014,

    trying to use the global TOD in the line below get an error message

    [DEBUG] 20:10:07: 2020-02-21 20:10:07.516380 [ fatal] Unknown exception: /opt/fibaro/scenes/405.lua:54: unexpected symbol near '}'

     

     

    the line i used is:-

    0,"&TOD",{state="value=<dark>",trueAct={"message","setGlobal","Global variable is dark ",}}},

     

    if i remove the line all is ok so know its my fault somewhere on this line!

    i checked the TOD global and it is set to dark

     

    Link to comment
    Share on other sites

    hi Cag014

     

    just writing my house alarm scene to add to AOS, how do i reproduce sleep(50) in a JM{} line.

     

    eg

    fibaro:call(50,"turnOn")

    fibaro:sleep(50)

    fibaro:call(50,"turnOff)

     

    Thanks

    Len

    Link to comment
    Share on other sites

  • Topic Author
  • this is the 3rd parameter in commands.

    Please login or register to see this code.

    By the way the value should be in seconds.

    Edited by cag014
    Link to comment
    Share on other sites

    hi cag014,

    i want to set a global variable when (a= true and b=true and c= false) how do i code that please?

     

    the scenario is needed to check that door a is shut,door b is shut , and roller shutter door c is in correct position before arming alarm,

     

    Thanks

    Len

    Link to comment
    Share on other sites

  • Topic Author
  • Like that

    Please login or register to see this code.

    In addition if you're using this condition a lot, you can set them as a group in
     

    Please login or register to see this code.

     

    Edited by cag014
    Link to comment
    Share on other sites

    hi cag014,

     

    Please login or register to see this code.

    does this equate to a= true,b=true,c=false? or does this say a,b,c are all false?

    Thanks 

    Len

    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
    Reply to this topic...

    ×   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...