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

The Homey Community has been moved to

This forum is now read-only for archive purposes.

several general coding questions

Is there a way to use some kind of database to store (temp) values?

For example:
a motion sensor detects motion, i write the timestamp in a database.
Other scenes/triggers/flows can check when they perform this value and only respond/act if a value is more or less etc..

Simply to prevent to switch to quickly, to make sure the time between triggers is more then X time.
Or only perform trigger on a certain state which i can save somewhere.

An other question is:
Is there a state: like 'home', 'away', 'night','vacation' etc..
So i can use this in triggers/flows, only perform when in state X|, or do NOT perform when in state X etc..



  • This calls for the "State control app" and the "Candy app"
    With the "state" app u can make states like "away" and so on.
    With the candy app u can make a flow with "did not trigger for 10 minutes"
    All is possible with Homey and the wonderfull apps.
  • An alternative to using a variable would be to use two flows to build in a small delay.

    IF motion detected THEN trigger Delayed-Flow after 1 minute.
    IF triggered AND motion is detected THEN do stuff.

    This only works is the sensor you want to check allows this. If not, Better Logic is a great app to manage variables.

    Personally, I like to use Better Logic for states as well. I like to use multiple Booleans rather then a multi value state. In my experience, most of the states you want can be captured using booleans. Home/Away, Sleeping/Awake, Vacation/regular schedule. There are some interesting combinations which will occur and which you might not have taught about. For example: Away+Sleeping. Homey will probably need to behave differently then Home+Sleeping.

  • Thx, i have a good idea how the states and flows should be, i am using vera (edge) for some years now and i did my programming using lua code (which vera uses).
    At my old vera system my home automation is running rather good and all scenes (called flows in Homey) run mostly fully automaticly.
    So lights go on/off when coming homey, going to bed, playing movie etc.

    My task is now to convert the vera scenes into homey flow.

    1 major downsize of homey for me is that there is no good/great user interface to start flows by hand, by my vera unit i use serveral wallmounted tablets in house with an app which control the vera unit.

    I have no idea how to do this on Homey, also because home has no virtual switches which i could press to start/trigger a flow by hand.

    But with betterlogic i indeed can do a lot a nice stuff, this option is much better then in vera :)

    It will take me sometime to convert all my scenes into flows and i can remove the vera unit and let run Homey my house instead of vera.
  • You could add a non-existent KaKu device and use that as a trigger or use Better Logic, create a boolean and then create a BitFlip device. Or, in a few days I guess, Better Logic will also have a slider-device:
Sign In or Register to comment.