This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Variable idea

Today I had an idea.. :open_mouth: Do you guys think this will work?

I use the Smart Precense app and Better Logic app. I want to know if human A is home, if human B is home, if no one is home, or if huma A+B are both home. What if I make flows like this:

- If 'human A' is home increment number-var 'precense' with 1. (so +1)
- If 'human B' is home increment number-var 'precense' with 2. (so +2)
- If 'human A' is not home decrement number-var 'precense' with 1. (so -1)
- If 'human B' is not home decrement number-var 'precense' with 2. (so -2)

In theory now I can tell who is at home:
- var = 0 - no one is home
- var = 1 - human A is home
- var = 2 - human B is home
- var = 3 - human A+B is home

I don't have the flows yet at the moment, but does this sound logic? I think it could work with even more 'humans' too..

Comments

  • Logic sounds sound (haha I love wordpuns...).
    With two persons, why not use the 'The first household member came home', 'The last household member left home', already build in Smart Presence?
    I don't see many scenario's you need more.
  • Like this you mean? ;)


  • Today I had an idea.. :open_mouth: Do you guys think this will work?

    I use the Smart Precense app and Better Logic app. I want to know if human A is home, if human B is home, if no one is home, or if huma A+B are both home. What if I make flows like this:

    - If 'human A' is home increment number-var 'precense' with 1. (so +1)
    - If 'human B' is home increment number-var 'precense' with 2. (so +2)
    - If 'human A' is not home decrement number-var 'precense' with 1. (so -1)
    - If 'human B' is not home decrement number-var 'precense' with 2. (so -2)

    In theory now I can tell who is at home:
    - var = 0 - no one is home
    - var = 1 - human A is home
    - var = 2 - human B is home
    - var = 3 - human A+B is home

    I don't have the flows yet at the moment, but does this sound logic? I think it could work with even more 'humans' too..
    In fact you are using binary numbers.
    00=0: Nobody present
    01=1: Human A present (+/-1)
    10=2: Human B present(+/-2)
    11=3: Both A and B are present

    You can expand it to Human A, B and C:
    101: Human C and A are present. Add or subtract 4 for human C. And +/- 8 for human D, etc.
    But you could also use a Boolean variable for each person. 


  • keverjeroenkeverjeroen Member
    edited November 2016
    Logic sounds sound (haha I love wordpuns...).
    With two persons, why not use the 'The first household member came home', 'The last household member left home', already build in Smart Presence?
    I don't see many scenario's you need more.
    Then I have to use multiple variables in other flows to check if some one is home and who is at home. In my example I only need 1 variable. And Homey can't trigger on multiple variables in 1 flow. With my example I can trigger a flow if Human A came home, if Human B came home, If the second Human came home (A+B), if Human A left home, if Humen B left home and if second Human left home (A+B). All with 1 variable..
  • Fire69 said:
    Like this you mean? ;)


    I use exactly the same for 3 persons. I did add another flow to reset the number variable back to 0 when the last person leaves home as sometimes smart presence is counting 1 person double. 
  • Fire69 said:
    Like this you mean? ;)


    I use exactly the same for 3 persons. I did add another flow to reset the number variable back to 0 when the last person leaves home as sometimes smart presence is counting 1 person double. 
    I'm going to try this too! And thanx for the tip for resetting to 0.
  • Fire69Fire69 Member
    edited November 2016
    Logic sounds sound (haha I love wordpuns...).
    With two persons, why not use the 'The first household member came home', 'The last household member left home', already build in Smart Presence?
    I don't see many scenario's you need more.
    Then I have to use multiple variables in other flows to check if some one is home and who is at home. In my example I only need 1 variable. And Homey can't trigger on multiple variables in 1 flow. With my example I can trigger a flow if Human A came home, if Human B came home, If the second Human came home (A+B), if Human A left home, if Humen B left home and if second Human left home (A+B). All with 1 variable..
    Ah, I missed that you where doing your counting in that way. 
    Might be smarter, but it gets too complicated (for me at least) if you need 4 people like I do :)   

    Fire69 said:
    Like this you mean?


    I use exactly the same for 3 persons. I did add another flow to reset the number variable back to 0 when the last person leaves home as sometimes smart presence is counting 1 person double. 
    That's not a bad idea indeed... :)
Sign In or Register to comment.