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.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
Variable idea
keverjeroen
Member
Today I had an idea.. 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..
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
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.
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.
Might be smarter, but it gets too complicated (for me at least) if you need 4 people like I do
That's not a bad idea indeed...