Welcome to the Athom Community Forum! This is a place to share ideas, ask for help and discuss about Homey in general.

Please read Welcome to the forum to get started.

App for state 'sets'

eriks5eriks5 Member
edited June 24 in Apps
I have just pushed an app I created recently to GitHub and submitted it to the app store.

This app manages sets of states. For example, a state is "there has been motion". Using this app, multiple of these states can be combined in sets and flows triggered when one or more of the states in a set become active. For example, I use this in my flows to combine multiple sensors into a set, and trigger actions based on those sets. I have sets for motion sensors and daylight sensors in various rooms. Lights turn on in rooms when there is at least one motion state active in a motion set, and not all daylight states in the daylight set are active.

I created this because I just recently got a Homey and while converting my home-brew home automation system that I've had running for over 8 years to Homey flows I really missed the option to combine sensors. In my old system, I used sets like this for almost everything.

The GitHub repo can be found here: https://github.com/eriks5/org.scheffers.homey.sets and when approved, the app should also show up in the App store.

It's tagged 'beta' for now, because I'd love some feedback on the app, since it's my first Homey app it's still rough on the edges. It's been running for over a week on my Homey without any issues though.

Update 20-6: The app is now published in the store.

Update 22-6: Version 0.1.1 has been published to the store, this version fixes a crash that occurred when attempting to add a state without entering a name for it. It also adds an "auto restore" feature that restores your sets and states if the app settings get deleted.

Update 24-6: Version 0.1.2 was published soon after 0.1.1, fixing a small issue. No crash reports since. Marking as stable.

