H.O.O.P. (Hope) - Homey Object Oriented Programming

UPDATE: Triggers (and condition-triggers) with argument Time!
This way you can have one flow trigger at different times.

Update: Its Live: H.O.O.P. | Homey Community Store

Bringing you H.O.O.P (Dutch for Hope).

Homey Object Oriented Programming (for advanced users).

This apps transforms your Homey in a programmable object, changing standard flow behavior.
Take a look at the diagrams, examples and overal usages explanations.

Create one (or more) Method Group device(s) and use it like in an Object Oriented Programming manner.
Give it (overloadable) methods which will handle their own objects (devices, flows, variables, etc), removing the need for repetitive flows.

Also allows the execution of (almost) any Actioncards (Then-Cards) (installed on your Homey) as Conditions and await them.

Or change the conditions way from “if-or-or” to “if-or-finally” or “try-catch-finally” so as to not have to repeat (condition)actions.
And add If, Or, Then, Else, Else-If and End-If within(!) the condition part of a flow.

Throw errors which stacktrace, handle them or just Return;

Please check all flow-cards from the App aswell as the flow-cards from the devices.

Examples

Examples will be collected on another Topic to keep it in one place:
H.O.O.P. (Hope) - Examples

App Flows Actions and Conditions

  • Await - Awaits any start-able flow as condition
  • Wait - A timeout, useful in Await calls
  • Throw - Throws an error, useful in Await calls

App Tokens - global but always recent and scope bounded

  • error
  • stacktrace


Devices (and there Flows)

  • Method Group - Turn flows into (awaitable) methods with arguments
  • Trigger Cards - Use any triggercard in your Homey as H.O.O.P. trigger, and/or add multiple triggers as conditions, so you only need one flow!
  • Action Cards - Run any ActionCard as condition
  • Flow Director - Add If, Or, Then, Else, Else-If, End-If within(!) the condition part of a flow, or try-catch
  • Flow Variables - In-Line scoped flow variables with javascript expressions and Json handlers with default javascript Functions that can be created in the settings.

You first need to create a Homey Elevator device.

You need to grant ‘developer’ access rights’ to the app.
In Homey App, add device from H.O.O.P. called Homey Elevator and follow the steps.
It won’t really create a device tho.
If you get an error, use the App Settings to Elevate the App.

Working on

  • Action Cards freetextfield - Set any fieldtype (like dropdown) of any card from a textfield (so you can use variables)
  • Array Adapter (to be used for example with the LaMetric Time, almost done)
  • Array (text, number, boolean)
  • Dictionary
  • Direct (Awaiting) variable management (Action Cards allready can be used for that)



UPDATE: Multiple triggers in one flow!


Apps:

Donations or Sponsorship

6 Likes

Examples will be writen and collected at H.O.O.P. (Hope) - Examples - Apps - Homey Community Forum (athom.com)

H.O.O.P. has been released to the Homy Community Store and is Live, get it now!
H.O.O.P. | Homey Community Store

3 Likes

Just stumbled upon it in the CS and installed it right away.
Cheers

1 Like

Great!
Share your flows i would say.
And if you have any requests, just ask.

1 Like

Arie, (my youngest sons name is Arie too :wink:) should I share flows here, or here?

1 Like

Post it to the example page, so we can keep this topic for the app itself and questions and sugestions

1 Like

Nice one! It took me a couple hours to reproduce this flow, but it works and I get it. It replaces 5 flows (if using 4 names) of my CatFeedLuckyOne flowset.
What I found out “the hard way” was this:

Edit I just thought, if a variable ‘on the fly’ isn’t created, just create a temp flow with the variable card and test run it. Now you have a selectable ‘existing’ variable :wink:

It had saved me some headaches with the variables :wink: :wink: But on the other hand, I won’t forget this ‘feature’

Cheers,
Peter

1 Like

Yeah, still thinking about a solution for that “issue” :wink:

1 Like

And, haha, i use it for my kids to make out who does what (vacuumbin needs emptying, robo-mop needs water) :slight_smile:
Saves a lott of flows yeah!

1 Like

Yea this is fun, trigger every (task time) and the lucky one gets a push message on his/her phone f.i.!
This was my original flowset:

And with your example it’s so simple when looking at it, it is the same functionality as above :wink: :

1 Like

Nice too see!
You can even easily add dim steps, or other actions with a certain no. of pushes.
I realized f.i. my table lights have 3 favorite dim values: 20%, 50% and 100%
So an extra step is simple to add:
IF “PushButtonPushesCount” = 2
THEN (Set light 20%)

IF “PushButtonPushesCount” = 3
THEN (Set light 50%)

IF “PushButtonPushesCount” = 4
THEN (Set light 100%)

I like it!

