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

1 minute ago, jgab said:

that's only for v0.5fixXY, for newer versions you can give them any name as they use a serial number in the QA code to recognise the right QA.

Yes - i saw that. It's a masterpiece you made?

Link to comment
Share on other sites

  • Topic Author
  • Because it's a separate updater you should be able to revert to the previous version if something goes wrong with a new release.

    Link to comment
    Share on other sites

  • Topic Author
  • This is a little trick to make it easier to work with timers in ER4.

    It's common that if an event happens you want to start a timer or post something in the future. However, if the event happens again you want to 

    cancel the first timer and restart it.

     

    Ex.

    Please login or register to see this code.

     

    If someone press btn1 and then later press btn2 (or press btn1 again) you want to cancel the first post for btn1.

    We can do that by keeping track of the post reference and cancel it.

    Please login or register to see this code.

     

    With some helper functions we can do it easier

    Please login or register to see this code.

     

    The previous rules would then look like

    Please login or register to see this code.

    e.g. events posted under the same name will cancel each other automatically.

    • Like 1
    Link to comment
    Share on other sites

    Good morning Jan,

    Is there a possibility that the system fils this rule with names or numbers?

    Please login or register to see this code.

    Devices = all battery operated

    Thanks in advanced,

    //Sjakie

    Link to comment
    Share on other sites

  • Topic Author
  • 26 minutes ago, Sjakie said:

    Good morning Jan,

    Is there a possibility that the system fils this rule with names or numbers?

    Please login or register to see this code.

    Devices = all battery operated

    Thanks in advanced,

    //Sjakie

    This just creates a variable named 'devices' with an array of numbers. What do you want to do with it?

    You can get the max battery

    Please login or register to see this code.

    You can get the average of the battery

    Please login or register to see this code.

    If some of them don't have a batteryLevel property you may get into trouble...

    • Like 1
    Link to comment
    Share on other sites

    Good Sunday Jan

     

    I have a single rule that stopped working after upgrading to the new EventRunner4 v0.78 N/A

     

    c02sensor = 521
    -- Grøn, Blå, Gul, orange, rød, lilla
    rule([[#device{id=c02sensor,value='$value'} =>
        || value < 600 & value > 0 >> 224:color={2,255,2,16};
        || value < 900 & value > 600 >> 224:color={2,2,255,16};   
        || value < 1000 & value > 900 >> 224:color={255,2,2,16};
        || value < 2500 & value > 1000 >> 224:color={255,2,255,16}; 
        ]])  

     

    Trigger Showed in the History 
    578 ppm , 521, CO2 Tornskadevej Indoor, Hjem/Stue, System, 16:43:08

     


    [22.05.2022] [16:43:09] [DEBUG] [QUICKAPP1103]: [{"type":"device","id":521,"value":"$value"}]>>'Rule:25[#device{id=c02sensor,value='$value'} =>...]'
    [22.05.2022] [16:43:09] [DEBUG] [QUICKAPP1103]: fibaro.call(224,"setColor",2,255,2,16) => nil
    [22.05.2022] [16:43:09] [DEBUG] [QUICKAPP1103]: [{"type":"device","id":521,"value":"$value"}]>>'Rule:25[#device{id=c02sensor,value='$value'} =>...]'
    [22.05.2022] [16:43:09] [ERROR] [QUICKAPP1103]: in Rule:25[#device{id=c02sensor,value='$value'} =>...]: ./include/EventRunner.lua:1953: ./include/EventRunner.lua:1359: attempt to compare nil with number

     

    Any idea of why this changed behavior ?

    I guess that $value is empty ??

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 23 minutes ago, ChristianSogaard said:

    Any idea of why this changed behavior ?

    I guess that $value is empty ??

    It looks like the rule trigger twice, and the second time there is no value parameter in the event (thus nil and the error when comparing value with <).

    You could add a log to see what event you get (and if there is no 'value' in it, that's the problem)

    Please login or register to see this code.

     

    Could it be that the co sensor sends 2 events for 2 different properties?

    Edited by jgab
    Link to comment
    Share on other sites

    4 minutes ago, jgab said:

    It looks like the rule trigger twice, and the second time there is no value parameter in the event (thus nil and the error when comparing value with <).

    You could add a log to see what event you get (and if there is no 'value' in it, that's the problem)

    Please login or register to see this code.

     

    Could it be that the co sensor sends 2 events for 2 different properties?

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • Yes, you get the log changes as events these days - it was a request from some other user.

    Do this:

    Please login or register to see this code.

     

    In general, if you trigger with the event definition #device{id=..., value=..., property=...}

    always add the property name you want to match against as there can be different properties triggers that have a value

    If you match

    Please login or register to see this code.

    The c02sensor:value only matches with property name 'value'

    Edited by jgab
    • Thanks 1
    Link to comment
    Share on other sites

    Hallo Jan,

    My HC3 is again connected.

    I have some errors;

    Please login or register to see this code.

    [26.05.2022] [14:48:00] [ERROR] [QUICKAPP1305]: main.lua:120: unexpected symbol near ')'

    Please login or register to see this code.

    Thansk in advance,

    //Sjakie

    Link to comment
    Share on other sites

    2 hours ago, Sjakie said:

    Please login or register to see this code.

    Maybe like this:

     

    Please login or register to see this code.

    Link to comment
    Share on other sites

  • Topic Author
  • 11 minutes ago, jwi said:

    Maybe like this:

     

    Please login or register to see this code.

    An extra '(' in the beginning?

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Hi, does ER4 has something like find my iPhone ? lately I bought HC3 and trying to move all functionalities from HC2 ER3 to new one, i'll be grateful for any help

    Link to comment
    Share on other sites

    W dniu 28.03.2021 o 14:59, jgab napisał:

    This is the flow I use for ER4

    Please login or register to see this spoiler.

     

     

    Hi again, is Node Red still supported, asking because when enabled I had this, did I miss something? :

    [27.05.2022] [22:54:01] [ERROR] [QUICKAPP22]: QuickApp crashed

    [27.05.2022] [22:54:01] [ERROR] [QUICKAPP22]: EventRunner.lua:83: attempt to index a nil value (global 'Nodered')

     

     

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 10 hours ago, domin12 said:

     

     

    Hi again, is Node Red still supported, asking because when enabled I had this, did I miss something? :

    [27.05.2022] [22:54:01] [ERROR] [QUICKAPP22]: QuickApp crashed

    [27.05.2022] [22:54:01] [ERROR] [QUICKAPP22]: EventRunner.lua:83: attempt to index a nil value (global 'Nodered')

     

    Ok, first the global 'Nodered' should exist. What version of ER4 are you running?

    Secondly, I tested the Nodered code that is commented out in the main file 

    Please login or register to see this code.

    and discovered a bug that I have fixed in v0.80 that I just pushed.

    Edited by jgab
    Link to comment
    Share on other sites

    Godzinę temu, jgab napisał:

     

    Ok, first the global 'Nodered' should exist. What version of ER4 are you running?

    Secondly, I tested the Nodered code that is commented out in the main file 

    Please login or register to see this code.

    and discovered a bug that I have fixed in v0.80 that I just pushed.

    thnx @jgab i'm using the latest one , ER4 v0.79, been installed by theQAUpdater v0.65

    Edited by domin12
    Link to comment
    Share on other sites

  • Topic Author
  • 50 minutes ago, domin12 said:

    thnx @jgab i'm using the latest one , ER4 v0.79, been installed by theQAUpdater v0.65

    You should be able to update to 0.8 with QAUpdater now.

    Why the 'Nodered' global lua variable is not available is a mystery though.

    Can you add

    Please login or register to see this code.

    just before

    Please login or register to see this code.

    to see what value it has.

     

    Link to comment
    Share on other sites

    @jgab to late , i updated it when you pushed new version,and what is wired, downgrade to 0.79 doesn't gave the error anymore

    Link to comment
    Share on other sites

    Hi All, @jgab

    In ER4 i have that rule, it recives data from nodered  :

     

    rule("#bmw_s5 {msg='$msg'} => fibaro.call(74,'updateView','labelPsi','text','Front Left:'..msg.frontLeft.status.currentPressure/100)")
     

    [29.05.2022] [20:31:57] [ERROR] [QUICKAPP22]: in Rule:3[#bmw_s5 {msg='$msg'} => fibaro.call(74,'updateView','labelPsi','text','Front Lef...]: ./include/EventRunner.lua:1953: ./include/EventRunner.lua:1820: Bad arguments to between '...', 'Front Left:' '2.4'

    can You help to write correct rule?, right now it throwing an error. thnx

    Link to comment
    Share on other sites

  • Topic Author
  • '..' is not for concatenating string. '..' is reserved for the between operator.

    Ex. rule("88:breached & 10:00..15:00 => ....")

    Use '++' to concatenate strings

    However, I would recommend using the function 'fmt' - same as Lua's string.format - to create the text string. It will also allow you to control number of decimals

    Please login or register to see this code.

     

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