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
On 12/28/2018 at 12:35 AM, jgab said:

eventrunner

Thank you for tour help. Brilliant what can be done with Your Er.

Posted

What I am doing wrong?

If one of the two doors is open light >>off

Both doors closed light off

%% value for:

deurHfdSlpkmr

deurGastboven

lightSensorBuVoor

 

 

 Rule.eval("deurHfdSlpkmr:isBreached & deurGastboven:isBreached => stekkerTrap:off & stekkerLedOverloop:off ")
   Rule.eval("deurHfdSlpkmr:isSafe & deurGastboven:isSafe => stekkerTrap:on & stekkerLedOverloop:on ")
       
   Rule.eval("once(lightSensorBuVoor:lux > 201) & deurHfdSlpkmr:isBreached & deurGastboven:isSafe => stekkerTrap:off & stekkerLedOverloop:off ")
   Rule.eval("once(lightSensorBuVoor:lux > 201) & deurGastboven:isBreached & deurHfdSlpkmr:isSafe => stekkerTrap:off & stekkerLedOverloop:off ")
   Rule.eval("once(lightSensorBuVoor:lux < 200) => stekkerTrap:on & stekkerLedOverloop:on ")
 

Thanks for your support

  • Topic Author
  • Posted (edited)
    On 5/5/2019 at 4:51 PM, Sjakie said:

    What I am doing wrong?

    If one of the two doors is open light >>off

    Both doors closed light off

    %% value for:

    deurHfdSlpkmr

    deurGastboven

    lightSensorBuVoor

     

     

     Rule.eval("deurHfdSlpkmr:isBreached & deurGastboven:isBreached => stekkerTrap:off & stekkerLedOverloop:off ")
       Rule.eval("deurHfdSlpkmr:isSafe & deurGastboven:isSafe => stekkerTrap:on & stekkerLedOverloop:on ")
           
       Rule.eval("once(lightSensorBuVoor:lux > 201) & deurHfdSlpkmr:isBreached & deurGastboven:isSafe => stekkerTrap:off & stekkerLedOverloop:off ")
       Rule.eval("once(lightSensorBuVoor:lux > 201) & deurGastboven:isBreached & deurHfdSlpkmr:isSafe => stekkerTrap:off & stekkerLedOverloop:off ")
       Rule.eval("once(lightSensorBuVoor:lux < 200) => stekkerTrap:on & stekkerLedOverloop:on ")
     

    Thanks for your support

     

    You mean if one door open light on, if both closed light off?

    The functions are :breached and :safe, not :isBreached and :isSafe

    Please login or register to see this code.

    The second set of rules with lux are a bit tricky to understand what you want. Is the "main" trigger the lux or the sensors being breached/safe?

    To be more precise: There are 3 distinct events that trigger the rule; Lux > 201, deurHfdSlpkmr breached, deurGastboven safe

    AND when the rule trigger all of these 3 conditions need to be true for the action to happen.

    So, my interpretation is; The first time when Lux > 201, when deurHfdSlpkmr is breached and deurGastboven is safe do turn off the lights. And don't do that again until Lux has been below 201 and come back over 201 again.

    Then it would be expressed as

    Please login or register to see this code.

    But it's of course still unclear if that is your intention?

     

    P.S I'm away on a business trip this week and may be a bit slow in responses.

    Edited by jgab
    Posted
    18 hours ago, jgab said:

     

    You mean if one door open light on, if both closed light off?

    The functions are :breached and :safe, not :isBreached and :isSafe

    Please login or register to see this code.

    The second set of rules with lux are a bit tricky to understand what you want. Is the "main" trigger the lux or the sensors being breached/safe?

    To be more precise: There are 3 distinct events that trigger the rule; Lux > 201, deurHfdSlpkmr breached, deurGastboven safe

    AND when the rule trigger all of these 3 conditions need to be true for the action to happen.

    So, my interpretation is; The first time when Lux > 201, when deurHfdSlpkmr is breached and deurGastboven is safe do turn off the lights. And don't do that again until Lux has been below 201 and come back over 201 again.

    Then it would be expressed as

    Please login or register to see this code.

    But it's of course still unclear if that is your intention?

     

    P.S I'm away on a business trip this week and may be a bit slow in responses.

    Thanks,

    the rules with lux I will change in time rules will come back on it

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

    Thanks,

    the rules with lux I will change in time rules will come back on it

    Actually thinking more about it, do you really need the 'once' statement? If lux>201 and sensors are triggered, turn off the light.

    Otherwise you limit it to the first time lu is over 201

    Please login or register to see this code.

    You will not get a lot of triggers for lux because it varies quite slowly, it's goin to be the motion sensors that most decide if this rule runs. The lux test just tell us to ignore the motion sensor when the lux is less than 201.

    Posted

    hi jgab,

    I have something else I dont get fully.

    my rules, just for test execute on time

     ----- GastenBoven Nee Beveiliging:


              Rule.eval("dwSensorsGastenKamerBoven = {54, 176, 77, 221} ") --deurhuis--deurGastBoven, raamrechts, raamlinks[ housedoor-doorguestupstairs-windowright-windowleft
              Rule.eval("pirSensorsGastenKamerBoven = {}")

       Rule.eval("@11:47=> dwSensorsGastenKamerBoven:armed & pirSensorsGastenKamerBoven:armed=1;log('Armed')")

     

     

    54 house door I can imagine because in the device is a delay of 45 sec

    176 door not armed

    kitchen.motion is???????????????????????? see screenshot number 77 is named different, where I can find kitchen.motion?? I will remove 77 and reinstall.

    -Just 221 is armed according log

    -in device of HC2 nothing is shown as arm

    -in alarm panel view nothing is also listed as arm perhaps because of devices not armed

     

     

     

     

    Please login or register to see this attachment.

     

    Please login or register to see this attachment.

     

    Please login or register to see this attachment.

     

     

    if I change rule

    Rule.eval("@12:17 =>  deurHuisVoor:armed=1 & deurGastBoven:armed=1 & sensorRechtsGastBvn:armed=1 & sensorLinksGastBvn:armed=1;log('Armed')")

     

    12:17:07 armed all?

    In device all are armed

     

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

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

    hi jgab,

    I have something else I dont get fully.

    my rules, just for test execute on time

     ----- GastenBoven Nee Beveiliging:


              Rule.eval("dwSensorsGastenKamerBoven = {54, 176, 77, 221} ") --deurhuis--deurGastBoven, raamrechts, raamlinks[ housedoor-doorguestupstairs-windowright-windowleft
              Rule.eval("pirSensorsGastenKamerBoven = {}")

       Rule.eval("@11:47=> dwSensorsGastenKamerBoven:armed & pirSensorsGastenKamerBoven:armed=1;log('Armed')")

    54 house door I can imagine because in the device is a delay of 45 sec

    176 door not armed

    kitchen.motion is???????????????????????? see screenshot number 77 is named different, where I can find kitchen.motion?? I will remove 77 and reinstall.

    -Just 221 is armed according log

    -in device of HC2 nothing is shown as arm

    -in alarm panel view nothing is also listed as arm perhaps because of devices not armed

    if I change rule

    Rule.eval("@12:17 =>  deurHuisVoor:armed=1 & deurGastBoven:armed=1 & sensorRechtsGastBvn:armed=1 & sensorLinksGastBvn:armed=1;log('Armed')")

     

    12:17:07 armed all?

    In device all are armed

    :armed is an action (like :on) that doesn't return a value. :isOn and :breached are test that return a value (true or false).

    In fact, not returning a value in Lua means returning null which is interpreted as false.

    So it is not correct to do 

    Please login or register to see this code.

    "dwSensorsGastenKamerBoven:arme" returns a table of the current "armed" values of the devices but don't arm them. you should do

    Please login or register to see this code.

     

     

    Posted

    okay, thanksss!

    New problem, hehehe

    Hue will not switch off.

     

    Rule.eval("stekkerCam:isOn => hueAmbiTvLight:off & huePlafondKlokzijde:off & hueSpotKastLinks:off & hueSchilderijRechts:off & hueSchilderijLinks:off & hueBeeldLinks:off & hueBeeldRechts:off & hueSpotArletaStoel:off  & huePlafondTvZijde:off & hueSpotKastRechts:off")

     

    before restart it also gave once a error message in windows about server connection.

    HC2 and Hue are on the same router

    After restart HC2 and Hue bridge >>ER will not do anything I trigger 5 times and nothing in debug also no report of trigger!

    If I switch all hues on in app I can switch off in HC2 without any error or dis function.

    Still on HC2 4.53 and ER 36

    Please advice

    Please login or register to see this image.

    /monthly_2019_05/image.png.b0bfc36769291f09a57e681e84c001f3.png" alt="image.png.b0bfc36769291f09a57e681e84c001f3.png" />

  • Topic Author
  • Posted
    On 5/8/2019 at 10:09 AM, Sjakie said:

    okay, thanksss!

    New problem, hehehe

    Hue will not switch off.

     

    Rule.eval("stekkerCam:isOn => hueAmbiTvLight:off & huePlafondKlokzijde:off & hueSpotKastLinks:off & hueSchilderijRechts:off & hueSchilderijLinks:off & hueBeeldLinks:off & hueBeeldRechts:off & hueSpotArletaStoel:off  & huePlafondTvZijde:off & hueSpotKastRechts:off")

     

    before restart it also gave once a error message in windows about server connection.

    HC2 and Hue are on the same router

    After restart HC2 and Hue bridge >>ER will not do anything I trigger 5 times and nothing in debug also no report of trigger!

    If I switch all hues on in app I can switch off in HC2 without any error or dis function.

    Still on HC2 4.53 and ER 36

    Please advice

    Please login or register to see this link.

     

    Ok,

    on the right-hand side you should never use "A & B & C ..." if you don't mean "If A then If B then If C  then ..." because that's the semantic of the AND operator (&).

    In your rule

    Please login or register to see this code.

    "hueAmbiTvLight:off" is an action that always returns null which is the same as false in Lua which makes it not running the other actions after that.

    If you just want to run a number of separate actions on the right-hand side, separate them with a semi-colon.

    SO, instead you should write

    Please login or register to see this code.

     

    Posted

    UPDATE:

    I bought my hc2 mid  December

    Started to create block scenes more as 75 pieceswith also a high number of GV's

    When my automation worked I started to smooth the system up.

    Changed several scenes into LUA to combine some stuff and reduced the number of scenes by 50% with the help of you all.

    The WAF is on an acceptable level but must be come on a higher level.

    At the end of April I started the challenge of Event Runner, woowww very difficult but if you are getting some little experience it is in one word great!!!!!!!!!

    Now 14 days later off course with help of you all en especially the "master" jgab I am almost finished.

    All scenes converted into ER  with some messages over Sonos speaker with http rules.

    In ER 8 running scenes is great to have also a good overview of the installation, security, hue, ground floor intern, curtains/light/outside/power, first floor, heater, messages ond not to forget scene supervisor. Still 5 GV's must be reduced to some extra rules but dont no how at the moment.

    Just need to test heating and arm, working on it.

    To solve some annoying problem of one light and fountain who are having there own life.

    If that is done I need to do some more reporting back what ER is executing. Insert Node Red, Telegram and Harmony hub.

    So when I look back at the last two weeks its not bad at all

    @jgab thank you very much for this beautiful tool, patience and your excellent support

     

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

    UPDATE:

    I bought my hc2 mid  December

    Started to create block scenes more as 75 pieceswith also a high number of GV's

    When my automation worked I started to smooth the system up.

    Changed several scenes into LUA to combine some stuff and reduced the number of scenes by 50% with the help of you all.

    The WAF is on an acceptable level but must be come on a higher level.

    At the end of April I started the challenge of Event Runner, woowww very difficult but if you are getting some little experience it is in one word great!!!!!!!!!

    Now 14 days later off course with help of you all en especially the "master" jgab I am almost finished.

    All scenes converted into ER  with some messages over Sonos speaker with http rules.

    In ER 8 running scenes is great to have also a good overview of the installation, security, hue, ground floor intern, curtains/light/outside/power, first floor, heater, messages ond not to forget scene supervisor. Still 5 GV's must be reduced to some extra rules but dont no how at the moment.

    Just need to test heating and arm, working on it.

    To solve some annoying problem of one light and fountain who are having there own life.

    If that is done I need to do some more reporting back what ER is executing. Insert Node Red, Telegram and Harmony hub.

    So when I look back at the last two weeks its not bad at all

    @jgab thank you very much for this beautiful tool, patience and your excellent support

     

     

    ...and Thank you!

    The reason I developed ER was to aid myself in my own coding (and I like to code too). I was a bit hesitant in the beginning to release it to the forum because I was not clear why and who I was addressing. Anyway it's now under the Tutorial section and It's goal is to help people code their own scenes. The "coding" part is why it's under Tutorial and not under Download. However, sometimes ready-made scenes may require people to "configure" so much that it's almost like coding...

     

    I do believe that many, even if they don't think about it as coding, would like to try and express their own sense of "logic" for how their house should behave

    -If this happens and this is true then do this 

    -If it's this time of the day and this happens do that

    -etc etc.

    ...and that's my intention with the framework.

     

    It's easy to express in "english" how you would like the bathroom light to behave, but it often turns out that that description is full of holes and conflicts when trying to translate it to code. That's why many software projects takes much longer and becomes much more expensive than originally specified - and why there are many formally specification languages at hands these days - but I'm digressing.

     

    I choose a model of temporal based rules and event based rules with inspiration from Erlang, Expert systems, Prolog, etc. including  my favourite language feature, 'patten matching' :-)

    The idea is to have more of a declarative model allowing people to specify sets of "IF this THEN that", so that all these rules together capture the behaviour of the automated house.

     

    Having said all this, it's still pretty complicated to capture ones intended logic - and that's what you are struggling with now, Sjakie. To comfort you I can say that I also code rules in eventscript now and then that behave strange because I haven't really thought trough what I wanted in the first place (and I can assure you that my wife is not very impressed and don't have very high thoughts of my coding skills :-) )

     

    So I'm impressed by your perseverance, but I also believe that you find a pleasure in crafting your own rules and see they (eventually) being carried out. And I will do my best to support you.

     

    I said in the beginning that I was hesitant to release it - partly because I was not particularly enthusiastic to end up in a full-time support job. However I misjudged that. The framework have improved a lot with the help of @jompa68, @petrkl12, @FrankT, @3JL, @domin12 that have tried out the framework and built some pretty complex scenes - the bugs they have discovers and the features they have suggested have made it much better that if I have kept it to myself.  Thank you guys!

     

    Even when people report problems that are not bugs, It gives my something think about. Could I make it clearer, easier or in another way that would avoid these perceived problems? The only problem I have now is that I know that the people mentioned have build some complex scenes that would break if I start to change the syntax/semantics of rules so I try to avoid that.

     

    And now you are part of the group that are willing to spend time using the framework and give me feedback - and I'm honoured.

    No question is stupid and I always learn something when someone asks why something doesn't work for them or how something can be accomplished. Something I learned and understood is that there is a need for a better introduction to coding rules with eventscript. I mean, it was originally written for myself by myself, and there are of course better ways to do it as an introduction for newcomers, both to the HC2 and to the ER/EventScript. I also think there is a general introduction to what to think about when writing home automation rules that is beyond any specific framework; presence, personalisation, time-of-day pacing, sensors/events/actuators, formalising states with state-machines, fuzzy states, etc. but maybe that book is already written.

     

    • Like 1
    • Thanks 1
    Posted

    @jgab, Thanks!!

    Some questions:

    What is better system wise to do:

    -for my heater program I have 8 rules working with one GV  if it is heater season yes or no. 

    or

    -Rule.eval("@(0509..0505) => stekkerCam:on")  [if this is the correct notation for 5th of Sept  till the 5th of May]

     

    Rule.eval("gastBeneden:isOff & deurSerre:armed => dwSensorsGastenKamerBeneden:armed=1 ; pirSensorsGastenKamerBeneden:armed=1;log('Armed')")

    what to use for deurSerre:armed ??

    Please advice

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

    @jgab, Thanks!!

    Some questions:

    What is better system wise to do:

    -for my heater program I have 8 rules working with one GV  if it is heater season yes or no. 

    or

    -Rule.eval("@(0509..0505) => stekkerCam:on")  [if this is the correct notation for 5th of Sept  till the 5th of May]

     

    Rule.eval("gastBeneden:isOff & deurSerre:armed => dwSensorsGastenKamerBeneden:armed=1 ; pirSensorsGastenKamerBeneden:armed=1;log('Armed')")

    what to use for deurSerre:armed ??

    Please advice

     

    Test if we are between dates are not well supported, I would like to have 05/06/10:00..09/04/10:00, but the support is lacking at the moment.

    You need to do your own check. Two alternatives. The second alternative makes sure you have a local variable 'heatherSeason' that is true or false and that you can test against.

    If you have other scenes that depend on that variable it can be good to also store it in a GV

    Please login or register to see this code.

    The second rule, use '==' for equality test

    Please login or register to see this code.

     

    Posted

    My I have whole goodmorning scene please without mistakes.

    I want to apply also too.

    thanks.

    Posted

    thanks jgab!!

    Will use GV for it no problem.

    hahaha I used:  deurSerre=armed =>   and I was surprised it was arming the door.

    perhaps instead of  == , isArmed? to be consistent or is this to easy thought?

    thanks again!

    Please login or register to see this code.

     

    Posted

    Hi guys,

    Raspberry PI 3 , Model B+ i s this acceptable to use with HC2 and simultaneous as NAS?

    Do you have to program a lot on this PI tinny  3.5" screen that perhaps a bigger one is more appreciate 7">

    Please advice

     

     

     

     

     

     

     

     

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

    Hi guys,

    Raspberry PI 3 , Model B+ i s this acceptable to use with HC2 and simultaneous as NAS?

    Do you have to program a lot on this PI tinny  3.5" screen that perhaps a bigger one is more appreciate 7">

    Please advice

     

    I connect to the pi remotely with a laptop using VNC. I don't think it's worth buying the screen for this use-case.

    I guess you can connect it to a TV set with HDMI and use a ceap USB keyboard if you need to. 

    I mainly use the pi for node-red and when that's setup you access node-red over a web GUI from any browser (and I hidden the pi under the sofa...)

     

    Posted
    18 hours ago, jgab said:

     

    Test if we are between dates are not well supported, I would like to have 05/06/10:00..09/04/10:00, but the support is lacking at the moment.

    You need to do your own check. Two alternatives. The second alternative makes sure you have a local variable 'heatherSeason' that is true or false and that you can test against.

    If you have other scenes that depend on that variable it can be good to also store it in a GV

    Please login or register to see this code.

    The second rule, use '==' for equality test

    Please login or register to see this code.

     

    jgab,

    sorry but it does not work.

    door is listed in header of scene value

    I checked door ID

    scene no error messages

     

    If I take out     & deurSerre:armed==1 the rule will be executed if gastBeneden:isOff

    what I am doing:

    I arm the deurSerre

    I switch gastBeneden off>>>>>>>>>It will arm gastenkamer beneden

     

    I  switch off gastBeneden

    and I arm the deurSerre  >>nothing happends

    scene is still running

    Did it several times result still the same

    Now I am lost

    Please advice

     

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

    jgab,

    sorry but it does not work.

    door is listed in header of scene value

    I checked door ID

    scene no error messages

     

    If I take out     & deurSerre:armed==1 the rule will be executed if gastBeneden:isOff

    what I am doing:

    I arm the deurSerre

    I switch gastBeneden off>>>>>>>>>It will arm gastenkamer beneden

     

    I  switch off gastBeneden

    and I arm the deurSerre  >>nothing happends

    scene is still running

    Did it several times result still the same

    Now I am lost

    Please advice

    It should be listed as

    Please login or register to see this code.

    or whatever ID your deurSerre have. Have you done that?

    Most devices carry their main value in their "value" property, but additional properties like 'power', 'battery', 'armed' is separate and need separate trigger declarations.

    When you are testing your scenes you can set _debugFlags.rule=true and you will get a log for each rule that gets triggered and true or false if the rules condition was satisfied. That way you can see if the rule triggers when you expect it to and if the condition computed to true or false and thus executed the actions.

    Posted

    Thanks, done 54 value instead of 54 armed

    debug also done

    thanks agin will test tomorrow family is present

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