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

No, I guess that problem will be with reading of value from TCPPort

  • Topic Author
  • Posted

    Maintenance release of EventRunner.lua, HC2.lua, and HC2Plugin.lua

     

    EventRunner has a patched setTimeout that allows for times longer than 74 days... and better error handling on calling fibaro:get/call on null deviceIDs and other small fixes

    HC2.lua only minor fixes

    HC2Plugin.lua uses loop-back 127.0.0.1 to get to the server, allows to connect when no network present.

     

    On 4/16/2019 at 11:06 AM, petrkl12 said:

    No, I guess that problem will be with reading of value from TCPPort

     

    Have been chasing this but can't replicate it unless the deviceID really is nil. I have added more checks in the code. 

    Is it still a problem?

    /J

    Posted

    It wasn't nil -  it was string but it was OK in previous versions.

    So I had to add conversion tonumber() into every get and call commands -  now it works

     

     

     

     

    Posted

    Hi jgab,

    I started with your Event Single scene but be patience with me.

    I have some minor probs to understand

    --There are 5 curtains to close , can I change on in close? and prefereable 5 sec in between to close OR can I add the "curtain close scene"? No idea how

    -- if the curtains are closed (should be nice)

    Than to open I think I need to add the time of tghe day to prevent pendeling of the curtains >> I do not know how

     

     

     -- Trigger rules
      Rule.eval("myLightSensor1:lux < 60 => myCurtainFront:on")       
      -- I prefere 5 sec break to imitate "hand"closure of curtains
      Rule.eval("myCurtainFront:isOn => myCurtainSideBicycle:on")   
      Rule.eval("myCurtainSideBicycle:isOn => myCurtainSideCar:on")  
      Rule.eval("myCurtainSideCar:isOn => myCurtainBack:on")
      Rule.eval("myCurtainBack:isOn => myCurtainBackSide:on")
     -- this will conflict with above how I can add GV timeofDay
      Rule.eval("myLightSensor2:lux > 105 => myCurtainFront:on")
     

  • Topic Author
  • Posted
    2 hours ago, Sjakie said:

    Hi jgab,

    I started with your Event Single scene but be patience with me.

    I have some minor probs to understand

    --There are 5 curtains to close , can I change on in close? and prefereable 5 sec in between to close OR can I add the "curtain close scene"? No idea how

    -- if the curtains are closed (should be nice)

    Than to open I think I need to add the time of tghe day to prevent pendeling of the curtains >> I do not know how
     

     

    Ok, wait is easy, this will close them in sequence with 5secs interval

    Please login or register to see this code.

    Could also do something like below but then you need to repeat it for the second sensor rule.

    Please login or register to see this code.

     

    If you only want it to happen once in the morning and once in the evening you can do

    Please login or register to see this code.

    05:00..09:00 is a test only true in that interval, once(<expr>) is true the first time the expression is true and then need to be false before it can become true again. Effectively limiting the rule to be true once between 05:00..09:00 if sensor1 is less than 60.

     

    Shouldn't the last test be something closing the curtains?

    Posted

    Thanks

    I need to understand it. Its  complicated at this moment. I was working with GV mostly now I must get rid of that way of thinking. Yours is more flexible you can change any line in what you want!

    on = close off is open?

    I installed ZeroBrane and that is more clear to work with as in HC2 (as long it will not give an error, hahaha

     

     

     

  • Topic Author
  • Posted
    12 minutes ago, Sjakie said:

    Thanks

    I need to understand it. Its  complicated at this moment. I was working with GV mostly now I must get rid of that way of thinking. Yours is more flexible you can change any line in what you want!

    on = close off is open?

    I installed ZeroBrane and that is more clear to work with as in HC2 (as long it will not give an error, hahaha

     

     

     

    :on and :off translates to fibaro:call(Dev,”turnOn”) resp “turnOff”, so it depends on what your devices react on.

    Posted

    Hi jgab,

    I  start to understand (I hope)

    please check if you want this is my 2nd scene later I will join them together.

    If luxlevel < 3 light on in steps of 5 seconds.

    than depends is PresentguestBeneden is ligyht goes on yes/no (no guest light on)

    But in case light is not switched on still give the command together with other lights to switch off?

    In my opinion the easiest way oris there a better way.

    Remark: I changed the GV in a device ID (presence of guest boven/ beneden.

    Please correct me?

    btw Zerobrane is not showing that terrible red dot if  you copy and paste!!!

    Thanks in advance

     

     Rule.eval("myLightSensorBuAchter:lux =< 3 => myVerlFietsenhok:on")
      Rule.eval("myVerlFietsenhok:isOn => wait(00:00:05); myVerlVlag:on")
      
      Rule.eval("myVerlVlag, PresentGastBeneden:isOff => wait(00:00:10); myVerlGastAchterdeur:on")
      Rule.eval("myVerlVlag, PresentGastBeneden:isOff => wait(00:00:10); myVerlBeeldBuiten:on")

      Rule.eval("myVerlVlag, PresentGastBoven:isOff => wait(00:00:15); myVerlSerre1x:on")
      
     
     Rule.eval("myLightSensorBuVoor:lux > 3 => myVerlFietsenhok:off") 
      
     Rule.eval("myVerlFietsenhok:isOff => wait(00:00:05); myVerlVlag:off")
     Rule.eval("myVerlFietsenhok:isOff => wait(00:00:20); myVerlGastAchterdeur:off")
     Rule.eval("myVerlFietsenhok:isOff => wait(00:00:25); myVerlBeeldBuiten:off")

     Rule.eval("myVerlFietsenhok:isOff => wait(00:00:30); myVerlSerre1x")

    Posted

    Hi,

    If I run the EventRunner I see 20 light blue lines in debug, I hope it will be executed tomorrow.

    One was red but after some time I found out that => 3 causes that error, changed iyt in only > 3

    How to write

     Rule.eval("23:15 => myVerlVlag:off")

    I tried wit @  n all are wrong

    thanks in advance

  • Topic Author
  • Posted (edited)
    8 hours ago, Sjakie said:

    Hi,

    If I run the EventRunner I see 20 light blue lines in debug, I hope it will be executed tomorrow.

    One was red but after some time I found out that => 3 causes that error, changed iyt in only > 3

    How to write

     Rule.eval("23:15 => myVerlVlag:off")

    I tried wit @  n all are wrong

    thanks in advance

     

    You mean in the debug window on the HC2?

    Light blue and rules being defined and there is usually one red line in the beginning too ("Slow mailbox watch:...") that can be ignored.

    Other red lines are usually errors in rules.

    I don't understand the "I found out that => 3 causes that error, changed iyt in only > 3" . can you elaborate?

    Ok, '=>' is used for defining a rule (<test> => <actions>), >= is the comparison test, like 7>= 3....

    Rules that should happen on a specific time is written with '@'

    Please login or register to see this code.

    will turn off device 'myVerlVlag' at 23:15 in the evening.

    Edited by jgab
  • Topic Author
  • Posted
    12 hours ago, Sjakie said:

    Hi jgab,

    I  start to understand (I hope)

    please check if you want this is my 2nd scene later I will join them together.

    If luxlevel < 3 light on in steps of 5 seconds.

    than depends is PresentguestBeneden is ligyht goes on yes/no (no guest light on)

    But in case light is not switched on still give the command together with other lights to switch off?

    I don't understand, can you elaborate..?

    12 hours ago, Sjakie said:

    In my opinion the easiest way oris there a better way.

    Remark: I changed the GV in a device ID (presence of guest boven/ beneden.

    Please correct me?

    Are any of the variables fibaro global variables? I assumed that 'PresentGastBeneden' is a device?

    You can also easily use global variables in rules if you need to (prefix with '$')

     

    12 hours ago, Sjakie said:

    btw Zerobrane is not showing that terrible red dot if  you copy and paste!!!

    ZeroBrane is not showing the dot which is a problem... my HC2 emulator tries to inspect the code for a dot and log a warning.

     

    12 hours ago, Sjakie said:

    Thanks in advance

     

    12 hours ago, Sjakie said:

     Rule.eval("myLightSensorBuAchter:lux =< 3 => myVerlFietsenhok:on")
      Rule.eval("myVerlFietsenhok:isOn => wait(00:00:05); myVerlVlag:on")
      
      Rule.eval("myVerlVlag, PresentGastBeneden:isOff => wait(00:00:10); myVerlGastAchterdeur:on")
      Rule.eval("myVerlVlag, PresentGastBeneden:isOff => wait(00:00:10); myVerlBeeldBuiten:on")

      Rule.eval("myVerlVlag, PresentGastBoven:isOff => wait(00:00:15); myVerlSerre1x:on")


     Rule.eval("myLightSensorBuVoor:lux > 3 => myVerlFietsenhok:off") 
      
     Rule.eval("myVerlFietsenhok:isOff => wait(00:00:05); myVerlVlag:off")
     Rule.eval("myVerlFietsenhok:isOff => wait(00:00:20); myVerlGastAchterdeur:off")
     Rule.eval("myVerlFietsenhok:isOff => wait(00:00:25); myVerlBeeldBuiten:off")

     Rule.eval("myVerlFietsenhok:isOff => wait(00:00:30); myVerlSerre1x")

     

    I think what you want to do is

    Please login or register to see this code.

    The sixth rule will trigger every time 'myLightSensorBuVoor' reports a lux value larger than 3. To avoid that and only trigger once do

    Please login or register to see this code.

    That means that 'myLightSensorBuVoor' needs to go below 4 before it can trigger on a value greater than 3 again.

    Posted

    Good morning,

    Understand the comment.

     Rule.eval("once (myLightSensorBuVoor:lux > 3 => myVerlFietsenhok:off")


    gives an error

    Please login or register to see this image.

    /monthly_2019_04/image.png.54a25ff528667f186a8297b6cd0e2333.png" alt="image.png.54a25ff528667f186a8297b6cd0e2333.png" />

  • Topic Author
  • Posted
    1 minute ago, Sjakie said:

    Good morning,

    Understand the comment.

     Rule.eval("once (myLightSensorBuVoor:lux > 3 => myVerlFietsenhok:off")


    gives an error

    Please login or register to see this link.

     

    You are missing a ')' after the 3 to close the parenthesis. 

    Posted

    Are any of the variables fibaro global variables? I assumed that 'PresentGastBeneden' is a device? >>>>>>Was a GV but in reality its a push button

    You can also easily use global variables in rules if you need to (prefix with '$')

    How too?

    $TimeofDay,Morning

    Thanks in advance

     

  • Topic Author
  • Posted
    Just now, Sjakie said:

    Are any of the variables fibaro global variables? I assumed that 'PresentGastBeneden' is a device? >>>>>>Was a GV but in reality its a push button

    You can also easily use global variables in rules if you need to (prefix with '$')

    How too?

    $TimeofDay,Morning

    Thanks in advance

     

    Please login or register to see this code.

    So, you can set and get globals easily,. They have to exists or you get an error. Note that they always return strings but it works to compare a number with a string in rules.

    Posted

    Hi, is there a bigg diference in or using GV or trigger from device? I asume device trigger is faster and less load for the HC2?

     

  • Topic Author
  • Posted (edited)
    2 minutes ago, Sjakie said:

    Hi, is there a bigg diference in or using GV or trigger from device? I asume device trigger is faster and less load for the HC2?

     

    If you have a switch or pushbutton it's better to trigger directly on them changing state, then to first set a GV and then trigger on the GV.

    You can also trigger rules when GV change values

    Please login or register to see this code.

    will trigger the rule whenever you change the value of the GV 'TimeOfDay' to "Morning". Ex. if you do it from a VD, (or from another rule)

    Edited by jgab
    Posted

    Thought so, thanks for now I gonna make some triggers and have the intention to go "live" today.

    Have a nice day!

  • Topic Author
  • Posted (edited)

    The installation instructions for EventRunner was terribly out-of-date and have been updated. I will improve it over time (and maybe do another video) 

    At least it is correct now with the introduction of the HC2 emulator.

    At least it has become much easier to install now with less files to depend on, just HC2.lua... :-) 

    Edited by jgab
    Posted

    aha good, a few of your download links did not work either.

    Perhaps a good idea for newbies like me to add a few more examples of how to trigger and to execute. I was lost in all the scenes after reading 49 pages here on the forum, hahahaha

    You know I started a few months ago with event runner but it was to complicated for me. So I started with converting block scenes in LUA.

    I regret the way I did if I had more currige to continue with event runner my life should have been more easier.

    As far as I see it now, a few things are running now with event runner.

    Heater and announcement still to solve and after that all my scenes are in event runner I will also move my arm/ disarm

    My compliments for this excellent tool and for sure I will come back to you with other questions or minor problems.

    Thanks again

     

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