# How to set variable to value based on logic

I want to create a flow that sets a moisture limit variable based on the price of electricity.
It seems the “set” logic card can only set a variable to a fixed number, not to {…calculcation…}.

What I want to do is : create a flow with a logic card that sets the variable källare_fuktighet_gräns to {55 + #Current price * 10 }.

How can I do this?

The “Calculate … as …” THEN logic flow card feels sad that it exists but is not being used.

Sorry for OT.

Thanks
I tried the Calculate card but I think I got the curly braces wrong.
Thanks.

I have now made a test flow that has these “Then cards”:
Calculate variable
Send push notice with the variable value.

However it seems that these two Then cards are not executed in that particular order.
Is that how Homey works?

Yes, that is exactly how Homey (normal) flows work, all THEN cards are activated at the same time, and can finish in any random time, so it indeed can happen that the push is already send before the calulation has finished.
You could “fix” it in any of these 3 ways:

• Advanced flows, where you can put them after each other.
• Add a 1 second delay to the push message card
• Create a second flow where you respond/trigger on the change of the calculated variable
1 Like