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 (edited)
18 minutes ago, jgab said:

As you see id:value=x is translated to fibaro.call(id,"setValue",x)

The question. is what to do with 'value2'. Do you know if the device has an action named 'setValue2' ?

I could translate it to an fibaro.call(id,"updateProperty","value2",x) but then we need to make sure that it will actually react on that.

You could try

rule("506:isOn => fibaro.call(375,'updateProperty','value2',40)") 

If that works we could make a change in ER4.

 

Just this one works.
 

Please login or register to see this code.

  

Please login or register to see this code.

 

Edited by Earybeongbeong7
  • Topic Author
  • Posted

    O

    2 hours ago, Earybeongbeong7 said:

     

    Just this one works.
     

    Please login or register to see this code.

      

    Please login or register to see this code.

     

    Ok, I pushed a new version of ER4, 0.5fix29.

    I did not add value2. yet - I want to redesign the property handling first.

    However I have exported the interface to add EventScript properties.

    This means that if you add this to your main() you will have value2 defined

    Please login or register to see this code.

     

    Both as a trigger

    Please login or register to see this code.

    and if you assign a value to value2

    Please login or register to see this code.

    should work.

    Posted (edited)

    Hi,

    A bit of a Noob question.. :-)

    How do i make use of OR in a rule?

     

    I have the following, managing my hallway light:

     

    rule("trueFor Sleepstate=Awake & PresentState=Home & LightHall=isOff & LuxHall:lux <= 20 => LightHall:Value=15")
     
    And i want a rule to turn if of under certain conditions, like this:
    rule("trueFor (LuxHall:lux > 20 OR PresentState=Away OR SleepState=Sleeping) & LightHall=isOn => LightHall:turnOff")
     
    I can't seem to find what I need to replace the OR with in order to get this to work.. 
     
    Thanks i advance..
    Edited by Ace02
  • Topic Author
  • Posted
    22 minutes ago, Ace02 said:

    Hi,

    A bit of a Noob question.. :-)

    How do i make use of OR in a rule?

     

    I have the following, managing my hallway light:

     

    rule("trueFor Sleepstate=Awake & PresentState=Home & LightHall=isOff & LuxHall:lux <= 20 => LightHall:Value=15")
     
    And i want a rule to turn if of under certain conditions, like this:
    rule("trueFor (LuxHall:lux > 20 OR PresentState=Away OR SleepState=Sleeping) & LightHall=isOn => LightHall:turnOff")
     
    I can't seem to find what I need to replace the OR with in order to get this to work.. 
     
    Thanks i advance..

    Vertical bar '|' is OR (& is AND)

    Please login or register to see this code.

    trueFor needs a time it should be true for. Is it what you need? Btw, equal is ==

    The rule says that if LuxHall:lux > 20 OR  PresentState==Away OR SleepState==Sleeping is true for 5min and then if LightHall:isOn do  LightHall:off

    If you don't need it to be true for a time period, remove the trueFor

    Please login or register to see this code.

    but put the OR expressions inside parentheses as the AND binds stronger than OR 

    • Thanks 1
    Posted (edited)

    Perfect explanation Jgab.. Thanks a lot..

    Maybe another dumb question.

     

    I have this controlling my fan in the bathroom

        rule("HumBath:value>70 => VentBath:turnOn")
        rule("HumBath:value<66 => VentBath:turnOff")
     
    the rule detects that humidity is above 70 and runs, but never turns the fan on.. 
    [true]>>'Rule:13[HumBath:value>70 => VentBath:On]'
    What am I doing wrong here.. 
     
    I have checked that it is linked to the correct ID..
    Edited by Ace02
  • Topic Author
  • Posted
    7 minutes ago, Ace02 said:

    Perfect explanation Jgab.. Thanks a lot..

    Maybe another dumb question.

     

    I have this controlling my fan in the bathroom

        rule("HumBath:value>70 => VentBath:turnOn")
        rule("HumBath:value<66 => VentBath:turnOff")
     
    the rule detects that humidity is above 70 and runs, but never turns the fan on.. 
    [true]>>'Rule:13[HumBath:value>70 => VentBath:On]'
    What am I doing wrong here.. 
     
    I have checked that it is linked to the correct ID..

    Use VentBath:on

    ER is picky with case. Btw turnOn/turnOff doesn’t exist. It’s :on and :off

    • Thanks 1
    Posted

    Jan I need your expertise,

    Arming scene is running fine with test devices and now I know why I did not have alarm signal.

    I was using HUE light for it.

    Yesterday morning I added toilet in HC3 and ER just simpel door open and movement>>light on or off.

    Sjakie  was happy that today it was still functioning.

    Stupid as I was I added bathroom devices in HC3 and the light is in the same ER scene as toilet.

    Because I use for bathroom 2 motion devices I created seperate ER scene for landing.

    Later ( I dont know when If all is working) I will join the scenes to have only a few for the whole house.

    WAF was okay today in batroom and toilet let there be LIGHt!! Please read for light HUE.

    Now no light anymore?????????>>>> Nothing changed!

    After investigation I pulled all my hair out >>> nothing strange found

    Debug confirm the cmd given light on or off but practically >>>dark!

    I added a conventional spot in the scene and what I expected >>>>>> conventional spot >>> gives light.

    What to do??

    Restarted HC3

    and there was light, from HUE

    I have no clue how long.

    HC3>>>5.050.13

    ER fix 29

    Fibaro plugin HUE

    Any idea??

    //Sjakie

     

     

     

    Posted

    Jgab, i think i need Your help again..

     

    I have this rule:

    rule("Sleepstate==Awake & PresentState==Home & LuxHall:lux <= 20 => LightHall:value=15")
    rule("(PresentState==Away | SleepState==Sleeping | LuxHall:lux > 25) => LightHall:off")

     

    But suddenly the lights turn off, even though none of the conditions in the rule are met:

     

    [10.10.2020] [18:54:04] [DEBUG] [QUICKAPP284]: [true]>>'Rule:11[Sleepstate==Awake & PresentState==Home & LuxHall:lux <= 20 => LightHall:value=15]'

    [10.10.2020] [18:54:04] [DEBUG] [QUICKAPP284]: fibaro.call(225,"setValue",15) => nil

    [10.10.2020] [18:54:04] [DEBUG][QUICKAPP284]: [true]>>'Rule:12[(PresentState==Away | SleepState==Sleeping | LuxHall:lux > 25) => LightHall:off]'

    [10.10.2020] [18:54:04] [DEBUG] [QUICKAPP284]: fibaro.call(225,"turnOff") => nil

     

    As You can see at the time, it just happend.. The lux in my hallway at the moment is way below 20 Lux (more like 1-6 lux).

     

    Can You help, why the lights suddenly turns off?

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

    Jgab, i think i need Your help again..

     

    I have this rule:

    rule("Sleepstate==Awake & PresentState==Home & LuxHall:lux <= 20 => LightHall:value=15")
    rule("(PresentState==Away | SleepState==Sleeping | LuxHall:lux > 25) => LightHall:off")

     

    But suddenly the lights turn off, even though none of the conditions in the rule are met:

     

    [10.10.2020] [18:54:04] [DEBUG] [QUICKAPP284]: [true]>>'Rule:11[Sleepstate==Awake & PresentState==Home & LuxHall:lux <= 20 => LightHall:value=15]'

    [10.10.2020] [18:54:04] [DEBUG] [QUICKAPP284]: fibaro.call(225,"setValue",15) => nil

    [10.10.2020] [18:54:04] [DEBUG][QUICKAPP284]: [true]>>'Rule:12[(PresentState==Away | SleepState==Sleeping | LuxHall:lux > 25) => LightHall:off]'

    [10.10.2020] [18:54:04] [DEBUG] [QUICKAPP284]: fibaro.call(225,"turnOff") => nil

     

    As You can see at the time, it just happend.. The lux in my hallway at the moment is way below 20 Lux (more like 1-6 lux).

     

    Can You help, why the lights suddenly turns off?

     

    The lines

    [10.10.2020] [18:54:04] [DEBUG] [QUICKAPP284]: [true]>>'Rule:11[Sleepstate==Awake & PresentState==Home & LuxHall:lux <= 20 => LightHall:value=15]'

    [10.10.2020] [18:54:04] [DEBUG][QUICKAPP284]: [true]>>'Rule:12[(PresentState==Away | SleepState==Sleeping | LuxHall:lux > 25) => LightHall:off]'

    tells us that the condition was true for both rules (left of the '=>')

    They were probably triggered because  LuxHall:lux changed value and the value was below 20.

    The first triggered and executed  LightHall:value=15 which is ok and expected.

    The second rule is also triggered (because it refers to LuxHall:lux). However, LuxHall:lux > 25 is most likely false. This means that
    either 
     PresentState==Away or SleepState==Sleeping 

    can you verify that?

     

    Conditions with OR is surprisingly difficult to get right. The problem is that the rule is triggered if any of the PresentState, SleepState, or LuxHall changes value but it may not be the test triggers the rule that decides if it becomes true (could be some of the other 2 tests in the OR chain)

    If you rewrite it into 3 rules like below there is no risk that "side effect"

    Please login or register to see this code.

     

     

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

    Jan I need your expertise,

    Arming scene is running fine with test devices and now I know why I did not have alarm signal.

    I was using HUE light for it.

    Yesterday morning I added toilet in HC3 and ER just simpel door open and movement>>light on or off.

    Sjakie  was happy that today it was still functioning.

    Stupid as I was I added bathroom devices in HC3 and the light is in the same ER scene as toilet.

    Because I use for bathroom 2 motion devices I created seperate ER scene for landing.

    Later ( I dont know when If all is working) I will join the scenes to have only a few for the whole house.

    WAF was okay today in batroom and toilet let there be LIGHt!! Please read for light HUE.

    Now no light anymore?????????>>>> Nothing changed!

    After investigation I pulled all my hair out >>> nothing strange found

    Debug confirm the cmd given light on or off but practically >>>dark!

    I added a conventional spot in the scene and what I expected >>>>>> conventional spot >>> gives light.

    What to do??

    Restarted HC3

    and there was light, from HUE

    I have no clue how long.

    HC3>>>5.050.13

    ER fix 29

    Fibaro plugin HUE

    Any idea??

    //Sjakie

     

     

     

    I would suspect Hue. Are you running Hue on both the HC3 and the HC2? Lots of polling if the Hue hub may loose some requests. 

    Posted

    Hi Jgab,

    I understand where You are going and has now changed to one rule with OR to the three rules.

    That being said, none of either Sleepstate or Presentstate has been true during today.. So i'm not quite sure want causes this on/off behavior.

     

    Actually it has done it a couple of times now, and sometimes it just blinks on/off until i stop the rule..

     

    I will see how i goes with the three rules now.. Should also make it easier to eventually idenfy what is causing the on/off..

    Posted

    jan,

    Yes on HC2 no problems sometimes light didt switch on. Remeber I have set wait(00:00:05) between >2 lamps.

    This is also in HC3

    And the Toilet is only one lamp

    At this moment all hue lamps are in HC3 as sitting duck

    Only 4 bathroom and 1 toilet HUE are triggered to work

    Am I the only person with this problem?

    HC3 light switch more not on as on

    Any solution except get rid of the HUE?

    //Sjakie

  • Topic Author
  • Posted
    6 minutes ago, Ace02 said:

    Hi Jgab,

    I understand where You are going and has now changed to one rule with OR to the three rules.

    That being said, none of either Sleepstate or Presentstate has been true during today.. So i'm not quite sure want causes this on/off behavior.

     

    Actually it has done it a couple of times now, and sometimes it just blinks on/off until i stop the rule..

     

    I will see how i goes with the three rules now.. Should also make it easier to eventually idenfy what is causing the on/off..

    Wait, shouldn't it be PresentState=='Away' etc. 'Away' and 'Sleeping' being strings between '..' ?

     

    Posted (edited)
    2 minutes ago, jgab said:

    Wait, shouldn't it be PresentState=='Away' etc. 'Away' and 'Sleeping' being strings between '..' ?

     

    I was just struggling with that one.. I get this error:

    10.10.2020] [21:40:09] [ERROR] [QUICKAPP284]: Error in 'PresentState=='Away' => LightHall:off': ./include/EventRunner.lua:1666: no triggers found in header

    [10.10.2020] [21:40:09] [ERROR] [QUICKAPP284]: ./include/EventRunner.lua:2160: Main() ERROR:./include/EventRunner.lua:2018: ./include/EventRunner.lua:1666: no triggers found in header

     

    Also if just PresentState==Away

    Edited by Ace02
  • Topic Author
  • Posted
    1 minute ago, Ace02 said:

    I was just struggling with that one.. I get this error:

    10.10.2020] [21:40:09] [ERROR] [QUICKAPP284]: Error in 'PresentState=='Away' => LightHall:off': ./include/EventRunner.lua:1666: no triggers found in header

    [10.10.2020] [21:40:09] [ERROR] [QUICKAPP284]: ./include/EventRunner.lua:2160: Main() ERROR:./include/EventRunner.lua:2018: ./include/EventRunner.lua:1666: no triggers found in header

     

    Also if just PresentState==Away

    What is PresentState? a fibaro global? then it's $PresentState

    Posted
    Just now, jgab said:

    What is PresentState? a fibaro global? then it's $PresentState

    It's a GlobalVariable i have made.. Still $PresentState then?

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

    It's a GlobalVariable i have made.. Still $PresentState then?

    Yes, without the $ it's interpreted as a ER rule variable. Normally they don't trigger rules - and therefore you get the message that not triggers are found.

    fibaro globals $<name> do trigger rules when they change value.

    Posted

    Perfect.. No error now.. I will try this.. Thanks a lot..

    Posted

    Jan,

    What is the difference in switch HUE off in devices and in the LUA scene?

    In devices I can switch off many times without restart.

    In QA ER 4 just a few times.

    CPU 15-60%

    if I play with HUE CPU 25/30-70%

    //Sjakie

     

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

    Jan,

    What is the difference in switch HUE off in devices and in the LUA scene?

    Is it a HC3 QA device and a HC2 scene? or is it a HC3 scene also? The big difference is how the Hue device is implemented/behaves on the HC2 respectively the HC3.

    2 hours ago, Sjakie said:

    In devices I can switch off many times without restart.

    You mean switch off in device or scene? on HC2, in app?

    2 hours ago, Sjakie said:

    In QA ER 4 just a few times.

    What QA device do you use to control the Hue on the HC3?

    2 hours ago, Sjakie said:

    CPU 15-60%

    if I play with HUE CPU 25/30-70%

    Depends on the Hue QA/plugin on the HC3.

    QA ER4 only treats Hue devices like any other device, ex. a fibaro.call(<hueDevice>,"turnOn") 

     

    If you run Hue scenes/devices on both the HC2 and the HC3 they will compete calling/polling the Hue hub and the Hue Hub may start to refuse to carry out commands.

    2 hours ago, Sjakie said:

    //Sjakie

     

     

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