Comments

  • eriks5eriks5 Member
    Yes, I have. But you can't easily combine multiple states into a single state with that one. I tried. It blew up in number of states needed. So I wrote this app.

    In most of my flows, some sensors update a set; a set update changes a statecontrol state, and finally statecontrol triggers the flows that update lights etc.
  • phil_sphil_s Member
    Great @eriks5
  • Isn't is a idea to combine those two apps? Probably better for memory and disk usage :)

    Nice app btw!
  • eriks5eriks5 Member
    Isn't is a idea to combine those two apps? Probably better for memory and disk usage :)

    The sets and statecontrol apps serve different purposes. Yes you can use them together, but that holds for most apps in the tools category. Combining them would make the resulting app a lot more complex though, both in implementation and usage. A few small, focused apps is better than one big complex app imho.


  • Nice Simple App - Thanks and much needed

    Looking forward to seeing some examples of how people are using it
  • EternityEternity Member
    @eriks5

    Interesting App!
    I use State Control too, and this will be a nice addition.
    Just installed the App and am able to create a state in the setting.

    What I aim for is to have a state "beweging in huis (movement in the house)", which is activated when 1 of my 5 motion sensors is activated. If that happens *and* nobody is home (as in; no Homey recognized person is home) an alarm is triggered.

    I am struggling to create the flows; would you be so kind to point me in the right direction... Thanks!
  • eriks5eriks5 Member
    What I aim for is to have a state "beweging in huis (movement in the house)", which is activated when 1 of my 5 motion sensors is activated. If that happens *and* nobody is home (as in; no Homey recognized person is home) an alarm is triggered.

    I am struggling to create the flows; would you be so kind to point me in the right direction... Thanks!
    Actually for alarms it's probably overkill; state sets are more useful for actions that have a clear "begin" and "end" (motion, but also doors that open, light sensors detecting light above certain threshold), and you want to combine several of these and want to have some actor (lights) enabled when one of the states become active until none of them are active anymore. Or when all of them have become active until some are inactive again. 

    With alarms, you're really just interested in the single event that motion was detected, you don't care when it ends.

    But you can do this by having 5 states in the set, one for each motion sensor. You'll need 5 flows to activate the states in the set (eg. if motion 1 triggers, activate state 'motion 1'). Since it's motion sensors and these usually trigger regularly as long as there is motion, I'd suggest using the "Activate state temporarily" activity, so for example keep the state active for 60 seconds. Because the way the flows are triggered, every time motion is detected, the timer is reset to 60 seconds and starts counting down again.

    If you don't want to use temporarily active states, you'll need 5 more flows to deactivate the individual states when the motion detector they represent stops seeing motion. 

    Then for alarms you'll need one more flow: when a state in the set becomes active, and nobody is home, trigger the alarm.

    For lights, you'll need two flows: one to turn the lights on when a state becomes active, and another to turn the lights off when no states are active in the set anymore.



  • EternityEternity Member
    Thanks! 
  • @eriks5
    I think you will do yourself a favour by doing a few examples in the first post or on github.. think it will save a lot of questions
  • eriks5eriks5 Member
    edited June 19
    @eriks5
    I think you will do yourself a favour by doing a few examples in the first post or on github.. think it will save a lot of questions
    Definitely need some good examples, but I haven't had time for this. In some ways still figuring out what's the best way to use it myself, I've only had my Homey for 3 weeks  B)
  • 0burner00burner0 Member
    Hmm can some one post some screenshots how to use this app in flows.
  • PovlovPovlov Member
    Ik ben op zoek naar de werking van deze app. Daarbij valt de inhoud van het tabblad weg zodra ik in een ander tabblad kijk. Niet gemeld bij Google overigens.


     
  • eriks5eriks5 Member
    @Povlov that looks like an issue with the Homey App store, not this app.
  • PovlovPovlov Member
    Tx. 
  • home78home78 Member
    edited August 8
    I will give an example of good use of the "Sets" app. It only uses part of the functionality, but I was able to replace two other apps with "Sets" which makes me think its a good fit.

    The use-case is as follows: I have an electric water boiler for which I want to sound a whistle when the boiling is done. This can be done by measuring the energy consumption over time. When it starts to boil the energy is high for a couple of seconds. Then there is a pause for a couple of seconds. This process repeats itself a few times, when the energy consumption is low for at least 25 seconds the process is complete and the whistle can be blown.

    How is this implemented using sets? I've defined a set with 4 states: Off, High, Low and Done. I also need 3 flows to implement the behaviour.  The first flow responds to energy change and is only fired when the energy is above a threshold level (eg. 100 watt) AND the state High is not active. This flow activates exactly one state in the set: High. The next flow also responds to energy change and is fired when the energy is below the threshold level AND the state High IS active. The action is to deactivate the High state, set the Low state and also set the Done state with a 25 second delay. The final flow responds to state change Done which sounds the whistle and set exactly one state: Off.

    Before using sets I was using the "Countdown" and "State Control" apps which require much more configuration and are less flexible. Especially "State Control" is a pain in the b*t to set up and overkill for what I'm trying to achieve. I'm glad I've encountered the "Sets" app. Many thanks to @Eriks5, keep up the good work!
  • cbhcbh Member
    Trying to implement "Sets" as it without doubt can simplify a lot of things related to if and who is home or not.
    However, some extra examples could be very helpful - anyone else who can provide some examples?
    Promise to publish my results when satisfied ;-)
    Chr.
  • home78home78 Member
    edited August 22
    Another example of how sets can be used.

    Use-case: we have multiple indicators (like washing machine ready, its raining outside, doorbell is ringing, etc.) but we want the LED-Ring of Homey to represent only one of them.

    Implementation: Each indicator is a state in a set. The washing machine state is activated when the washing machine is finished and deactivated when the machine is turned off. The raining state is activated when it starts raining and deactivated when the rain stops. The doorbell state is activated when the doorbell rings and deactivated by a timer. The sets application allows activating a state temporarily, which makes the last state easy to implement without requiring an extra flow. Upon any change in states flows are triggered with extra conditions to make sure that only the actions of one flow are actually executed. Best is to prioritize the indicators, so that the doorbell has priority above raining which in turn has priority above the washing machine. To signal that the washing machine is ready, also check that the other two or not signalled and turn the LED-Ring green. To signal that it is raining, also check that the doorbell is not rung and turn the LED-Ring blue. For the doorbell, you can just check the doorbell state and turn the LED-Ring red. An extra flow triggered by no states being active can be used to turn the LED-Ring off.
Sign In or Register to comment.