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

**URL:** <https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709>\
**Category:** Apps\
**Tags:** app, tools, flow\
**Created:** [March 4, 2021, 6:22pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709 "2021-03-04T18:22:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 4, 2021, 6:22pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/1 "2021-03-04T18:22:00Z")

</div>

**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](https://store.homey.community/app/nl.qluster-it.HOOP)**

### 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](https://community.homey.app/t/h-o-o-p-hope-examples/45114)

# 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](https://community.homey.app/t/h-o-o-p-hope-method-group/43911) - Turn flows into (awaitable) methods with arguments
- [Trigger Cards](https://community.homey.app/t/h-o-o-p-hope-card-overloader/45512) - 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](https://community.homey.app/t/h-o-o-p-hope-card-overloader/43912) - Run any ActionCard as condition
- [Flow Director](https://community.homey.app/t/h-o-o-p-hope-flow-director/43970) - Add If, Or, Then, Else, Else-If, End-If within(!) the condition part of a flow, or try-catch
- [Flow Variables](https://community.homey.app/t/h-o-o-p-hope-flow-variables-in-line-flow-variables/44327) - 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:

> [@\[Profile\] Arie J. Godschalk](https://community.homey.app/t/profile-arie-j-godschalk/70663/2):
>
> Apps developed or maintained by me: [Advanced Triggers](https://community.homey.app/t/app-pro-advanced-triggers-trigger-and-action-cards-with-eventname-for-advanced-flows/65651) , [BeNext](https://community.homey.app/t/app-pro-benext-benext-devices-for-homey/76104) , [Better Logic](https://community.homey.app/t/app-pro-better-logic-just-some-better-logic-and-variable-management/5568) , [Chronograph](https://community.homey.app/t/app-pro-chronograph-adds-precise-timer-stopwatch-and-transition-functionality-to-homey/18214) , [Device Capabilities](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287) , [Advanced Virtual Device](https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198) , [FTP Client](https://community.homey.app/t/app-pro-ftp-client/70876) , [Google Services](https://community.homey.app/t/google-services-app-for-translate-and-new-text-to-speech-for-any-device-with-url-input/43257) , [Homesh Controller](https://community.homey.app/t/app-pro-homesh-controller-homesh-satellite-connect-homey-pro-2023-to-homey-pro-for-led-speaker-zwave-satellite-and-network-resource/70369) , [Homesh Satellite](https://community.homey.app/t/app-pro-homesh-controller-homesh-satellite-connect-homey-pro-2023-to-homey-pro-for-led-speaker-zwave-satellite-and-network-resource/70369) , [JSON Handler and Manipulator](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317) , [LOQED](https://community.homey.app/t/app-pro-loqed-your-personal-doorman/89816) , [Music Url Converter](https://community.homey.app/t/music-url-converter-play-music-urls-on-homey-bigger-then-900-kb/43546) , [Simple Log](https://community.homey.app/t/simple-log-app/146) , [Universal Media Player](https://community.homey.app/t/universal-media-player-a-generic-storages-place-for-your-homey-speakers-tvs-or-other-media-devices/43450) and [Virtual Devices](https://community.homey.app/t/app-pro-virtual-devices-virtual-devices-to-simulate-1-or-more-real-devices/1723) . [Goto profile of Arie J. Godschalk](https://community.homey.app/t/profile-arie-j-godschalk/70663) for more …

### Donations or Sponsorship

> [@\[Profile\] Arie J. Godschalk](https://community.homey.app/t/profile-arie-j-godschalk/70663/3):
>
> Donations or Sponsorship. You can help with the development, maintenance and support for the Apps, by donating or becoming a sponsor. This would be much appreciated! The more donations i receive, the more time i can make free for development and support. slight_smileDonations can be done through: [[PP] PayPal](https://paypal.me/QlusterIT) Requires a PayPal account. [[GS] Github Sponsors](https://github.com/sponsors/XeroxQ) Allowes for CreditCard. Sponsorships can be done through: [[P] Patreon](https://www.patreon.com/QlusterIT/membership) Requires a Patreon account. [[GS] Github Sponsors](https://github.com/sponsors/XeroxQ) …

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 23, 2021, 5:56am UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/4 "2021-03-23T05:56:30Z")

</div>

Examples will be writen and collected at [H.O.O.P. (Hope) - Examples - Apps - Homey Community Forum (athom.com)](https://community.homey.app/t/h-o-o-p-hope-examples/45114)

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 23, 2021, 5:37pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/5 "2021-03-23T17:37:17Z")

</div>

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](https://store.homey.community/app/nl.qluster-it.HOOP)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [March 23, 2021, 6:52pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/6 "2021-03-23T18:52:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 23, 2021, 6:55pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/7 "2021-03-23T18:55:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [March 26, 2021, 5:23pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/8 "2021-03-26T17:23:51Z")

</div>

Arie, (my youngest sons name is Arie too 😉) should I share flows here, or [here](https://community.homey.app/t/h-o-o-p-hope-examples/45114)?

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 26, 2021, 7:32pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/9 "2021-03-26T19:32:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [March 27, 2021, 8:31pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/10 "2021-03-27T20:31:57Z")

</div>

> [@H.O.O.P. (Hope) - Examples](https://community.homey.app/t/h-o-o-p-hope-examples/45114/4):
>
> Example Flow Variables - Using variables and a custom function First i created a function called “random” in the App Settings: Enter the next javascript into the function by clicking edit. function (arr) { return arr[Math.floor(Math.random() \* Math.floor(arr.length))]; } Then the next flow: First, put a Javascript Array into a Flow Variable type JSON called Kids. (Variables are created on the fly, no need to define them in settings, just start the flow to use them) Th…

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:

> [@H.O.O.P. (Hope) - Examples](https://community.homey.app/t/h-o-o-p-hope-examples/45114/9):
>
> (After you create a flow-variable in flow, they flow needs to be triggered once for the variable to become visible (and to select it)).

**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 😉

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

Cheers,  
Peter

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 27, 2021, 9:06pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/11 "2021-03-27T21:06:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 27, 2021, 9:11pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/12 "2021-03-27T21:11:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [March 27, 2021, 9:30pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/13 "2021-03-27T21:30:56Z")

</div>

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:

 ![wievoertkat5flows](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/3/03519963b58b268f770d4ddba072d30f5e5e99d4.jpeg)

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

 ![wievoertkat1flows](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/1/51fe3f740e0c2934dd32311c96a920f738a5793b.jpeg)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [March 28, 2021, 2:43pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/14 "2021-03-28T14:43:34Z")

</div>

> [@H.O.O.P. (Hope) - Examples](https://community.homey.app/t/h-o-o-p-hope-examples/45114/12):
>
> IF “PushButtonPushesCount” = 2  
> THEN (Set light 50%)
> 
> IF “PushButtonPushesCount” = 3  
> THEN (Set light 100%)

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](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/9/19e2f0fe9352418ca0638eeb0694d615f2b5d49c.png)

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 29, 2021, 6:03am UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/15 "2021-03-29T06:03:31Z")

</div>

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](https://homey.app/nl-nl/flow/AivzYx/)

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](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/4/94a95fee22ca0cd73a923e44da7087da98a6fe60.png)

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 🙂 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.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [March 29, 2021, 1:59pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/17 "2021-03-29T13:59:27Z")

</div>

> [@H.O.O.P. (Hope) - Examples](https://community.homey.app/t/h-o-o-p-hope-examples/45114/9):
>
> debounce-functionality

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 😉  
Now I’m studying your flows for Kongedam. I kind of like those kind of puzzles.,

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 29, 2021, 2:03pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/18 "2021-03-29T14:03:03Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 30, 2021, 3:21pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/19 "2021-03-30T15:21:24Z")

</div>

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 🙂  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/9/799588ae37e42d899110525d49e404ff7081e572.png)

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 30, 2021, 7:51pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/20 "2021-03-30T19:51:27Z")

</div>

Added [Trigger Cards](https://community.homey.app/t/h-o-o-p-hope-card-overloader/45512) - 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](https://community.homey.app/t/h-o-o-p-hope-examples/45114/14)

Now live in the Homey Community Store!

---

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [March 31, 2021, 10:07am UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/21 "2021-03-31T10:07:07Z")

</div>

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](http://192.168.178.2:5005/woonkamer/favorite/538) Dance Radio”  
or like: “[http://192.168.178.2:5005/woonkamer/favorite/538](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…🍻

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 31, 2021, 10:28am UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/22 "2021-03-31T10:28:08Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [March 31, 2021, 2:24pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/23 "2021-03-31T14:24:54Z")

</div>

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

[Next page](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709.md?page=2)
