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

  • Topic Author
  • Simple rule for turning on/off light in bathroom. We leverage the fact that if someone moves inside the bathroom when the door is closed we keep the light on until the door opens again.

    Please login or register to see this code.

     

    Edited by jgab
    • Like 1
    Link to comment
    Share on other sites

    1 hour ago, jgab said:

    Simple rule for turning on/off light in bathroom. We leverage the fact that if someone moves inside the bathroom when the door is closed we keep the light on until the door opens again.

    Please login or register to see this code.

     

     

    What’s mean ??

    Please login or register to see this code.

    Link to comment
    Share on other sites

  • Topic Author
  • 53 minutes ago, Earybeongbeong7 said:

     

    What’s mean ??

    Please login or register to see this code.

    Just setting the 'inside' variable to the state of the door (true or false)

    Link to comment
    Share on other sites

    Jan,
    Because we are with two persons present my wife hates the light will switch of when I leave the bathroom.
    shower in bathroom with door sensor, motion dont detect if some one takes a shower, if shower is free door = open:

    Util.defTriggerVar('inside',false)
    rule("bath.sensor:breached & => bath.light:on; inside=bath.door:safe") -- turn on light when sensor breached, also set state depending on door
    rule("bath.sensor:safe & douche.door:safe => bath.light:on; inside=bath.door:safe") -- light stays on someone in the shower
    rule("trueFor(00:05,bath.sensor:safe & douche.door:breached & !inside) => bath.light:off")  -- Turn off light after 5min, if state is not inside bathroom
    rule("bath.door:breached => inside=false")  

    Jan two pir's one outside and one inside to let the light on if second person is involved"

    rule("landing.sensor:breached & bath.door:breached => bath.light:on; inside=bath.door:safe") -- turn on light when sensor breached, also set state depending on door
    rule("bath.sensor:safe & douche.door:safe => bath.light:on; inside=bath.door:safe") -- light stays on someone in the shower
    rule("trueFor(00:05,bath.sensor:safe & douche.door:breached & !inside) => bath.light:off")  -- Turn off light after 5min, if state is not inside bathroom
    rule("bath.door:breached & landing.sensor:safe => inside=false")  
    rule("bath.door:breached & landing.sensor:breached=> inside=!false")  
    rule("bath.door:breached & bath.sensor:breached & landing.sensor:breached => bath.light:on; inside=bath.door:safe")  --second person in
    how to count?

    Please advice,
    //Sjakie

     

    If this works I can use it for more rooms.

     

    Link to comment
    Share on other sites

    10 hours ago, jgab said:

    Just setting the 'inside' variable to the state of the door (true or false)

     

    Please login or register to see this code.

    The state of the statement in the variable is saved as "true or false", right?

     

    bath.door:safe > true

    bath.door:breached > false

     

    Is it stored differently depending on the status of the door?

     

    For example, if the motion is violated but the door is open, will the value of "inside" be "false"?

     

    Then

     

    Do the two codes below mean the same thing? I wonder if they are theoretically the same.

    Please login or register to see this code.

     

    Edited by Earybeongbeong7
    Link to comment
    Share on other sites

  • Topic Author
  • 15 hours ago, Sjakie said:

    Jan two pir's one outside and one inside to let the light on if second person is involved"

    rule("landing.sensor:breached & bath.door:breached => bath.light:on; inside=bath.door:safe") -- turn on light when sensor breached, also set state depending on door
    rule("bath.sensor:safe & douche.door:safe => bath.light:on; inside=bath.door:safe") -- light stays on someone in the shower
    rule("trueFor(00:05,bath.sensor:safe & douche.door:breached & !inside) => bath.light:off")  -- Turn off light after 5min, if state is not inside bathroom
    rule("bath.door:breached & landing.sensor:safe => inside=false")  
    rule("bath.door:breached & landing.sensor:breached=> inside=!false")  
    rule("bath.door:breached & bath.sensor:breached & landing.sensor:breached => bath.light:on; inside=bath.door:safe")  --second person in
    how to count?

    Please advice,
    //Sjakie

     

    This is very difficult to get 100% right. I would say it's impossible to count in general. It could depend on how the bathroom look like. If there is enough of a "landing zone"  so you can tell that a new person entered without staying at the same place as someone else also inside it could work - but in general really tricky,.

    One could try to rely on habits like double-flicking the light earn existing and there is someone still inside (in the shower) to tell the light to not close. However, these things are easy to forget.

    6 hours ago, Earybeongbeong7 said:

     

    Please login or register to see this code.

    The state of the statement in the variable is saved as "true or false", right?

    Yes, :safe returns a boolean

     

    6 hours ago, Earybeongbeong7 said:

     

    bath.door:safe > true

    bath.door:breached > false

    Can't use > and < with booleans. (even though in theory 'true' should be bigger than 'false' ;-) )

    6 hours ago, Earybeongbeong7 said:

    Is it stored differently depending on the status of the door?

    For example, if the motion is violated but the door is open, will the value of "inside" be "false"?

    correct,

    6 hours ago, Earybeongbeong7 said:

     

    Then

     

    Do the two codes below mean the same thing? I wonder if they are theoretically the same.

    Please login or register to see this code.

     

    Nop,

    The first rule sets 'inside' to false if door is breached  (door:breached == true)

    The second sets 'inside' to true if door is breached (door:breached == true)

    Link to comment
    Share on other sites

    39 minutes ago, jgab said:
    Quote

     

    bath.door:safe > true

    bath.door:breached > false

    Can't use > and < with booleans. (even though in theory 'true' should be bigger than 'false' ;-) )

     


    My meaning is wrong.

     

    Please login or register to see this code.

    Is it correct to store "true" in "inside"?

     

    Please login or register to see this code.

    Is it correct to store "false" in "inside"?

     

    And

     

    Please login or register to see this code.

     

    I don't understand that "true" is stored in "inside".

     

    Isn't "inside = bath.door: safe" storing "true" in "insde"?

     

    Edited by Earybeongbeong7
    Link to comment
    Share on other sites

  • Topic Author
  • 4 hours ago, Earybeongbeong7 said:

     


    My meaning is wrong.

     

    Please login or register to see this code.

    Is it correct to store "true" in "inside"?

     

    If the sensor is breached and the door is closed (safe) we set variable 'inside' to true.

    If the sensor is breached and the door is open (not safe) we set variable 'inside' to false.

     

    4 hours ago, Earybeongbeong7 said:

     

    Please login or register to see this code.

    Is it correct to store "false" in "inside"?

     

    This will set 'inside' to true when door is open - if door is open we don't know where the user is and we set the variable 'inside' to false.

     

    4 hours ago, Earybeongbeong7 said:

     

    And

    Please login or register to see this code.

     

    I don't understand that "true" is stored in "inside".

     

    Isn't "inside = bath.door: safe" storing "true" in "insde"?

     

     

    When door is opened (breached) we wan't to set variable 'inside' to false - like in the case with the sensor.

    Link to comment
    Share on other sites

    Is the code below correct what I understand?

     

    The automation usability of this code doesn't matter.

     

    I just want to understand the meaning of the code.

     

    Please login or register to see this code.

     

    Does "Livingbath_door: value" read the current state even if there is no physical state change of the "door sensor"?

     

    I know that the "trigger" of the "rule" works only when the physical state of the "door sensor" changes.

    Link to comment
    Share on other sites

  • Topic Author
  • 5 hours ago, Earybeongbeong7 said:

    Is the code below correct what I understand?

     

    The automation usability of this code doesn't matter.

     

    I just want to understand the meaning of the code.

     

    Please login or register to see this code.

     

    Does "Livingbath_door: value" read the current state even if there is no physical state change of the "door sensor"?

     

    I know that the "trigger" of the "rule" works only when the physical state of the "door sensor" changes.

    Yes, the HC2/HC3 always read the current state,

    When a physical device changes state it immediately reports the value to the HC2/HC3. The HC2/HC3 stores the value in an internal database.

    When the value is stored/updated the HC2/HC3 also generates a 'sourceTrigger' that scenes (and QAs) can react on

    EventRunner3/4. reacts on those triggers and run the rules that are concerned.

    fibaro.getValue(id, prop) reads the value from that database. So, we always get the latest reported value.

    Livingbath_door: value is internally translated to a fibaro.getValue(Livingbath_door,"value")

     

    A note. There is a difference between sensors on the HC2 and HC3. On the HC3 the "value" of a sensor is a boolean.

    On the HC2 it is a number. 0 for safe and 1 for breached. This means that sensor:value on the HC2 returns a number and on the HC3 a boolean, for sensors.

    However, sensor:breached and sensor:safe always return a boolean both on the HC2 and the HC3.

    Link to comment
    Share on other sites

    6 hours ago, jgab said:

    Yes, the HC2/HC3 always read the current state,

    When a physical device changes state it immediately reports the value to the HC2/HC3. The HC2/HC3 stores the value in an internal database.

    When the value is stored/updated the HC2/HC3 also generates a 'sourceTrigger' that scenes (and QAs) can react on

    EventRunner3/4. reacts on those triggers and run the rules that are concerned.

    fibaro.getValue(id, prop) reads the value from that database. So, we always get the latest reported value.

    Livingbath_door: value is internally translated to a fibaro.getValue(Livingbath_door,"value")

     

    A note. There is a difference between sensors on the HC2 and HC3. On the HC3 the "value" of a sensor is a boolean.

    On the HC2 it is a number. 0 for safe and 1 for breached. This means that sensor:value on the HC2 returns a number and on the HC3 a boolean, for sensors.

    However, sensor:breached and sensor:safe always return a boolean both on the HC2 and the HC3.

     

     

    Thank you very much for your answer. 

    Link to comment
    Share on other sites

  • Topic Author
  • 4 hours ago, Earybeongbeong7 said:

    Hello.  Thanks to this, I am learning ER well.  Is there any way or example of using the profile in HC3 in the ER4 rule?

    Well, you can trigger on profile changes.

    When a profile is activated a trigger is posted

    Please login or register to see this code.

    So you can trigger like this

    Please login or register to see this code.

    So, you could activate and deactivate a set of rules depending on what profile is activated

    Please login or register to see this code.

     

    Edited by jgab
    Link to comment
    Share on other sites

  • Topic Author
  • in ER4. arming and alarms work differently from ER3 and the HC2.

    We arm alarm partitions. Alarm partitions have names and ids.

    There is a new function/property :alarm in ER4.

    Ex. <partition id>:alarm will return the partition structure for partition with id 1

    Please login or register to see this code.

    will print out the structure.

     

    Please login or register to see this code.

    Will print the armed and breached status of partition 1

     

    Please login or register to see this code.

    Will arm/disarm partition 1. 

    An id of 0 will enable/disable all partitions.

     

    One fields of a partition structure is '.devices' that is an array of all devices that belong to a partition.

    This means that we can do this

    Please login or register to see this code.

    and we also get triggers when partitions are enabled/disabled and breached....

     

     

    Edited by jgab
    Link to comment
    Share on other sites

    2 hours ago, jgab said:

    in ER4. arming and alarms work differently from ER3 and the HC2.

    We arm alarm partitions. Alarm partitions have names and ids.

    There is a new function/property :alarm in ER4.

    Ex. <partition id>:alarm will return the partition structure for partition with id 1

    Please login or register to see this code.

    will print out the structure.

     

    Please login or register to see this code.

    Will print the armed and breached status of partition 1

     

    Please login or register to see this code.

    Will arm/disarm partition 1. 

    An id of 0 will enable/disable all partitions.

     

    One fields of a partition structure is '.devices' that is an array of all devices that belong to a partition.

    This means that we can do this

    Please login or register to see this code.

    and we also get triggers when partitions are enabled/disabled and breached....

     

     

     

     

    Is it correct that a profile such as a picture is controlled?

    Please login or register to see this attachment.

     

    fibaro.profile('activateProfile',Away=2)

     

    Is there any er4 instruction that can utilize this??

    Edited by Earybeongbeong7
    Link to comment
    Share on other sites

  • Topic Author
  • 7 hours ago, Earybeongbeong7 said:

     

     

    Is it correct that a profile such as a picture is controlled?

    fibaro.profile('activateProfile',Away=2)

     

    Is there any er4 instruction that can utilize this??

     

    v0,5fix18

     

    Please login or register to see this code.

     

    or

    Please login or register to see this code.

    and then triggers type

     

    Link to comment
    Share on other sites

    Jan,

    Will this work?

     Rule.eval([[hal.locatieGezin:isOn & hal.kamerBoven:isOff & hal.kamerBeneden:isOff =>
            1:alarm=true; log('Huis aanwezig armed'); 
            3:alarm=true; log('kamerBoven afwezig armed');
            4:alarm=true; log('kamerBeneden afwezig armed');
                ]])
    Please advice,
    //Sjakie
    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...