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

 

Please login or register to see this attachment.

 

              Rule.eval("@23:10 & day('sat') & hal.locatiegezin:isOff => post(#flaglightOff);  lightsHal:on ; wait(00:00:05) ; lightsHouse:off ;  wait(00:00:10) ; lightsHfdslpkmr:on ; wait(00:00:20) ; lightsHal:on ;wait(00:04:30) ; lightsHfdslpkmr:off; log('Avond verlichting op tijd uit als wij afwezig zijn')")

 

What should be in header?

Please login or register to see this attachment.

Link to comment
Share on other sites

  • Topic Author
  • 58 minutes ago, Sjakie said:

    Hi Jan,

    Is one mailbox message not enough?

    Please login or register to see this attachment.

    It's only one. set _debugFlags.fglobal=false so you don't have to see it. I will set it to false as the default in next version.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, Sjakie said:

    Okay will update.

    Jan ready for the next one?

    Rule.eval("$StookSeizoen=='Ja' & hal.locatiegezin:isOn & once(trueFor(00:05,eetkamer.deur:breached)=> remote(_myNodeRed,#speak{data='de deur naar de serre is open en de thermostaat wordt ingesteld op 17 graden'})  ; httpGet('http://192.168.1.101/data.json?heater=0&setpoint=120&thermostat=0'); log('Verwarming uit serre op temperatuur')")

     

    Please login or register to see this attachment.

     

     

    You are missing a ')' for the 'once' command. However, I'm not sure this works anyway (combining for and once this way - I removed the once in the version below)

    Please login or register to see this code.

     

    26 minutes ago, Sjakie said:

     

    Please login or register to see this attachment.

     

                  Rule.eval("@23:10 & day('sat') & hal.locatiegezin:isOff => post(#flaglightOff);  lightsHal:on ; wait(00:00:05) ; lightsHouse:off ;  wait(00:00:10) ; lightsHfdslpkmr:on ; wait(00:00:20) ; lightsHal:on ;wait(00:04:30) ; lightsHfdslpkmr:off; log('Avond verlichting op tijd uit als wij afwezig zijn')")

     

    What should be in header?

    Please login or register to see this attachment.

     

    The rule i is complaining about is something that looks like 

    Rule.eval("post(#flaglightOff) => remote(1627,...

    which is wrong. You need to start with a trigger like an event. Do you mean Rule.eval("#flaglightOff => remote... ?

     

    Link to comment
    Share on other sites

  • Topic Author
  • 56 minutes ago, Sjakie said:

    Jan,

      Rule.eval("achtertuin.fontein:isOn =>  remote(_myNodeRed,#speak{data='de fontein wordt gestart'}) ,10*repeat(0)")


    Here I am clue less!

    Please login or register to see this attachment.

     

    You have ",10*repeat(0)")" at the end of the rule that doesn't make sense. Is it a trueFor-again missing ? 

    Link to comment
    Share on other sites

    Jan,

    To be honest I have no idea.

    Can it be the fountain start >>message if starts within 10 minutes no annoucement or something like that?

    Link to comment
    Share on other sites

  • Topic Author
  • 54 minutes ago, FrankT said:

    @jgab

    Hm, testing. Got error 'Error loading rules:NR3TEST.lua:1814: NR3TEST.lua:1650: attempt to index local 'res' (a nil value)'

     

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

     

    Ok this seems to be the same problem as @jompa68 has. The solution for now is to set the interpreter in ZBS to Lua 5.2. I will investigate to understand what is going on with the different versions of Lua.

    Link to comment
    Share on other sites

    5 minutes ago, jgab said:

     

    Ok this seems to be the same problem as @jompa68 has. The solution for now is to set the interpreter in ZBS to Lua 5.2. I will investigate to understand what is going on with the different versions of Lua.

    OK, now working with 5.2.

    Link to comment
    Share on other sites

    Hello Jan

     

    Please login or register to see this attachment.

     

    Please login or register to see this image.

    /monthly_2019_07/image.png.bc5deda6724f4dfcff12555f9e2ac340.png" />

    Link to comment
    Share on other sites

    @jgab Hi, Jan

    more problems

     

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

     rule("nodered(#echo{test='Hello'})")

     

     

     Error in 'nodered(#echo{test='Hello'})': NR3TEST.lua:337: bad argument #1 to 'abs' (number expected, got nil)
    Tue/Jul/30,17:26:05:[10:1] 
    Line 335:      else fibaro:startScene(sceneID,payload) end -- call other scene on HC2
    Line 336:    else -- on emulator
    Line 337:>>>      fibaro:startScene(math.abs(sceneID),payload)
    Line 338:    end
    Line 339:  end

    Tue/Jul/30,17:26:05:[10:1] Error loading rules:NR3TEST.lua:1903: NR3TEST.lua:337: bad argument #1 to 'abs' (number expected, got nil)

    Link to comment
    Share on other sites

    Hello Jan,

    Can you give me line to get every hour a log?

    You sure that your position changed (enough?). You could log every time you get a new position to see if it works. 

    Thanks for your effort and support

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, FrankT said:

    OK, now working with 5.2.

     

    Ok, pushed new version of HC2.lua that fixes the problem (was a "bug" in Lua 5.1 version of table.unpack)

    However, I would recommend to run under v5,2 as that is the same as on the HC2.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 49 minutes ago, FrankT said:

    @jgab Hi, Jan

    more problems

     

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

     rule("nodered(#echo{test='Hello'})")

     

     

     Error in 'nodered(#echo{test='Hello'})': NR3TEST.lua:337: bad argument #1 to 'abs' (number expected, got nil)
    Tue/Jul/30,17:26:05:[10:1] 
    Line 335:      else fibaro:startScene(sceneID,payload) end -- call other scene on HC2
    Line 336:    else -- on emulator
    Line 337:>>>      fibaro:startScene(math.abs(sceneID),payload)
    Line 338:    end
    Line 339:  end

    Tue/Jul/30,17:26:05:[10:1] Error loading rules:NR3TEST.lua:1903: NR3TEST.lua:337: bad argument #1 to 'abs' (number expected, got nil)

     

    It changed from _myNodeRed to _defaultNodeRed

    Please login or register to see this code.

    The reason is that nodered() can take an extra argument to talk to another nodered node.

    (But I will fix a better error message)
     

    Link to comment
    Share on other sites

    7 minutes ago, jgab said:

     

    It changed from _myNodeRed to _defaultNodeRed

    Please login or register to see this code.

    The reason is that nodered() can take an extra argument to talk to another nodered node.

    (But I will fix a better error message)
     

    Yes I noticed and changed _defaultNodeRed to _myNodeRed. Can't do?

     

    local _sceneName   = "NR3"      -- Set to scene/script name
    local _homeTable   = "HomeTable" -- Name of your HomeTable variable (fibaro global)
    local _HueHubs     = {}          -- Hue bridges, Ex. {{name='Hue',user=_HueUserName,ip=_HueIP}}
    local _myNodeRed   = "http://192.168.1.158:1880/eventrunner" -- 

    Link to comment
    Share on other sites

  • Topic Author
  • 31 minutes ago, Sjakie said:

    Hello Jan,

    Can you give me line to get every hour a log?

    You sure that your position changed (enough?). You could log every time you get a new position to see if it works. 

    Thanks for your effort and support

     

    This should work. No use to poll every hour as the iosLocator will send as soon as it gets a new position for a user.

    Please login or register to see this code.

     

    2 minutes ago, FrankT said:

    Yes I noticed and changed _defaultNodeRed to _myNodeRed. Can't do?

     

    local _sceneName   = "NR3"      -- Set to scene/script name
    local _homeTable   = "HomeTable" -- Name of your HomeTable variable (fibaro global)
    local _HueHubs     = {}          -- Hue bridges, Ex. {{name='Hue',user=_HueUserName,ip=_HueIP}}
    local _myNodeRed   = "http://192.168.1.158:1880/eventrunner" -- 

     

    No the other way around. _myNodeRed should change to _defaultNodeRed

    Please login or register to see this code.

    If you have old code using _myNodeRed define both to the same value.

    Edited by jgab
    Link to comment
    Share on other sites

    Hello Jan,

    its not ER?

    Please login or register to see this image.

    /monthly_2019_07/image.png.c990f55d522ecd097446ec8811a70ac6.png" />

    Nodered adapted as you described, rule added on ESceneID

    In nodered payload with message

    Please advice,

     

     

    Link to comment
    Share on other sites

    7 hours ago, jgab said:

    You run the latest version of HC2.lua? "0.11","fix6"

     

    If you run the latest, post me you pub/sub scenes so I can try them out.

    Looking good now @jgab

     

    Please login or register to see this code.

    Will continue the migrate now, i might find something more to ask about later ?

    Link to comment
    Share on other sites

    ok first "for" rule gives error. I now the logic have been changed but i need a push into right direction.

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 7 minutes ago, jompa68 said:

    ok first "for" rule gives error. I now the logic have been changed but i need a push into right direction.

    Please login or register to see this code.

     

    for -> trueFor

    Link to comment
    Share on other sites

    Hello Jan,

    Please can you explain??

    This rule gave error index field

    I was checking the rule the debug window refreshed(full) and error gone, without edit anything.

    Is it your magic hand?

    Please login or register to see this image.

    /monthly_2019_07/image.png.acd2cfab94557c6e0f0c14d2d54de677.png" />

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