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

Many users have downloaded All-in-One Scene and I believe there are some questions about usage.

The purpose of this topic is to help to get most of  All-in-One Scene , to share best ideas/actions and solutions.

Please feel free to ask any scene's related question and I'll share my best solution with you.

 

 

 

 

Edited by cag014
Link to comment
Share on other sites

  • Topic Author
  • Here a question I have been asked:

    @AR27690

    I have 5 external doors at my home and I want to turn ON Red light (in my living room) if one of the doors is open.

    Could you suggest the best option to do it?

    @cag014

    There are a few options to do it and I'm not sure if my suggestion is the best. It depends on personal logic.

    Here is my suggestion (including TTS "Door closed" please remove it if you don't have TTS or no need)

    define at jS2n table your doors device IDs

    jS2n={door1=100, door2=200,door3=300,door4=400,door5=500, redLight=600}

    jM={0, "`doo1r`|`door2`|`door3`|`door4`|`door5`",{state="value=true",trueAct={"`redLight`","turnOn",""},

    falseAct={{"|`redLight`|","turnOff","","{`door1`:value=false|`door2`:value=false|`door3`:value=false|`door4`:value=false|`door5`:value=false}"},

    {"","tts","Doors closed","{`door1`:value=false|`door2`:value=false|`door3`:value=false|`door4`:value=false|`door5`:value=false}"}}}}

    In general when any door opens, red light turns ON, if door closed and all other door are closed, red light turns OFF and TTS announce "Door closed"

    Of course it could be done by using variable or using trigAct{} table and etc.

     

    @AR27690

    Thanks, works fine.

    Could you post solution using variable also? For Education purpose

    @cag014

    Here is it:

    1. define variable iDoor and set gVarName as system predefind global variable (in this example global variable name is "aosGlobal". iDoor init value is alway =0.(On scene startup)

    Please login or register to see this code.

    2. Copy following action lines:

    Please login or register to see this code.

    In general:

    On startup initAct{} will set iDoor value accrding to doors state.

    When door opened global variable iDoor=iDoor+1, when closed iDoor=iDoor-1.

    If iDoor >0 then turn ON red light, if iDoor=0 then turn OFF red light.

    Link to comment
    Share on other sites

  • Topic Author
  • How to turn garden lights ON at sunset + 1 hour and OFF at sunrise+ 1hour

    Here few options to perform it:

    Solution 1

    Please login or register to see this code.

    trigAct executed on every change of $24clock (every minute) and according to conditions will execute ON or OFF . The state value doesn't mean anything.

    On scene startup, garden lights will be set to correct value  within a minute.

    After manual interaction (On or Off), scene will return garden lights back to correct state within a minute.

    Solution 2

    Please login or register to see this code.

    According to timeSlot, at sunset + 3600, trueAct  executed and turns lighs ON.

    timeSpanOn=true, keeps the line in loop every 10 minutes either if state status is true or false. Normally timeSpan loop works only if state status is true. Now every 10 minutes timeLoopAct executed, but the conditions are, if current time ($24clock) is greater than sunrise+1 hour and less than sunset, turnOff the lights. So the lights will be turned OFF ± 10 minutes after sunrise +1 hour.

    When ever you will start the scene, during initializing if lights OFF trueAct will be executed. if lights ON and time over sunrise + 3600, within 10 minutes, lights will be turned OFF

    If someone manually turns lights OFF during (sunset +3600 ~ sunrise + 3600), it will be turned ON immediately.

    If someone manually turns lights ON during (sunrise +3600 ~ sunset), it will be turned OFF within 10 minutes.

     

    Solution 3

    Please login or register to see this code.

    Simply turn On light at sunset+3600 and turn OFF at sunrise+3600. Manual interaction won't be overridden by scene, means

    if someone turns light Off it will stay Off till following sunset+3600. if someone turns light On it will stay On till following sunrise+3600.

     

    At sunset+3600 execute trueAct - turnOn, at sunrise+3600 execute falseAct - turnOff

    trueAct and falseAct will not be executed during initialization and on startup the lights will stay at same condition, no change by the scene.

    Edited by cag014
    Link to comment
    Share on other sites

    Hello cag014,

     

    first thank you for this  scene.? Also your output in the debug window are very helpful to analyse my mistakes. The greatest challenge for me is to put the right amount of " ` $ _ [... on the right place ?

     

    Actual I fight with the Notification Control ( pushnote) Here I don't find the right code.

     

    Example:

    {0, "730",{state="value=true",trueAct={"Test","sendPush[,574]","Light XY On"}}},

    730 = Walli Dimmer

    574 = Phone ID of my Android mobile

    I tried:

    sendPush,574; sendPush,[574] everything leads to a different error. Sometimes you covered it:

    Please login or register to see this spoiler.

     

     Perhaps my fail is a little tiny letter on an other place. Maybe someone else can help.

     

    Thank you for the code you share with the community ?

     

    Link to comment
    Share on other sites

  • Topic Author
  • it should be

    {0, "730",{state="value=true",trueAct={"Test","sendPush,574","Light XY On"}}},

     

    Link to comment
    Share on other sites

    Hello,

     

    thank you for the reply. I have change the code and the scene starts without a error. But after that I change the ID to another ID and now I get always this error:

     

    Please login or register to see this spoiler.

     

    But it can be I have changed some other code. I will delete some of the added code.

    Link to comment
    Share on other sites

  • Topic Author
  • Interesting...  device with no name? Are you sure about device ID? looks like it's not exist in the system

    could you please post device data?

    execute in browser http://hc2/api/devices/devID

     

    Edited by cag014
    Link to comment
    Share on other sites

    OK The error comes not from the code for the push.

    Please login or register to see this code.

    {0, "`WPFernseherWZ`",{state="power>10",trueAct={"`VDVSLSidekick`","pressButton,14",""}}},

     

    Device is a WP for TV when switched on (>10W) the State for the light should change to TV light scene.

    trueAct is a VD to switch Sankotronics VSL VD to TV State perhaps it's the name "VSL Sidekick v1.0b6" that is responsible for the error (letter ".")

     

    I rename it and test again. Thanks for the hint.

    Link to comment
    Share on other sites

    • 2 weeks later...

    Hello. My AOS scene does not start automatically with the HC2 booting after a power outage.

    I have not changed anything below "do not change" and it is set to "Run scene: automatic"

    Link to comment
    Share on other sites

  • Topic Author
  • 4 hours ago, storskogen said:

    Hello. My AOS scene does not start automatically with the HC2 booting after a power outage.

    I have not changed anything below "do not change" and it is set to "Run scene: automatic"

    By default the scene won't run automatically. It's user depended configuration.

    Please add autostart definition at scene's header, see below.
    --[[

    %% autostart
    %% properties
    %% weather
    Temperature
    Humidity
    Wind
    WeatherCondition
    --]]

     

     

    Link to comment
    Share on other sites

    • 5 weeks later...
  • Topic Author
  • I intend to release a new version. Please visit

     

    Link to comment
    Share on other sites

    Hello,

     

    can someone help me with this functions:

     

    If the garagedoor longer open as 10 mins send a push to phone XYZ. In all my versions the push will be send direct after the door opens.

     

    {10, "`GarageDoor`",{state="value=true",trueAct={"Achtung!","sendPush,542","Garagentor noch offen!"}}},

     

    A second function is:

     

    If a window or door longer open than a half hour and if the temperature outside < 15° it sends also a push.

    Or as a second warning to switch a hue light(VD is implemented) to a color.

     

     I tried a lot of different codes but nothing works as expected. 

     

    Thank you Manuel

     

     

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, FunkFib said:

    If the garagedoor longer open as 10 mins send a push to phone XYZ. In all my versions the push will be send direct after the door opens.

    {10, "`GarageDoor`",{state="value=true",trueAct={"Achtung!","sendPush,542","Garagentor noch offen!"}}},

    This one is easy to solve...

    1. Replace trueAct by timeLoopAct and  you'll receive notification every 10 minutes (if garage door continues to be open).
    2. Replace trueAct by timeoutAct and you'll receive one notification after 10 minutes. (if garage door continues to be open, no notification sent

    In both case when garage door closed the state resets and will start over when garage opened again.

    1 hour ago, FunkFib said:

    A second function is:

    If a window or door longer open than a half hour and if the temperature outside < 15° it sends also a push.

    Or as a second warning to switch a hue light(VD is implemented) to a color.

    Assuming your device IDs are:

    VD 600 button 1

    window sensor is 700

    door sensor is 800

    Temperature sensor is 900

    then:

    Please login or register to see this code.

    please change IDs according to your system.

    Edited by cag014
    Link to comment
    Share on other sites

    ?

     

    First tipp I think I got it.

     

    trueAct = allways if it goes to true

    timeLoopAct = every time loop as defined  in first field

    timeoutAct = once after defined  in first field

     

    The second one... I'm a learner. I have to read you manual once(countless ?) more.

     

    Thank you for your help. I'm looking forward to your new version.

     

    Merry Christmas ?

     

    Link to comment
    Share on other sites

  • Topic Author
  • It's OK... new version will include built-in user guide for every field and action.

     

    By the way right now the second solution has constant number in conditions. If in the future you'll change timeSpan you need to update conditions. May I suggest to use follow line, which calculates correct lastBreached values based on timeSpan, so if you change timeSpan, conditions will be auto-synchronized accordingly.

    Please login or register to see this code.

     

    Edited by cag014
    Link to comment
    Share on other sites

    Hello,

     

    thank you again for the help. I have replaced the code for auto synchronization. 

     

    The code leads to following error:

     

    Please login or register to see this spoiler.

     

    $name in $room is open over $timeSpan minutes

     

    $name = Toilettenfenster

    $room = Flur-EG  <-- I assume this is the problem "-" letter minus. Could this be so?

     

    I will test it with another room.

     

    letter "ü" is also a problem? Test room Büro...

     

    Manuel

     

     

    Edited by FunkFib
    Link to comment
    Share on other sites

  • Topic Author
  • Yes the minus is a problem... I suggest instead of using $room, just write the room name and % after - ( Flur-%EG) it should work.

    Thanks for finding a bug, will be fixed in next release

     

    Edited by cag014
    Link to comment
    Share on other sites

    Hello,

     

    I have  moved some more magic scenes to All-in-One scene. I have problems with the send push function. The Push messages will only send to the iPad. Every other mobile phone won't receive the push messages (iPhone or Android). With my other alarm scripts I receive the push massages with every device. Could this possible? Is there a difference between the iPhone or iPad push message?

     

    The code above leads to an error:

    Please login or register to see this code.

    BUG] 17:29:26: 2019-12-27 17:29:26.349761 [ fatal] Unknown exception: /opt/fibaro/scenes/185.lua:298: attempt to index field '?' (a nil value)

     

    Is this part right? I have searched for a mistake but I couldn't find the reason for the error.

     

    ?$timeSpan*60+($timeSpan/10*60)?

     

    exg. 2 Minutes

     

    2*60 = 120

    +

    2/10*60 = 12

    =

    132 sec.

     

     

    Manuel

    Link to comment
    Share on other sites

  • Topic Author
  • Do you use this line as is? You should change device IDs according to your system. The device numbers are an example only.

    Link to comment
    Share on other sites

    Hello,

     

    no sorry.

     

    this is my code

     

    {30,"245",{state="value=true",timeLoopAct={{"Warnung!","sendPush,542","$name in der Toilette ist über $timeSpan Minuten offen","{79:value<15|$id:lastBreached<?$timeSpan*60+($timeSpan/10*60)?}"},{"518","pressButton,1","", "{79:value<15|$id:lastBreached>?$timeSpan*60+($timeSpan/10*60)?}"}}}},

     

    but I also copy and past this part (?$timeSpan*60+($timeSpan/10*60)?) to this code (exchanged  3600):

     

    {20,"571",{state="value=true",timeLoopAct={{"Warnung!","sendPush,`iPadUG`,`PhoneDL`,`iPadOG`,`PhoneML`","$name in der Toilette ist über $timeSpan Minuten offen. Bitte schliessen!","{79:value<15|$id:lastBreached<3600}"}}}},

     

    At the moment I add jS2n table variables ;-) 

    Edited by FunkFib
    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...