I made this 3-step-dim-and-off function earlier on with standard flows, and it took me 7 flows. Yes… seven!
eettafel_dimstappen_flows

Hey Peter,

I see you use two cards for If Then:
IF (all cards until THEN are true); Operator = AndAlso &&
and then this card:
THEN

But this card does the same and has the THEN operator included:
IF the next X cards are true THEN execute the X cards after that; Operator = AndAlso &&

To me the first way is somewhat clearer to read, because there is a THEN operator card visible, which isn’t the case with the 2nd case. I think in hindsight it’s a bit more difficult to ‘read’ the flow steps.
Is it matter of ‘taste’, what you like? Or an other idea behind it?

Well, it indeed is kind off a taste thing yeah.
For complex statements, i would advise to use the “normal” IF, THEN, ELSE and END IF cards.

The thought after IF-THEN and IF-ELSE-THEN (and i am creating a ELSE-THEN) cards, is “single line” statements.

IF-THEN statements | Homey

When you fill a string/text with a lott of possible values, it usually means a lott of single-line-statements, like this:
IF vaccuumbin is Full THEN str = str + “Bin is full!”

If you program block-statements, you need 5 cards for this.

  • IF
  • condition
  • THEN
  • execution
  • END IF

This just felt wrong to me, because i would be using this a lott (programming single-line IF-THEN statements.

With the IF-THEN, you just need 3 cards:

  • IF the next 1 card is true, execute the next 1 card
  • condition
  • execution
    image

And when i made it, i thought: why would i fix it to The next card and the Card after that?
So i bould it so you can set the the amount If/Then cards yourself :slight_smile: Its just more flexable that way.

In big string-collection flows, these IF-THEN and IF-ELSE-THEN cards are a real space-saver and therefor performance-saver (on the Homey mobile App anyway).

But for any other use then simple IF-THEN (string) collection flows, i would advise to use the IF and THEN cards, as, indeed, this is more clearly readable and less error prone.

1 Like

Do you mean by that: when switch X is set to on, or when knob Y was pressed? Because I couldn’t find any switch or button to trigger things yet :wink:
Now I’m studying your flows for Kongedam. I kind of like those kind of puzzles.,

No, debounce in this case would be that the function/flow can be activated multiple times within a curtain period, but will only execute once within that time : Eather at the start of the debounce-period to prevent multiple executions, or at the end of the debounce-period waiting for extra input.

But for a good debouncefunctionality, i first need HOOP triggers that can override/duplicate any trigger so you can have any trigger start HOOP flos directly.
Then debouncing will be a build in card :slight_smile:

1 Like

Hey @Adrian_Rockall ,@Peter_Kawa and @Kongedam ,

I am almost done with creating Trigger Cards, which will alowe for triggers to be overwriten and thuse directly trigger HOOP flows:
This flow will trigger when the Countdown Test is empty. No need for an extra starting flow when this goes live :slight_smile:
image

2 Likes

Added Trigger Cards - Use any triggercard in your Homey as H.O.O.P. trigger, so you only need one flow!
For example Volume based on time (Day/night) - one flow

Now live in the Homey Community Store!

1 Like

I am trying to make a flow but having a hard time to get it done. Maybe someone can point me in the right direction.

I have 14 text variables called Radiodag1, Radiodag2 etc etc, they contain my favorite radiostations. The content is like “http://192.168.178.2:5005/woonkamer/favorite/538 Dance Radio”
or like: “http://192.168.178.2:5005/woonkamer/favorite/538 Ibiza Radio”

I am trying to make a flow but having a hard time to get it done. Maybe someone can point me in the right direction.

In these variables a few times there are duplicates, which is on purpose. But what i want is that a duplicate radiostation can not occur two days in a row. So Radiodag1 with Dance Radio may not be also on Radiodag2. What i want is when this happens the content will be copied into variable Radiodag3 and the content of Radiodag3 will be copied i to Radiodag2. After that the flow has to continue if there are more duplicates radiostations after another. What also may occur is in case duplicate radiostations are after another the script which has run to fill these variables will run again and then will check if there are duplicates after another.

Is this possible to achieve with H.O.O.P? I hope so…:beers:

Hey Marcel,

Just a quick question (if so, i will tell/make an example later / write you a function to place in HOOP):
Could you use an Array (list/collection) filled with all your favorite stations, and then, every day, pick a random but exclude the previousdayplayed , and save it in a variable “previousdayplayed”.

Am i correct in understanding that you want a list/station to be played every day, but not twice in a row?
Or do you want it programmed like that 14 days in advance?
(This is a big difference in how to handle it, option 1 is very simple with HOOP!, option 2 would require a bit more time to make a javascript you could use in HOOP functions)

If i recall it well you have a script for this, Marcel?
I think that would come in handy for Arie.