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.
Comments
Example lights in a room
Example home state
Link to wiki
I would love to see screenshots from one of your examples to get an idea how to implement things specifically.
I will add examples with pictures to the wiki soon, and update back here when done. It's definitely not meant to replace flows.
With the app I have the following in mind:
- Help realize solutions for situations which span multiple flows;
- Reduce using the same devices similarly in multiple flows;
- Reduce the number of flows for complex situations;
Most simple example where I use the State Control app for in my home is for lighting. In each room I have motion sensors, wall switches and dimmers. In some rooms I have multiple dimmers and/or multiple motion sensors. So when a sensor detects motion and it's dark, I want the lights to go on automatically. When no movement is detected anymore, the lights should go off. But when I switch on the lights manually using a switch (or speech), I do not want the lights to go off when no more motion is detected.
So at first I solved it by using the Better Logic app by creating a variable which keeps track of "manual light switching" for each room. This mostly worked ok, but made the flows more complex, and I needed a lot of them. Besides, in rooms with two motion sensors, I would need 4 flows instead of 2, each switching on/off the exact same lights. Same somewhat goes for a room with 1 sensor but 2 dimmers; I use the same dimmers in multiple flows. To me that is inefficient, especially when you're changing devices, or if you want to tweak dimming settings. You need to maintain a lot more flows.
Further down the road, I wanted to know when we are at home, when we are away, sleeping or on holiday. When we go to sleep, all the lights in the house should be switched off. A couple of them with a delay, but still. Again, I was switching off the same dimmers, just in a new flow.
(executing a flow from another flow hasn't been working nicely. Maybe only for me, I don't know, but it just doesn't work at our home)
So that's where the app comes into play. Each room (a "section" in the app) has a state for the light ("off", "manual" or "movement"). I now have a couple of flows for each room when something needs to happen (ie wall switch, movement, speech, etc), and I have two flows for each room that do the actual switching on/off. Only the latter two flows will switch on and off the actual dimmer. I can re-use the flow which switches on/off easily, because it's not triggered by a device (switch, movement, speech), but by an action that's in the SC app. So when I leave home, my "going away flow" does not switch off dimmers, it triggers the SC app. The SC app in its turn will fire all events to switch on lights.
Hopefully the example I will put up online soon, will make clear the added benefit of the app. It's not for everyone, but the more devices and flows you have, the more it's likely you will benefit.
https://github.com/SergeRegoor/nl.regoor.statecontrol/wiki/Example-1:-lights-in-a-room
Definitely going to use this!
Nice programming work btw!
Hope they're not trying to decipher my code :-P
As you said not the easiest but I implemented your Lights in a room example and it's working great.
It happens when i execute an action called 'ik ga op vakantie'.
It doesn;t trigger the flow 'ik ben op vakantie' but let the app crash.
Am trying to figur out but am stuck.
Got a sort of presence app running on 3 Iphones but can't figure how to set a "All is home" state without making lots of flows.
You would need at least 2 flows for each person, and 1 flow for "everyone".
You could create a group "Presence" with a section for each person, and an additional section "Everyone". Then create two states, "At home" and "Away". You would need a flow trigger "Check if everyone is at home", and a flow action "Someone came home".
Create a flow for each person when they are coming home. In the right column of the flow editor, set the state for the respective person to "At home", and also execute the State Control action "Someone came home" for the "Everyone" section.
The flow for leaving, set the state for the person's section to "Away" and also set the state for everyone to "Away".
In the State Control settings, create an event in the "Presence" group which triggers on the action "Someone came home". Do not set a state, but trigger "Check if everyone is at home".
Now you've set up presence states for each person. The last part is creating a flow for the everyone section. Create a flow, which in the left column of the flow editor checks if the action "Check if everyone is at home" needs to be executed. In the condition (middle) column, add a flow card for each person to check if their state is "At home". In the right column, set the state for everyone to "At home".
Let me know if this works out for you!
Gonna try this evening and will let u know.
When i set the status "Away" for "Everyone" when just 1 person is leaving then the status will be "Everyone Away" right?
So when all is at home then the status will be "Everyone at home". Otherwise, when just 1 person left, the status will be "Everyone Away"?
Is the name of this flow important?