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.

State Control

Could you give me some examples on what to use the state control for? I'm sure I can use it. I'm just a bit confused how....
«1

Comments

  • Some examples would be great because the description is lets just say a bit vague.. 
  • lubbertkramerlubbertkramer Member
    edited October 2016
    When i look at the app page there is stated to take a look at the wiki. On the github there is a link where examples / settings page is explained, did you take a look at that already?

    Example lights in a room
    Example home state

    Link to wiki
  • I'll get back to the forum soon with an explanation on how you can use it. Based on feedback I'm currently re-structuring the app's settings and inner workings, so it will be easier to use (and to explain).
  • Love the idea and flexibility 
    I would love to see screenshots from one of your examples to get an idea how to implement things specifically.

  • Impressive work I have to say. But I do have my doubts. Instead of creating lots of states you are now creating lots of 'settings'. It will give more flexibility but at the cost of losing simplicity? 
  • SergeRSergeR Member
    edited October 2016
    I've just submitted a new version to the app store, which makes the app a bit easier to use. However it's still not a very easy app to use, albeit a very powerful one.

    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.
  • Very well thought! Will try it
  • Thanks for very good explanation. Now it makes sense to why use this app.
  • This could use a video or at least some screenshots to get a full grip of what can be achieved. It sounds like a powerful app but I cant tell right now if it would serve me well.
  • I'm planning on re-writing the examples on the app's wiki very soon, and to include screenshots of both the app's settings, and the flows.
  • @SergeR I'm getting an error message when I try to access the app for configuration. Already tried reinstalling and rebooting:

  • Thanks for the feedback. I've submitted v0.2.2 of the app which should fix the error. Sorry for the inconvenience!
  • Thanks for the quick follow-up!
  • I've written out the lighting example on the app's wiki from A to Z.

    https://github.com/SergeRegoor/nl.regoor.statecontrol/wiki/Example-1:-lights-in-a-room
  • Very powerful.
    Definitely going to use this!

    Nice programming work btw!
  • I still can't update to v0.2.2? 
  • Then it's not approved yet by Athom
  • True, it's still waiting for approval.
  • Does it always take so long?
  • Don't know, this is my first app :-)

    Hope they're not trying to decipher my code :-P
  • Could take up to 5 days, in my experience.
  • My apps are also waiting for approval. It depends on what the guys at Athom HQ are working on. I think they are doing this approval stuff in between. 
  • App has been approved, and has been published.
  • Great app.

    As you said not the easiest but I implemented your Lights in a room example and it's working great.
  • I am getting an error.


    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.


  • There's a bug in the delay. Fixed that, have to wait until the update gets approved. For now, try to replace the delay in the event with a delay in your flow.
  • Any ETA on the rewrite of the Home state?
    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.
  • The rewrite's already available in the app store.

    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!
  • Very nice!
    Gonna try this evening and will let u know.
  • RocodamelsheRocodamelshe Member
    edited November 2016
    SergeR said:

    The flow for leaving, set the state for the person's section to "Away" and also set the state for everyone to "Away".

    I don't understand it at all for now.
    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"?
    SergeR said:


    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.

    Is the name of this flow important?

Sign In or Register to comment.