[FAQ][Advanced Flow] Infinite canvas. Infinite creativity

That’s a nice idea and for just one value one could just send it like {“message”: “the message”} but for more data it going to be complex.

Are there a smart and easy way to build the JSON? How do you call this flow??

Build the json as e.g {“Type”:“Alarm”,“Prio”:“High”,“Msg”:“Movement sensor triggered in kitchen”}.

{“Value name”:“value”,…}
Then use the parse-json card to retrieve values as: parse path to value (not sure about the syntax of the card).
The paths in my example are Type, Prio and Msg.

You can do this in the flow directly. One example is:
Use “Tag is exacly True” card and then call the card “set text to tag” with the text Yes. The new created tag will then hold the text “Yes”.
No need for Homeyscript

I’ve tried this, but this only works for 1 card. Because for every “set text to tag” card, it creates a new tag. Then I’ll have one tag for yes and for one no. But that’s not what I want :frowning:. I just need 1 tag with yes or no.

Strange thing is, when I run the flow manually. It says “Nee (No)” But the output to papertrails/telegram is false. Feels strange for me that the output result is true/false instead of yes/no as shown in the result… Maybe @Emile knows why?
image

That’s true, a new tag is created for each parsing.
Maybe save the result in a variable instead?

That’s the workaround and not really what I was looking for. But this means I have to create a tag for every device that I want to use the yes/no logging. This means lots of tags instead of just 1.

Still the Yes/No is sort off visible in the device tag. Hopefully athom will make this available or fix this.

It’s a lot to write I was looking for an easy way to build the JSON object. If there’s no app perhaps one can use AF?

Hello,

I really LOVE the new feature, it’s so much easier to create complex automatisation.
BUT… Is it normal that everything becomes very slow when making an advanced flow?

For example :
Before I had around 75 flows for the whole automatisation in the bathroom (Lights, Shower, Music, etc) , now I managed to build those 75 flows into 2 advanced flows, 1 for the lights, 1 for other automatisations.
since the advanced flow chart for the lights is getting bigger and bigger, I noticed that my PC can’t handle it, and I have a delay for 2 to 8sec with everything that I do… Add new things, drag existing things, even connecting 2 cards can sometimes take more than 8sec just to get the line from point A to point B.

My PC is a MSI stealth GS66, I doubt that my PC is not ‘strong’ enough for this :upside_down_face:

I often use AUTOCAD, even with this program I never experienced this kind of delay… :triumph:

Have other people also experienced this?

One experience I have had is that not all then-cards is chainable.
I have a flow where multiple timers and transitions (Chronograph app) are started or stopped.
For better overview I placed them in a chain instead of in parallell. This caused only the first timer card to be triggered. Took me a while to find that “bug”.

Edit:
I understand now that this is because trying to stop a timer that has expired will return an error (not found) even if not really being an error.
So in my flow I should have connected both the error and the normal output to next card.

I like the JSON while it is very readable, but also error prone in writing it.
My solution is a bit different, but kinda similar although the parsing is a bit more work maybe…
I set a Text Logic card to the following:
<group/type>;<priority>;<message> and then I parse it like this:

text values I retrieve with the following HomeyScript code:

// LogMessage - Group
const msg = args[0];
let elm = msg.split(';')
return elm[0].trim()

2nd field, which is an integer:

// LogMessage - Level
const msg = args[0];
let elm = msg.split(';')
return parseInt(elm[1].trim())

You can create your own alternate solution like so and adjust the HomeyScript accordingly
type=<myvalue> prio=<50/high> msg=<hello there> (instead of spaces you might want to use something like a colon or semicolon to split the values)
Might be simpler than JSON in the end…

Here’s the code to split the string with type= prio=50 msg=anything you ok

const note = "type=msg prio=high msg=hello world what is going on app=myapp"
const regex = /([a-z]+=.*?)(?:(?=[a-z]+=)|$)/gi
const found = note.match(regex)
console.log(found)

Resulting in an array with 4 elements:

["type=msg ", "prio=high ", "msg=hello world what is going on ", “app=myapp”]

There is probably some here than knows how to use a .map or .reduce to convert this array into a key-value JSON object with a nice one-liner split on the equal sign (=)

1 Like

Regarding disabling flows.
For standard flows, when issuing a disable of the flow itself, the flow will not start again but will proceed until finished, so run once.
For advanced flow the flow seems to stop too, so it will only run until the disable card is performed and the rest of the flow will not be performed.


In this example only the text “Pre disable” will be sent.
If I run it in test mode it works as expected and all texts will be sent, but not live.

1 Like

You coud use [APP][Pro] Advanced Triggers - Trigger and action cards with eventname for Advanced Flows

I converted my standard kitchen light flows to AF. Not sure which is easier to read. I think re-using a ‘when’ card is still better sometimes than drawing lines to anywhere :wink:
I have to say, the simulator clarifies it well when I get lost in the web.
The functionality:
Depending on the sun position, daylight intensity and day/evening/night scenes:
switch / dim countertop leds, central light and 3 spotlights.


1 Like

Slowly I am migrating my flows to Advanced Flows, and enjoying the process!

Having all triggers on one ‘canvas’ does make me wonder: is it possible to prioritise triggers?

As an example, a blind closes thru a Lux trigger, but I want to keep it open and push a Homey linked button to do so. But, Lux closes it again…repeat

I could include a variable per flow on the canvas, with higher numbers giving higher priority, but an alternative would be “top to bottom” priority. Or a setting per ‘when’ trigger.

What do you think?

There is no built in prioritization, you need to handle it yourself.
I use the app “Sets” for this.

How did you solve this with the old flows? With the old flows, you can’t prioritize a triger either.
I don’t know the “Sets” app, but you can/must solve this use case with a yes/no variable or a virtual switch. Or And… conditions are missing in your AF.

I struggled there too…

Before - old Homey firmware - the app State Control could handle this. Unfortunately, that App doesn’t exist anymore.

PS
Switchable “Top down priority” would be a great addition.

Homey might seem intelligent but cant distinguish triggers that have a relationship and should prioritize or that have no relationship and should execute all.
Then if your choice was up or on for how long should that stay if below is your wifes trigger and she wanted down or off.

Just program it yourself with a flow, with variables and or timers.

1 Like

Oké.

So, Top down, sex and age!

Just kidding!

:grin:

2 Likes

Check out the Sets app.
It behaves like a bit pattern where you can check wether a “bit”/state is set or not.
Create a set called BlindState.
Then create individual states for each trigger.
(De-)Activate the states in each corresponding flow.
Create a flow that check the states in prio order.
It is also possible to activate a state temporary, for a specified period.

2 Likes