Homey Community Forum

Flow card for calculations -> where to put the result?

I plan to create a action card that performs a complex calculation. Where do I put the result? The only thing I see currently is to trigger a new flow…is there any better option i.e set a tag that can be used by following action cards?

You can use variables to do this. In the app go to “more” and choose “logic”

This is not what I was looking for. What I want is that my app can provide an flow action card that accepts an input value from a token and then performs some calculations. Unfortunately it seems I cannot have a new token that would hold the output.

I could write into a variable, but that would require the use to create one first:/

I’m not sure if I understand your requirement correctly, but have you ever looked at the App Flow Event Bus?

If you do the calculation in HomeyScript, you can also create a new tag there where you can put your result in:

const DAYS = [‘zondag’, ‘maandag’, ‘dinsdag’, ‘woensdag’, ‘donderdag’, ‘vrijdag’, ‘zaterdag’];
var WeekDay = DAYS[new Date().getDay()];
await setTagValue(“WeekDay”, {type: “string”, title: “WeekDay”}, DAYS[new Date().getDay()]);

Actually I do not need other apps such as flow bus or homeyscript, I am developing my own app;)

So what I am basically looking for is to create a new tag in an action card or something similar, but as this seems not possible I only see the following solution:

  1. my app offers an action card that does the calculation

  2. my app offers an trigger card which gets triggered when the action card has completed the calculation and the result is passed as token into the trigger card

That works fine, but it is a bit a workaround as the user needs to create a separate flow