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



jgab

Recommended Posts

  • Topic Author
  • 10 minutes ago, William12345 said:

    Hi Jan, 

     

    I wanna create a rule that automatically sets devices(Lights) that are turned on between 07-09 to 99% what would be the simplest way to make this rule.

    I made this rule for example, but problem is it cant be dimmed as it automatically turns back to 99% is there a way to limit it to just do this rule once per day for example?

    rule("tv_rum_spottar:isOn & 10:00..11:00 => tv_rum_spottar:value=99"

    On another note, im also a bit confused on how to add a variabel/profile to this rule, i have made a profile called festivities and if that profile is activate i dont want the rules below to run.

    rule("@19:30 => kok_bankbelysning_ovre:dim = {03:30, 'down', 100, 'linear', 10, kok_bankbelysning_ovre:value}")
    rule("@19:30 => entre_spotlights:dim = {03:30, 'down', 100, 'linear', 10, entre_spotlights:value}")
    rule("@19:30 => passage_spottar:dim = {03:30, 'down', 100, 'linear', 10, passage_spottar:value}")
    rule("@19:30 => passage_spotlights:dim = {03:30, 'down', 100, 'linear', 10, passage_spotlights:value}")
    rule("@19:30 => trappa_trappbelysning:dim = {03:30, 'down', 100, 'linear', 10, trappa_trappbelysning:value}")
     
    All help is appreciated :-D

    rule("tv_rum_spottar:isOn & once(10:00..11:00) => tv_rum_spottar:value=99"

     

    profile handling is not so good yet. I would recommend

    Please login or register to see this code.

    Be careful of the spelling of festivities , e.g. if it starts with a capital letter. 
     
    Link to comment
    Share on other sites

    @jgab Jan, i am 

     

    1. How to construct a custom property for defualt LightSensor of a room that a device is in ? simlarly to windowopened? roomID is part of ER5 so i can do somelight:roomID, and there i need to get the defualt light sensor for given room, like in the example somelight:roomID:defLightSensor

     

    Please login or register to see this code.

     

     

     

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 41 minutes ago, Neo Andersson said:

    @jgab Jan, i am 

     

    1. How to construct a custom property for defualt LightSensor of a room that a device is in ? simlarly to windowopened? roomID is part of ER5 so i can do somelight:roomID, and there i need to get the defualt light sensor for given room, like in the example somelight:roomID:defLightSensor

     

    Please login or register to see this code.

     

    If you have :roomID defined

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Dear @jgab I am now testing eventRunner5 within vscode.

    I have currently an issue not solved by Fibaro support: none of my previously working scenes is now trigered by any event!

    So , as I did downloaded in 2021 AOQ (All-in-One) from @cag014 , I am using this QA for replacing all my dead scenes: All OK including what is explained below.

     

    I want to do the same using EventRunner5 but I have a very special request which locked me:

    One light of the staircase, that is not visible from room doors, can be toggled by 5 WALLI dual switches and one QA (id:388) (for switching the light from the Yubii application).

    The needed scenario is that when a user is pressing once any of the upper WALLI switches the staircase light is toggled and this needs also to change status of all other WALLIs in order that users know that the light is "on" or "off" looking at the LED ring -> meaning that all WALLI switches must reflect the status of the light after any change.

     

    I have found a way to switch the light on/off  and all other WALLIs using the following rules:

    LustreA={435,315,310,36,305}
        --rule("LustreA:isOn => if LustreA:isAnyOff then LustreA:on end").mode("killOthers") --works but impossible to switch OFF after
    ParamA={434,434,314,309,35,304} -- needed for centralSceneEvent trigger
     
        rule([[(310-1):central.keyAttribute == 'Pressed'  => if 310:isOff then LustreA:on end]]).mode("killOthers") --OK
        rule([[(310-1):central.keyAttribute == 'Pressed'  => if 310:isOn then LustreA:off end]]).mode("killOthers") --OK
        rule("LustreA:isAllOn => 388:on") --OK
        rule("LustreA:isOff => 388:off") --OK
        rule("388:isOn => if LustreA:isOff then LustreA:on end")--OK
        rule("388:isOff = if LustreA:isAllOn then LustreA:off end")

     

    Rules 3, 4, 5, 6 and 7 are perfectly working but not the last one :

    [23.03.2024] [13:26:54] [TRACE ] [ER5000 ]: Defined [Rule:3] (310-1):central.keyAttribute == 'Pressed'  => if 310:isOff then LustreA:on end
    [23.03.2024] [13:26:54] [TRACE ] [ER5000 ]: Defined [Rule:4] (310-1):central.keyAttribute == 'Pressed'  => if 310:isOn then LustreA:off end

    [23.03.2024] [13:26:54] [TRACE ] [ER5000 ]: Defined [Rule:5] LustreA:isAllOn => 388:on
    [23.03.2024] [13:26:54] [TRACE ] [ER5000 ]: Defined [Rule:6] LustreA:isOff => 388:off
    [23.03.2024] [13:26:54] [TRACE ] [ER5000 ]: Defined [Rule:7] 388:isOn => if LustreA:isOff then LustreA:on end

    [error] Expr Runtime: :isOff is not a valid device set property for device:388
    388:isOff = if LustreA:isAllOn then LustreA:off end

     

    Why ":isOn" OK but not ":isOff"?

    Edited by Christb
    Link to comment
    Share on other sites

  • Topic Author
  • Because you use '=' instead of '=>'
     rule("388:isOff = if LustreA:isAllOn then LustreA:off end")

    so it's complaining that :isOff is not a "valid device set property"

    • Thanks 1
    Link to comment
    Share on other sites

    @jgab Jan another really strange ghost effect

     

    Please login or register to see this image.

    /monthly_2024_03/image.png.73bd63717d8dcbf01d366704eaf41cfb.png" />

     

     

    This happened as i was clicking between file tabs in lua editor..

    Also noticed, that i have deleted a file from ER5, and closed the QA, and all the stuff from that file was still alive..All the event listeners, everything..

    Just in case you still collect all the cases with ghosts :-)

     

    Link to comment
    Share on other sites

    • 2 weeks later...

    I'm having a problem with defining a custom property for a dimmer. I want to set the default (forced) value in Parameter 19 to give time of day brightness value for the dimmer(s)

     

    This works:

     

     rule("@11:00 => fibaro.call(44,'setConfiguration',19,1,25)")

     

    However, if I define a custom (set) property (in main after er has been defined):

     

    function er.stdProp.setProp.defaultValue(obj,prop,event,value) return fibaro.call(obj.id,'setConfiguration',19,1,value) end

     

    and the rule:

     

    rule("@11:00 => 44:defaultValue=25")

     

    then I get an error when the rule is triggered:

     

    [Rule:13:1]>> [Rule:13:@11:00 => 44:defaultValue=25] Runtime: ./include/utils.lua:389: ./include/utils.lua:406: [string "do..."]:11: /usr/share/lua/5.3/json/encode.lua:88: Failed to encode value, encoders for function deny encoding putprop
    @11:00 => 44:defaultValue=25

                          ^

     

    I'm clearly doing something wrong but this is my first attempt at a custom property and trying to understand what I have missed.

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, James R said:

    I'm having a problem with defining a custom property for a dimmer. I want to set the default (forced) value in Parameter 19 to give time of day brightness value for the dimmer(s)

     

    This works:

     

     rule("@11:00 => fibaro.call(44,'setConfiguration',19,1,25)")

     

    However, if I define a custom (set) property (in main after er has been defined):

     

    function er.stdProp.setProp.defaultValue(obj,prop,event,value) return fibaro.call(obj.id,'setConfiguration',19,1,value) end

     

    and the rule:

     

    rule("@11:00 => 44:defaultValue=25")

     

    then I get an error when the rule is triggered:

     

    [Rule:13:1]>> [Rule:13:@11:00 => 44:defaultValue=25] Runtime: ./include/utils.lua:389: ./include/utils.lua:406: [string "do..."]:11: /usr/share/lua/5.3/json/encode.lua:88: Failed to encode value, encoders for function deny encoding putprop
    @11:00 => 44:defaultValue=25

                          ^

     

    I'm clearly doing something wrong but this is my first attempt at a custom property and trying to understand what I have missed.

    ...but you came quite far with your attempt! :-)

    So, the arguments for setProp is slightly different - there is no event parameter.

    Please login or register to see this code.

    If you need 3 parameters you can make a table

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Thanks, that worked.

     

    What caught me out was following the link on page 1 of this topic which pointed to Custom properties (on page 10). This has event in the parameters for setProp so it might be worth a quick edit?

     

    So, that now gives me a time of day rule for some of my fibaro dimmers to allow them to be dimmer in the evening and night time when they are turned on.

    Link to comment
    Share on other sites

    @jgab Jan is there anywhere a list of commands for ER5 so i can look up if i need the syntax for something?

    Now i can't find the syntax for setting a thermostat mode to OFF or ON..

    I grinded through the entire ER5 topic, but could not find.

    What is the syntax?  thermostat:mode = "Off"? thermostat:mode = "off" ?

     

    Link to comment
    Share on other sites

    28 minutes ago, Neo Andersson said:

    @jgab Jan is there anywhere a list of commands for ER5 so i can look up if i need the syntax for something?

    Now i can't find the syntax for setting a thermostat mode to OFF or ON..

    I grinded through the entire ER5 topic, but could not find.

    What is the syntax?  thermostat:mode = "Off"? thermostat:mode = "off" ?

     

    UPDATE

    Okay, i have found it, it is thermostat:thermostatMode = "Off"

    Link to comment
    Share on other sites

    • 3 weeks later...

    @jgab Hello Jan, i am using this formula to create rules that makes a light turn on on a swtich action

    Please login or register to see this code.

     

    i need to change the rules that can handle when the light is a dimmer, or rgbw so rule will run an action setValue and not turnOn

    For this i need to somehow differentiane the action upon device type.

    How to determine using ER5 syntax, that a device is a dimmer, or RGBW that can accept setValue action, or is a single switch type that accpets ture or false actions.

     

    Thanks

     

    Link to comment
    Share on other sites

  • Topic Author
  • Posted (edited)
    On 4/24/2024 at 6:36 PM, Neo Andersson said:

    @jgab Hello Jan, i am using this formula to create rules that makes a light turn on on a swtich action

    Please login or register to see this code.

     

    i need to change the rules that can handle when the light is a dimmer, or rgbw so rule will run an action setValue and not turnOn

    For this i need to somehow differentiane the action upon device type.

    How to determine using ER5 syntax, that a device is a dimmer, or RGBW that can accept setValue action, or is a single switch type that accpets ture or false actions.

     

    Thanks

     

    Isn't it easier to determine that in the Lua loop and create different rules for them?

    One way is to see if the device gas the setValue action

    Please login or register to see this code.

     

    Edited by jgab
    Link to comment
    Share on other sites

    4 hours ago, jgab said:

    Isn't it easier to determine that in the Lua loop and create different rules for them?

    One way is to see if the device gas the setValue action

    Please login or register to see this code.

     

    Yes, i am using a similar approach at this moment, but it is tricky when lights are defined in a table like 

    Please login or register to see this code.

    so i thing i need to change somehow the onIfOff function definition so that it will check the light type and act upon it..

    Link to comment
    Share on other sites

    @jgab you helped me with once weekly to get temperature from some devices.

    I would like something similar for power, so I replaced temperatures with power but that was to easily, it did't work.

    Please login or register to see this code.

    Can you give the correct frase?

    Thanks in advance

    Link to comment
    Share on other sites

    Posted (edited)

    @jgab Jan, can you please assist a bit

     

    How to form a rule that takes a table as a trigger that contains {month,day} pairs and perform action on thise exact days (always at 7:00 and the action side is always the same)?

    Now i am writing rule for every single moth-day pair separately. Can i just define separately a kinda wastedatetable = {{'mar','7},{'apr','4'}, ...etc} and create rules dynamically..I have tried using fmt in a loop but never succeded..

    Please login or register to see this code.

     

    Edited by Neo Andersson
    Link to comment
    Share on other sites

    Posted (edited)

    Perhaps something like this:

    Every 4 weeks started at week 0

    Please login or register to see this code.

     

    Edited by Sjakie
    removed start
    Link to comment
    Share on other sites

  • Topic Author
  • Please login or register to see this code.

    should work?

    Link to comment
    Share on other sites

  • Topic Author
  • Posted (edited)

    Alt. only one rule that checks every day at 7 - a bit more efficient.

    Please login or register to see this code.

     

    Edited by jgab
    • Thanks 1
    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...