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

5 minut temu, domin12 napisał:

Jan ,

there is no function called _copy any longer ? 

how could i change this function to get proper working :

Please login or register to see this code.

 

Jan, i copied this function from the old version, and it working

Link to comment
Share on other sites

  • Topic Author
  • 5 minutes ago, domin12 said:

    Jan ,

    there is no function called _copy any longer ? 

    how could i change this function to get proper working :

    Please login or register to see this code.

     

     

    A lot of these functions are moved to Util.

    Please login or register to see this code.

     

    7 minutes ago, jompa68 said:

    Please login or register to see this link.

     

    So, _defaultNodeRed is nil when you invoke the rule. (_NR:nil)

    Do you accidentally set it in another rule or code?

    • Thanks 1
    Link to comment
    Share on other sites

    4 minutes ago, jgab said:

    Do you accidentally set it in another rule or code?

    No, at least what i can see... here is my start code

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Jan, many thanks to You again for support,

    ER is up to date, and everything seems to be ok right now ......

    Edited by domin12
    Link to comment
    Share on other sites

  • Topic Author
  • 7 minutes ago, jompa68 said:

    @jgab it solved now, did not like local _defaultNodeRed

     

    Please login or register to see this code.

     

    Ah, of course. ER rules can only access lua globals. I have tried to  make as many variables local as possible as globals easily makes a mess...

    Instead of making _defaultNodeRed global I will add Util.definevar("_defaultNodeRed",_defaultNodeRed) in the next version (I wait an hour before pushing next version as there may be more bugs to fix)

    Link to comment
    Share on other sites

  • Topic Author
  • Pushed v3 B16.

    _defaultNodeRed is available inside ER rules now. (but you should start to use the nodered() function instead)

     

    Also, now if you have a rule of type

    Please login or register to see this code.

    Because dailys/@ was only rescheduled every midnight, if you changed Test during the day it would not take effect until next day which sometimes was a problem. E.g if you have a VD that allows people to set alarms by setting a fibaro global. Now these rules will automatically reschedule if any globals used in the time expression changes.

    There is an ER command  ''redaily'(<rule>)' to force a reschedule that I may remove in a future release.

    26 minutes ago, jgab said:

    Ah, of course. ER rules can only access lua globals. I have tried to  make as many variables local as possible as globals easily makes a mess...

    Instead of making _defaultNodeRed global I will add Util.definevar("_defaultNodeRed",_defaultNodeRed) in the next version (I wait an hour before pushing next version as there may be more bugs to fix)

     

    But you should be able to use the nodered() function that uses the global _defaultNodeRed variable

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    No Echo from NR (there is nothing changed in NR) and another error

     

    the rules:

      rule([[trigg1=0;trigg2=0;trigg3=0;trigg4=0;trigg5=0;m1=tonumber(screen:value); m2=tonumber(sovm:value);m3=tonumber(tvm:value); m4=tonumber(extram:value);m5=tonumber(altanm:value); yttertemp=tonumber($yttertemperatur); vindstyrka= tonumber($windhastighet); moln=0;lb = tonumber(luxb:value); lf = tonumber(luxf:value)]]) 
      

     rule([[screen:scene >= 21 | screen:scene <= 16 => trigg1 = screen; log('screen:scene = %s',screen:scene)]])
     rule([[sovm:scene >= 21 | sovm:scene <= 16 => trigg2 = sovm; log('sovm:scene = %s',sovm:scene)]])
     rule([[tvm:scene >= 21 | tvm:scene <= 16 => trigg3 = tvm; log('tvm:scene = %s',tvm:scene)]])
     rule([[extram:scene >= 21 | extram:scene <= 16 => trigg4 = extram; log('extram:scene = %s',extram:scene)]])
     rule("sensors={13,370,84,92,34,230,386,439}")
     rule("sensors:breached => d=env.event.deviceID")  --; processOne(d)")

     rule("log('Echo returns %s',nodered(#echo{test='Hello'},true).data.test)")
     
      rule("@@00:01 => nodered(#wetter{}); yttertemp=tonumber($yttertemperatur); vindstyrka= tonumber($windhastighet); vindriktning= $windriktning; regn=tonumber($regn)")
     
     -- rule("@@00:01 => nodered(#egetwetter{data='yttertemp, vindstyrka, vindriktning, regn'})")

      
      rule("#wetter => moln=env.event.data.clouds; lb = tonumber(luxb:value); lf = tonumber(luxf:value); m1=tonumber(screen:value); m2=tonumber(sovm:value); m3=tonumber(tvm:value); m4=tonumber(extram:value); m5=tonumber(altanm:value);log('moln= %s',moln)")

     

    Output:

    ed/Jul/31,16:06:32:[10:1] Scene running
    Wed/Jul/31,16:06:32:[10:1] fibaro:get(arbetsrum.ljus_arbetsrum,"value")="7143.00",1563875101
    Wed/Jul/31,16:06:32:[10:1] fibaro:get(lillasovrum.ljus_lilla_sovrum,"value")="13178.00",1563875102
    Wed/Jul/31,16:06:32:[10:1] fibaro:get(markiser.screen,"value")="98",1563958669
    Wed/Jul/31,16:06:32:[10:1] fibaro:get(markiser.markis_sovrum,"value")="99",1563875101
    Wed/Jul/31,16:06:33:[10:1] fibaro:get(markiser.markis_tv,"value")="99",1563875100
    Wed/Jul/31,16:06:33:[10:1] fibaro:get(markiser.markis_lilla_sov,"value")="99",1563875100
    Wed/Jul/31,16:06:33:[10:1] fibaro:get(markiser.Altanscreen,"value")="98",1563875105
    Wed/Jul/31,16:06:33:[10:1] moln= 75
    Wed/Jul/31,16:06:37:[HC2 ] Error in Scene:10 "NR3TEST.lua:2062: bad argument #2 to 'error' (number expected, got string)"
    stack traceback:
        HC2.lua:1481: in function 'runTimers'
        HC2.lua:227: in function 'startup'
        HC2.lua:3493: in main chunk
        [C]: in function 'dofile'
        NR3TEST.lua:23: in main chunk

    Link to comment
    Share on other sites

  • Topic Author
  • 38 minutes ago, FrankT said:

    No Echo from NR (there is nothing changed in NR) and another error

     

    the rules:

      rule([[trigg1=0;trigg2=0;trigg3=0;trigg4=0;trigg5=0;m1=tonumber(screen:value); m2=tonumber(sovm:value);m3=tonumber(tvm:value); m4=tonumber(extram:value);m5=tonumber(altanm:value); yttertemp=tonumber($yttertemperatur); vindstyrka= tonumber($windhastighet); moln=0;lb = tonumber(luxb:value); lf = tonumber(luxf:value)]]) 
      

     rule([[screen:scene >= 21 | screen:scene <= 16 => trigg1 = screen; log('screen:scene = %s',screen:scene)]])
     rule([[sovm:scene >= 21 | sovm:scene <= 16 => trigg2 = sovm; log('sovm:scene = %s',sovm:scene)]])
     rule([[tvm:scene >= 21 | tvm:scene <= 16 => trigg3 = tvm; log('tvm:scene = %s',tvm:scene)]])
     rule([[extram:scene >= 21 | extram:scene <= 16 => trigg4 = extram; log('extram:scene = %s',extram:scene)]])
     rule("sensors={13,370,84,92,34,230,386,439}")
     rule("sensors:breached => d=env.event.deviceID")  --; processOne(d)")

     rule("log('Echo returns %s',nodered(#echo{test='Hello'},true).data.test)")
     
      rule("@@00:01 => nodered(#wetter{}); yttertemp=tonumber($yttertemperatur); vindstyrka= tonumber($windhastighet); vindriktning= $windriktning; regn=tonumber($regn)")
     
     -- rule("@@00:01 => nodered(#egetwetter{data='yttertemp, vindstyrka, vindriktning, regn'})")

      
      rule("#wetter => moln=env.event.data.clouds; lb = tonumber(luxb:value); lf = tonumber(luxf:value); m1=tonumber(screen:value); m2=tonumber(sovm:value); m3=tonumber(tvm:value); m4=tonumber(extram:value); m5=tonumber(altanm:value);log('moln= %s',moln)")

     

    Output:

    ed/Jul/31,16:06:32:[10:1] Scene running
    Wed/Jul/31,16:06:32:[10:1] fibaro:get(arbetsrum.ljus_arbetsrum,"value")="7143.00",1563875101
    Wed/Jul/31,16:06:32:[10:1] fibaro:get(lillasovrum.ljus_lilla_sovrum,"value")="13178.00",1563875102
    Wed/Jul/31,16:06:32:[10:1] fibaro:get(markiser.screen,"value")="98",1563958669
    Wed/Jul/31,16:06:32:[10:1] fibaro:get(markiser.markis_sovrum,"value")="99",1563875101
    Wed/Jul/31,16:06:33:[10:1] fibaro:get(markiser.markis_tv,"value")="99",1563875100
    Wed/Jul/31,16:06:33:[10:1] fibaro:get(markiser.markis_lilla_sov,"value")="99",1563875100
    Wed/Jul/31,16:06:33:[10:1] fibaro:get(markiser.Altanscreen,"value")="98",1563875105
    Wed/Jul/31,16:06:33:[10:1] moln= 75
    Wed/Jul/31,16:06:37:[HC2 ] Error in Scene:10 "NR3TEST.lua:2062: bad argument #2 to 'error' (number expected, got string)"
    stack traceback:
        HC2.lua:1481: in function 'runTimers'
        HC2.lua:227: in function 'startup'
        HC2.lua:3493: in main chunk
        [C]: in function 'dofile'
        NR3TEST.lua:23: in main chunk

    Have you updated to the latest version, it was a bug in earlier version of v3.0. 

    Latest is "3.0","B16"

     

    Did you update the NR flow (it's the encodeEvent node that have changed for v3.0)

    Edited by jgab
    Link to comment
    Share on other sites

    Jan sorry did you have any idea?

    IOSLocator:

    rule("phoneID=447")

    error>>call global nil value

    447 and 470 are listed in IOS Fibaro both have error

    Please advice.

    Link to comment
    Share on other sites

  • Topic Author
  • 52 minutes ago, Sjakie said:

    Jan sorry did you have any idea?

    IOSLocator:

    rule("phoneID=447")

    error>>call global nil value

    447 and 470 are listed in IOS Fibaro both have error

    Please advice.

    Sorry, spelling error.

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

     

     

    2 hours ago, jgab said:

    Have you updated to the latest version, it was a bug in earlier version of v3.0. 

    Latest is "3.0","B16"

     

    Did you update the NR flow (it's the encodeEvent node that have changed for v3.0) 

    Updated now to 3.0,B16, but in your post from yesterday you didn't show the encodeEvent node but the PollySonos node. How should the encodeEvent node be changed?

    •  
     

     

    Link to comment
    Share on other sites

    Sorry Jan, same error

    Please login or register to see this image.

    /monthly_2019_07/image.png.3f701437d489b5229fe7a368e1eb7ef7.png" />

    Link to comment
    Share on other sites

  • Topic Author
  • 1 minute ago, Sjakie said:

    Sorry Jan, same error

    Please login or register to see this link.

    change 'rule' to 'Rule.eval'

    2 minutes ago, FrankT said:

     

    pdated now to 3.0,B16, but in your post from yesterday you didn't show the encodeEvent node but the PollySonos node. How should the encodeEvent node be changed?

     

     

    The javascript in the encodeEvent node should be

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Jan,

    Please login or register to see this image.

    /monthly_2019_07/image.png.e111f7370a8170fafc6d2f97997c92aa.png" />

    Link to comment
    Share on other sites

  • Topic Author
  • 1 minute ago, Sjakie said:

    Jan,

    Please login or register to see this link.

     

    Are you inside main() ?

    Link to comment
    Share on other sites

    nope!!! You are great!!!

    Please login or register to see this image.

    /monthly_2019_07/image.png.5a1460a5b876c0b0e600bfadb6cb4cf9.png" />

    Link to comment
    Share on other sites

    24 minutes ago, jgab said:

    he javascript in the encodeEvent node should be

    Please login or register to see this code.

    Thank you Jan, now all my flows are working in V3. GREAT!  I have no experience in JavaScript, but better in ancient Fortran

    /F

    Link to comment
    Share on other sites

  • Topic Author
  • Pushed V3 B17.

    Nasty bug that effected ER rule with a 'wait' as last command (or any other command that did a coroutine 'suspend' as last instruction).

     

    Link to comment
    Share on other sites

    @jgab One more question

    i have rule :

    rule([[{945,1057}:breached & 20:00..23:58 =>||744:isOff >> log('..lights on...'); 744:on]])  

    which does not work because of the range of hours, how to improve it to work properly?

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