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


Recommended Posts

Posted

Jan, hello
I need to implement the value2 (for setValue2 action of a blind device that controls the slats)
 

in custom properties is this the right way?

 

Please login or register to see this code.

 

  • 2 weeks later...
Posted

Dear all, 

 

The below rule has been working for more than a year, but it looks like since the latest Firmware (5.190.36) update, it no longer works. I can't seem to figure out what's wrong.  

Any one else experiencing this? 

 

Please login or register to see this code.

 

Thanks for any thoughts. 

Jeroen 

  • Topic Author
  • Posted
    52 minutes ago, JeroenL said:

    Dear all, 

     

    The below rule has been working for more than a year, but it looks like since the latest Firmware (5.190.36) update, it no longer works. I can't seem to figure out what's wrong.  

    Any one else experiencing this? 

     

    Please login or register to see this code.

     

    Thanks for any thoughts. 

    Jeroen 

    What is not working?
    The rule not triggering?, condition false? not turning on light, or ?

    Looking at your rule, I can see that this is strange:

    Please login or register to see this code.

    It's the same as 

    Please login or register to see this code.

    because 

    Please login or register to see this code.

    is

    Please login or register to see this code.

    So the rule will only run when $Profile == 'Business'

    Posted

    My bad....  Thinking error. Woke up at night and had the answer.... 

    Now with the Wintertime, it is dark where I live before my range of 18:15.. 22.:45 so nothing got triggered.  Wrong logic in my code. 

     

    Interesting what you say about 

    Please login or register to see this code.

    I thought either profile. Business or the Away profile would me a condition that would be met. 

     

    Thxs ! 

    Jeroen 

    ps. Looking forward to Version 6 🙏

     

  • Topic Author
  • Posted

    So what you needs to do is
     

    Please login or register to see this code.

     

    • Thanks 1
    Posted

    @jgab

    1. Jan  i tried to find some description about location / geofence event usage in ER5 but i could not find any. Maybe i am using some bad keywords, idk Would you please dhow me the syntax for geogence entering / leaving events in ER5?

    2. Can you please look at this custom function call..Do i use the correct syntax for defining a custom function for ER5. I need to define function setValue2 (for rollershutters)
     

    Please login or register to see this code.

    Many thanks for the help

    Posted

    if anyone could help here a bit. I need to create a custom function value2 to set the device's value2 property to the given value. In regular way it is called fibaro.call(devid, "setValue2", 50) so i need to get it into ER5 to use it like deviceid:value2 = 50


    I am following the syntax that we have in JGAB's description for custom functions below
     

    Please login or register to see this code.



    so i have tried
     

    Please login or register to see this code.

    doesn't work, throwing error about encoding a function

    I tried also 

     

    Please login or register to see this code.

     

    did not work either..

    If anyone had some luck to defining custom functions??

    Thanks ahead

  • Topic Author
  • Posted

    Yes, they work. 

    If you look at the device structure for your device (swagger), does it have an actions 'setValue2' defined?

    Have you verified that fibaro.call(id,"setValue2",100) works from Lua?

    Have you verified that fibaro.call(id,"updateProperty","value2",100) works from Lua?

     

    Both your examples should work, I tried a similar, not just with value2 as I don't have such a device.

    I don't think the encoding error is because of the custom fun - but related to something trying to log the rule... can you show me the full error?

    So, your second attempt that "did not work either.". How did it not work? error?, not triggering?

     

    Posted (edited)

    yes, ofcourse it has value2

    and yes 

    Please login or register to see this code.

     

    works in fibaro LUA



    for this test i used this approach

    Please login or register to see this code.



    The error i am getting is
    [Rule:8:1]>> [Rule:8:@09:11 => 235:value2=0] 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
    @09:11 => 235:value2=0

     

     

    Please login or register to see this image.

    /monthly_2025_11/image.png.ed500036de53185f38f81e27d7a248b2.png" /> 

    Edited by Neo Andersson
  • Topic Author
  • Posted

    Try

    Please login or register to see this code.

     

    Posted (edited)
    9 minutes ago, jgab said:

    Try

    Please login or register to see this code.

     

    worked thanks

    So what syntax should we follow when we want to create a custom function with or without arguments??

     

    so it will work both on single device or a table of devices

    Edited by Neo Andersson
  • Topic Author
  • Posted

    They all have an "argument"

    Please login or register to see this code.

    will get the trigger for 'fopp' declared (function er.stdProp.trigger.fopp(...) end) and make an event trigger for that event, calling the rule.
    When the rule is triggered, it will call (function er.stdProp.getProp.fopp(obj,prop,event) ... end) to get the value of property 'fopp' to evaluate the condition
    If we call have rule("ID:fopp = 88") it will call (function er.stdProp.setProp.fopp(obj,prop,value,_) ... end) to set the 'fopp' property of the ID

    If you have a rule like 

    Please login or register to see this code.


    the ER compiler will look through the list of devices and create resp, triggers to trigger the rule if either 66,88,44 change the fopp property.
    The value of {66,88,44}:fopp is usually a list of :fopp applied to each device.
    If we want the result to be a single value we need to provide a 'reduce' function that computes the single value given the list of values.
    Ex. rule("{66,88,44}:breached => ...")
    is true if any of the devices are breached (true). The :breached function thus have a reduce function that is an "OR" of all the values.
    If our er.stdProp.getProp.fopp would return ex. the temperature of the device, {66,88,44}:fopp would then return the list {222,24,20} if that was resp. device temperature.
    If we want :fopp applied to a list of devices to return the average temperature, {66,88,44}:fopp == 22, the we would provide a reduce function:
     

    Please login or register to see this code.

     

    Posted
    15 minutes ago, jgab said:

    They all have an "argument"

    Please login or register to see this code.

    will get the trigger for 'fopp' declared (function er.stdProp.trigger.fopp(...) end) and make an event trigger for that event, calling the rule.
    When the rule is triggered, it will call (function er.stdProp.getProp.fopp(obj,prop,event) ... end) to get the value of property 'fopp' to evaluate the condition
    If we call have rule("ID:fopp = 88") it will call (function er.stdProp.setProp.fopp(obj,prop,value,_) ... end) to set the 'fopp' property of the ID

    If you have a rule like 

    Please login or register to see this code.


    the ER compiler will look through the list of devices and create resp, triggers to trigger the rule if either 66,88,44 change the fopp property.
    The value of {66,88,44}:fopp is usually a list of :fopp applied to each device.
    If we want the result to be a single value we need to provide a 'reduce' function that computes the single value given the list of values.
    Ex. rule("{66,88,44}:breached => ...")
    is true if any of the devices are breached (true). The :breached function thus have a reduce function that is an "OR" of all the values.
    If our er.stdProp.getProp.fopp would return ex. the temperature of the device, {66,88,44}:fopp would then return the list {222,24,20} if that was resp. device temperature.
    If we want :fopp applied to a list of devices to return the average temperature, {66,88,44}:fopp == 22, the we would provide a reduce function:
     

    Please login or register to see this code.

     

    thanks, i was wondering, why it didnt work using your original syntax with windowsOpened example

    • 3 weeks later...
    Posted

    Jan what does exactly mean what we see in the logs?

    For example [Rule:170:93] ?? I know 170 is the rule ID, but what is 93?? Does that mean this rule has 93 instances running paralell?
    [Rule:170:93]>> FALSE #device{id=1056,va.. -> trueFor(02:00:00,housePIR:safe) & door..[26.11.2025] [19:45:44] [TRACE] [QUICKAPP998]: [Rule:54:94]>> FALSE #device{id=1056,va.. -> housePIR:breached & shsAlarm:isOn => l..[26.11.2025] [19:45:44] [TRACE] [QUICKAPP998]: [Rule:55:94]>> FALSE #device{id=1056,va.. -> trueFor(00:01:00, housePIR:safe & shsA..[26.11.2025] [19:45:44] [TRACE] [QUICKAPP998]: [Rule:170:94]>> FALSE #device{id=1056,va.. -> 

  • Topic Author
  • Posted

    It

    12 minutes ago, Neo Andersson said:

    Jan what does exactly mean what we see in the logs?

    For example [Rule:170:93] ?? I know 170 is the rule ID, but what is 93?? Does that mean this rule has 93 instances running paralell?
    [Rule:170:93]>> FALSE #device{id=1056,va.. -> trueFor(02:00:00,housePIR:safe) & door..[26.11.2025] [19:45:44] [TRACE] [QUICKAPP998]: [Rule:54:94]>> FALSE #device{id=1056,va.. -> housePIR:breached & shsAlarm:isOn => l..[26.11.2025] [19:45:44] [TRACE] [QUICKAPP998]: [Rule:55:94]>> FALSE #device{id=1056,va.. -> trueFor(00:01:00, housePIR:safe & shsA..[26.11.2025] [19:45:44] [TRACE] [QUICKAPP998]: [Rule:170:94]>> FALSE #device{id=1056,va.. -> 

    its the instance number, so the number increases every time the rule is triggered.

    it’s there so we can match logs from the same invocation of the rule.

    • Thanks 1
    • 2 weeks later...
    Posted

    @jgab Jan, i was using this rule years in many installations to catch any error in ER5 and send push to installers
    Today i am getting this error message about this rule, but i can not identify the source of the problem..How could this work so long and now it doesnt..

     

    Please login or register to see this code.

     

     

    and the error i am getting is

     

    [10.12.2025] [20:02:19] [TRACE] [QUICKAPP3706]: [Rule:100:1]>> TRUE #ERerror{id=10,msg.. -> #ERerror{id='$id', msg='$msg'} => loca..[10.12.2025] [20:02:19] [ERROR] [QUICKAPP3706]: [Rule:100:1]>> [Rule:100:#ERerror{id='$id', msg='$msg'} => local infomsg = '⚠️ Error in rule '++ en..] Runtime: ./include/utils.lua:389: Wrong parameter type, string required. Provided param 'false' is type of boolean putprop
    #ERerror{id='$id', msg='$msg'} => local infomsg = '⚠️ Error in rule '++ env.event.id ++' in object ' ++ GW.hcName++' at '++ HMS(now); installerUser:msg = infomsg
     

     

    I dont get what param can be "false" there

    ohh jesus, i think this will be related to the last update..Fibaro has changed something in push message usage i think..Could you please fix this? I am using this in many many installations..

  • Topic Author
  • Posted
    10 hours ago, Neo Andersson said:

    @jgab Jan, i was using this rule years in many installations to catch any error in ER5 and send push to installers
    Today i am getting this error message about this rule, but i can not identify the source of the problem..How could this work so long and now it doesnt..

     

    Please login or register to see this code.

     

     

    and the error i am getting is

     

    [10.12.2025] [20:02:19] [TRACE] [QUICKAPP3706]: [Rule:100:1]>> TRUE #ERerror{id=10,msg.. -> #ERerror{id='$id', msg='$msg'} => loca..[10.12.2025] [20:02:19] [ERROR] [QUICKAPP3706]: [Rule:100:1]>> [Rule:100:#ERerror{id='$id', msg='$msg'} => local infomsg = '⚠️ Error in rule '++ en..] Runtime: ./include/utils.lua:389: Wrong parameter type, string required. Provided param 'false' is type of boolean putprop
    #ERerror{id='$id', msg='$msg'} => local infomsg = '⚠️ Error in rule '++ env.event.id ++' in object ' ++ GW.hcName++' at '++ HMS(now); installerUser:msg = infomsg
     

     

    I dont get what param can be "false" there

    ohh jesus, i think this will be related to the last update..Fibaro has changed something in push message usage i think..Could you please fix this? I am using this in many many installations..

    Yes, the last change broke it. I guess it was kind of broken anyway. Some time in the past we tried to fix push message

    Please login or register to see this code.

     

    Just redefine it with your own stdPropObject.setProp.msg

    Please login or register to see this code.

     

    • Thanks 1
    Posted (edited)
    24 minutes ago, jgab said:

    Yes, the last change broke it. I guess it was kind of broken anyway. Some time in the past we tried to fix push message

    Please login or register to see this code.

     

    Just redefine it with your own stdPropObject.setProp.msg

    Please login or register to see this code.

     

    Jan this throws error

    Loading rules from Custom properties module[11.12.2025] [06:54:49] [ERROR] [QUICKAPP3706]: Rule setup error(s) - fix & restart...[11.12.2025] [06:54:49] [ERROR] [QUICKAPP3706]: Last err: ./include/u_Customprops.lua:51: attempt to index a nil value (global 'stdPropObject')

    my custom property modul has priority 2, right after the main

    Edited by Neo Andersson
  • Topic Author
  • Posted (edited)

    Don't do what I say, do what I mean :-)

    Please login or register to see this code.

    Edited by jgab
    • Like 1
    • 4 weeks later...
    Posted

    Good morning,  
    I have been using ER5 v.1.050 for a long time. Since the last update of the HC3 to v.5.200.8, I have had problems sending a SimplePush. Now I get the following error message:  

    Quote

    [03.01.2026] [14:17:52] [ERROR] [ER1287]: [Rule:168:1]>> [Rule:168:#HC3_restart => Phone_Kai:msg=log('ER5 neu gestartet um %s',HMS(now))] Runtime: ./include/utils.lua:389: Wrong parameter type, string required. Provided param 'false' is type of boolean putprop
    #HC3_restart => Phone_Kai:msg=log('ER5 neu gestartet um %s',HMS(now))

    (There ist a ^ under the colon)

     

    Does anyone have the same problem, or can someone please help me figure out what I am doing wrong?

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