With this device you can create and execute (and await async/sync as conditions) Flows with arguments.
What you do is creating Methods around Objects.
Create Flows/Methods with the right amount of wanted variable types, and trigger it from anywhere with the arguments given.
Setting the Method Group Device Setting “Overloadable” will even let you trigger a TriggerCard (Text3:, Boolean1:) by an ActionCard (Text:2, Boolean1) or an ActionCard (Text:1).
It will also create long lists in actioncard search, so use it at your own choise.
Make sure when using overloadable, that you check the flowtoken “variable# has value” before using variable#, because non-given arguments will be filled with defaults:
• Text: null or a whitespace ( )
• Number: -1
• Boolean: false
Also keep in mind that these triggers cannot be triggered by hand or with testing directly, because they have tokens.
For debugging/logging there are some great apps for that allready!
So basically there are two ways to go at it:
- Device setting Overloadable true/yes
Create a trigger (flow name MethodHello) type (4 texts, 1 boolean, 1 number)
This is the max arguments at the moment. Just use the max for one trigger flow, and put everything you want to handle in this flow.
Now you can trigger it with every ActionCard there is like Start MethodHello (1 text, 1 boolean) and it will trigger the flow created above, with al tokens except text1 and boolean1 set to “variable”_has_value = false
- Device setting Overloadable false/no
You create (like in the “Example for a Notification / P.A. System”) trigger-flows/methods specifically, and trigger them specifically.
Start MethodHello (1 text, 1 boolean) wil only trigger (and show in list) flows that have a trigger for (1 text, 1 boolean)
For triggers you can define the following:
This wil execute the conditions card in the default way.
The first 2 groups (IF and 1st OR) are executed the default way.
But whether the conditions fail or succeed (unless an error is thrown), the conditions in the last OR part are executed (nothing is done with its value)!
Whether Then or Else is executed depends solly on the results of the first 2 groups (IF and 1st OR).
When using this, if in the first condition-group (Or) there is a error, the flow will continue in the catch (with a error and stacktrace(!) token available) and when succesfully completed the catch statement, it will run the finally part. You could Throw the error again in the finally part if you want the error to traverse up.
- Executing actioncards asynchroon (default)
Al actioncards are started at the same time.
- Executing actioncards synchroon (default)
Actioncards are started after each other waiting for the previous to finish.
This will change delay behavior, since 10 second delay is not from start of flow but 10 seconds since previous actioncard completed.
Example another if-or-finally
If text2 has value and text2 is ‘Alarm’, then play Alarm-tone, else plays a Notification-tone.
Finally, start the Speech.
Example for a Notification / P.A. System
This example creates multiple Methods on my Notification Methods (Flows), which allow me to Send Notifications to my Sonos (TV) PlayBar or my SmartWatch.
Either only to my Watch, or only my TV Bar, or to both, or to both with special options like a title being “Alarm”.
Al actions-to-execute and conditions-to-check are programmed in a single end “method” (flow) for each device i want to notify, giving great flexability on how to handle end-stuff without having to repeat those actions in various starting flows.
Instead of a Watch you could ofcourse use the (Homey Notifications to) Phone.
I can activate any of the Methods below, and it will execute exactly what I have programmed in those Methods.
Next is a diagram of how the flows will function together.
Next the Methods themself