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

  • Topic Author
  • 53 minutes ago, SmartLifeSystems said:

     

    The QA don't send me debug message in the debug window. I think working.

    I add a JM line

     

    {0, "`diningLight`",{state="value=true",trueAct={"","tts","The dining light is turned on."}}},

     

    But when I turning On the dining light, de AOQ is restarting.

     

    I do something wrong?

     

    Here is my TTS function lines:

     

    Please login or register to see this link.

     

    Are you sure those the lines?

    Looks like no code at all...

    By the way another observation, when using fibaro.call - the device ID must be a number and not a string

    Should be 

    fibaro.call(5042,"talkText",tostring(text2speech))

     

    Edited by cag014
    Link to comment
    Share on other sites

    1 hour ago, cag014 said:

    Are you sure those the lines?

    Looks like no code at all...

    By the way another observation, when using fibaro.call - the device ID must be a number and not a string

    Should be 

    fibaro.call(5042,"talkText",tostring(text2speech))

     

     

    Ok, I got a warning message.

    Maybe the QA not working good.

     

    Please login or register to see this attachment.

     

    Link to comment
    Share on other sites

    On 11/4/2019 at 7:31 PM, cag014 said:

    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.

    Hi Cag014, 

    Merry Christmas first of all. Also Happy New Year, as I don't expect response still in 2021 :-)

    Picking up this thread instead opening a new one, as I tried to use the above example for some humidity sensor automation in the AiO script

    Aim is to switch a ventilation system on if either of 3 humidity sensors shows a value above 50% humidity 

     

    I am missing something as the script is not running into an error, but the switch is not triggered, even with 2 sensors showing humidity above 50%

     

    Global variable aosHumid defined 

    Global variable embedded in script through line: global4local = {true,gVarName="aosHumid",varArray={iHumid="init:0"}}

    Code lines embedded: 
    {0, "&iHumid",{state="value>0",trueAct={"`BrookventSwitchHigh`","turnOn",""},falseAct={"`BrookventSwitchHigh`","turnOff","300"}}},
    {0, "`ParentsHumidity`|`ChildHumidity`|`GuestHumidity`",{state="value>50",initAct={"iHumid","setGlobal","&iHumid+1","{|$id:value=0|}"},trueAct={"iHumid","setGlobal","&iHumid+1"},falseAct={"iHumid","setGlobal","&iHumid-1"}}},
     

    Link to comment
    Share on other sites

    Hi cag!

     

    I had need a global variable from a calendar. I added a line to the main page.

    Can you paste it in the next version?

     

    Thanks!

     

    ["$actDay"]=function() return os.date("%a %b %d %Y",os_time()) end,
     
    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, SmartLifeSystems said:

    Hi cag!

     

    I had need a global variable from a calendar. I added a line to the main page.

    Can you paste it in the next version?

     

    Thanks!

     

    ["$actDay"]=function() return os.date("%a %b %d %Y",os_time()) end,
     

    What line you have added?

    $actDate is part of the latest released code already...

     

    Edited by cag014
    Link to comment
    Share on other sites

  • Topic Author
  • 3 hours ago, Pretender said:

    Hi Cag014, 

    Merry Christmas first of all. Also Happy New Year, as I don't expect response still in 2021 :-)

    Picking up this thread instead opening a new one, as I tried to use the above example for some humidity sensor automation in the AiO script

    Aim is to switch a ventilation system on if either of 3 humidity sensors shows a value above 50% humidity 

     

    I am missing something as the script is not running into an error, but the switch is not triggered, even with 2 sensors showing humidity above 50%

     

    Global variable aosHumid defined 

    Global variable embedded in script through line: global4local = {true,gVarName="aosHumid",varArray={iHumid="init:0"}}

    Code lines embedded: 
    {0, "&iHumid",{state="value>0",trueAct={"`BrookventSwitchHigh`","turnOn",""},falseAct={"`BrookventSwitchHigh`","turnOff","300"}}},
    {0, "`ParentsHumidity`|`ChildHumidity`|`GuestHumidity`",{state="value>50",initAct={"iHumid","setGlobal","&iHumid+1","{|$id:value=0|}"},trueAct={"iHumid","setGlobal","&iHumid+1"},falseAct={"iHumid","setGlobal","&iHumid-1"}}},
     

    1. AOS Current  version requires that every formula (or calculations) must be included in question marks. You picked up  a very old example 

    2. In initAct I think the condition should be $id:value>50  and then add +1 to iHumid, isn't?

    3. To make this working on the startup you need to switch the lines. First to set the iHumid on init and then to perform the action.

    It should be like that and in this order

    {0, "`ParentsHumidity`|`ChildHumidity`|`GuestHumidity`",{state="value>50",initAct={"iHumid","setGlobal","?&iHumid+1?","{$id:value>50}"},trueAct={"iHumid","setGlobal","?&iHumid+1?"},falseAct={"iHumid","setGlobal","?&iHumid-1?"}}},

    {0, "&iHumid",{state="value>0",trueAct={"`BrookventSwitchHigh`","turnOn",""},falseAct={"`BrookventSwitchHigh`","turnOff","300"}}},
     

    let me know if it works for you now.

     

    Link to comment
    Share on other sites

    10 hours ago, cag014 said:

    1. AOS Current  version requires that every formula (or calculations) must be included in question marks. You picked up  a very old example 

    2. In initAct I think the condition should be $id:value>50  and then add +1 to iHumid, isn't?

    3. To make this working on the startup you need to switch the lines. First to set the iHumid on init and then to perform the action.

    It should be like that and in this order

    {0, "`ParentsHumidity`|`ChildHumidity`|`GuestHumidity`",{state="value>50",initAct={"iHumid","setGlobal","?&iHumid+1?","{$id:value>50}"},trueAct={"iHumid","setGlobal","?&iHumid+1?"},falseAct={"iHumid","setGlobal","?&iHumid-1?"}}},

    {0, "&iHumid",{state="value>0",trueAct={"`BrookventSwitchHigh`","turnOn",""},falseAct={"`BrookventSwitchHigh`","turnOff","300"}}},
     

    let me know if it works for you now.

     

    Works perfectly as usual. Thanks a lot. 

    Link to comment
    Share on other sites

    20 hours ago, cag014 said:

    What line you have added?

    $actDate is part of the latest released code already...

     

     

    This line in the main page:

     

    ["$actDay"]=function() return os.date("%a %b %d %Y",os_time()) end,

     

    I know the actDate, but I had to need an osDate without the time.

    Link to comment
    Share on other sites

  • Topic Author
  • 5 hours ago, SmartLifeSystems said:

     

    This line in the main page:

     

    ["$actDay"]=function() return os.date("%a %b %d %Y",os_time()) end,

     

    I know the actDate, but I had to need an osDate without the time.

    OK, so please move this line to user_data file to follow table

    userKeyWord=

    {

    ....

    ["$actDay"]=function() return os.date("%a %b %d %Y",os_time()) end,

    }

     

    That's exactly the place to add user keywords, so when main code release dyou don't need to change anything (same as jM lines and other definitions)

    Link to comment
    Share on other sites

    9 hours ago, cag014 said:

    OK, so please move this line to user_data file to follow table

    userKeyWord=

    {

    ....

    ["$actDay"]=function() return os.date("%a %b %d %Y",os_time()) end,

    }

     

    That's exactly the place to add user keywords, so when main code release dyou don't need to change anything (same as jM lines and other definitions)

     

    OK, thank you!

     

    Happy New Year!

    Link to comment
    Share on other sites

    Guest Benrive

    Hello everyone and Happy New Year.
    I have finished equipping the sensors but I want to implement the motion and lumen sensor. I have no idea how to make it work the way I want.

    The idea is the following.
    Motion Sensor = 21
    Sensor Lumens = 23
    Dining room = 64 and Kitchen 69.

     

    I use dimmer 2 with parameter 28 activating the scenes.
    I currently have these JM Lines.

     

    Please login or register to see this code.

    Thanks @cag014

     

    Those lines are prioritized to those of the motion sensor.
    This means that if 1 click or 2 Click is pressed, the motion sensor must bypass its operation.

     

    The idea is that if movement is detected and the lumens are below 60, the lights will turn on and off after 2 minutes (But if the button is pressed 1 time at that time it should execute scene 16 and if it is pressed 2 times the 14 .
    Being a dimmer I would like to play with the lumens and the intensity value.

    If they are less than 60 lumens, light value 60%, if they are less than 30 Light value 80%.

    I've been trying to do something for 2 days, but I get nothing but errors and I don't take a single step.

     

    @cag014 Can you guide me a little?

     

    EDIT: 10/01/2022 At 17:11

     

    Hello,
    After reviewing the documents you have written and seeing the different examples, I make this JM line.

    Could you check if I'm really going to do what I want?

     

    MovEscaleras = Mov Sensor

    LuzEscaleras = Light

    LumEscaleras = Lux Sensor

     

     

    Please login or register to see this code.

     

     
    These lines also act on the same light, but when the button is pressed
     

    Please login or register to see this code.

    Edited by Benrive
    Idea
    Link to comment
    Share on other sites

    Hello

    can anyone help me . I have a Roller Shutter 2 and I cannot seem to set a trueact value to open the blinds to any position.

    can it be done or I must use only the options turnOn or turnoff?
     

    Edited by bfotop
    Typo
    Link to comment
    Share on other sites

    Guest Benrive
    On 1/6/2022 at 10:04 PM, bfotop said:

    Hello

    can anyone help me . I have a Roller Shutter 2 and I cannot seem to set a trueact value to open the blinds to any position.

    can it be done or I must use only the options turnOn or turnoff?
     

     

    You need to know what values Roller shutter 2 supports, . 

     

    I don't have any, but it will most likely work like the Dimmer 2.
    In this case what you are looking for would be SetValue = xx -- xx % to open or close.


    trueAct{} - executed when state status is true. Please do not confused between state and value. If 
    state defined as “value=false”, state status is true when value of device is false

     

    Can you describe what you want to do under what conditions and what are their Id's?

    Edited by Benrive
    Link to comment
    Share on other sites

    Guest Benrive

    When I went to test it, it was not working properly.
    I keep trying other options.

    I have created a new line, yesterday it was partially working. But the light never went out.

     

    Now I have these 3 different lines for the operation of the light, when I get home I will test it.

     

    @cag014You could review it?

    The explanation and the lines jS2n {} are in the post above

     

    Old Lines... Don't see

    Please login or register to see this code.

     

    New Lines...

    EDIT 12/01/21 I add the new lines witch improvements.

     

    It works fine, but something weird happens when scene14 double click is activated (to leave the light on) and the security time for the motion sensor has not passed. If you press again to turn off permanently, the light dims and does not turn off.

    But except for this that only happens in that time it works.

    Please login or register to see this code.

     

    Other actions using the physical buttons witch the same light, I have included that if it is on for 30 minutes and no movement , it turns off

     

    Please login or register to see this code.

     

    It is amazing how quickly I am getting to grips with the way of working and thinking.
    Great job from @cag014 

    My sincere congratulations for how simple you have done something that could be so complicated?

    Edited by Benrive
    New changes and improvements
    Link to comment
    Share on other sites

    Guest Benrive

    Hello,

     

    I have this line and I would like the light level to be variable at Lux level.

    It's posible?, i need a new variable?.

     

    MovEscaleras = Movement sensor.

    LuzEscaleras = Light

    LumEscaleras = Lux level.

     

    Please login or register to see this image.

    /monthly_2022_01/image.png.6fe21ce0bebec5f69af1b1b981957663.png" />

     

    {0,"`MovEscaleras`",{state="value=true",trueAct={{"`LuzEscaleras`","setValue,20","if {`LuzEscaleras`:value=0|`LumEscaleras`:value<30}"},{"`LuzEscaleras`","turnOff","when {`MovEscaleras`:valueModified>30|`MovEscaleras`:value=false|`LuzEscaleras`:sceneActivation=16}"}}}},
     
    For example:
    If LumEscaleras <20 , setvalue,40
    If LumEscaleras >=20 and <= 30 , setvalue,30
    If LumEscaleras >30 and <= 60 , setvalue,20
    If LumEscaleras >60 Nothing TurnOff
     
    any idea how to do it in a simple way?
    Thank's in advance
    Edited by Benrive
    Link to comment
    Share on other sites

  • Topic Author
  • 23 hours ago, Benrive said:

    Hello,

     

    I have this line and I would like the light level to be variable at Lux level.

    It's posible?, i need a new variable?.

     

    MovEscaleras = Movement sensor.

    LuzEscaleras = Light

    LumEscaleras = Lux level.

     

    Please login or register to see this link.

     

    {0,"`MovEscaleras`",{state="value=true",trueAct={{"`LuzEscaleras`","setValue,20","if {`LuzEscaleras`:value=0|`LumEscaleras`:value<30}"},{"`LuzEscaleras`","turnOff","when {`MovEscaleras`:valueModified>30|`MovEscaleras`:value=false|`LuzEscaleras`:sceneActivation=16}"}}}},
     
    For example:
    If LumEscaleras <20 , setvalue,40
    If LumEscaleras >=20 and <= 30 , setvalue,30
    If LumEscaleras >30 and <= 60 , setvalue,20
    If LumEscaleras >60 Nothing TurnOff
     
    any idea how to do it in a simple way?
    Thank's in advance

    The "best" way is to define  a formula which represents relative light level in accordance to the light lux.

    for example the simple formula could be:  max(60-`@LumEscaleras`>value,0) 

    the max function is to avoid negative level value if lux is above 60...

    {0,"`MovEscaleras`",{state="value=true",trueAct={{"`LuzEscaleras`","setValue,?max(60-@`LumEscaleras`>value,0)?"}}},

     

    something like that....

     

     

     

    Edited by cag014
    Link to comment
    Share on other sites

    Guest Benrive
    22 minutes ago, cag014 said:

    The "best" way is to define  a formula which represents relative light level in accordance to the light lux.

    for example the simple formula could be:  max(60-`@LumEscaleras`>value,0) 

    the max function is to void negative level value if lux is above 60...

    {0,"`MovEscaleras`",{state="value=true",trueAct={{"`LuzEscaleras`","setValue,?max(60-@`LumEscaleras`>value,0)?"}}},

     

    something like that....

     

     

     

     

    Thanks... Can you give me a little explanation of the formula?.

    For example: in the picture value are this... 

     

     

    Please login or register to see this image.

    /monthly_2022_01/image.png.17d1849932d61c577f22ec6ef3ce4a1f.png" />

    Link to comment
    Share on other sites

  • Topic Author
  • Yes, that's simple

    Please login or register to see this spoiler.

     

    Means

    60-172=-112

    math.max(-112,,0) = 0 

     

    so the value to be set is 0. 

    Edited by cag014
    Link to comment
    Share on other sites

    Guest Benrive
    On 1/14/2022 at 5:50 PM, cag014 said:

    Yes, that's simple

    Please login or register to see this spoiler.

     

    Thank you very much, now yes! I have to include that at dawn I have to make it turn on very dimly, in case I have to go to the bathroom without it being very noticeable

    Link to comment
    Share on other sites

    Guest Benrive

    Hello @cag014

     

    I have already included many options, they are working perfectly for me. Even an alarm with a push message to the mobile phone if a window is open for more than 5 minutes and the heating is on.

    I'm loving All in One. Let's see when Zwave monitor in Hc3.

     

    The question:

    I am now with the Danalock door lock.
    I have bought a sensor for the door (it will arrive tomorrow).
    I want the lock to close when the sensor is detecting the door closed, the lock is open, and the motion sensor has not detected anything in 5 minutes.

     

    I have prepared this line, but I wouldn't be 100% sure, I don't want to risk it with the door of my house and something fails.

    I would even appreciate if you have any suggestions to improve it, in case communication failed or it could not be closed.

     

    cerraduraPuerta = Danalock door lock

    MovRecibidor = Sensor movement

    puertaEntrada = door sensor

     

    Please login or register to see this code.

     

    Thank's in advance

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