I have created a flow that daily calculates the average of my solar production of the last five days. The flow does not react how I suspected. The variablew for the day, after the flow has run, are all the same… It looks like the cards are started all together instead of in sequence.
What am I doing wrong ? I cannot wrap my head around it..
In the above screenshot there was an error withe the day1 variable, that is not the issue I am having, just noticed it and fixed it though. This was the result of me changing an app but not the reason for all variables beiing the same which is what is my issue at the moment.
Flow cards are executed asynchronously, so you will need to add a delay to each one to ensure they run one after the other. E.g. use a 2 second delay on the second card, a 4 second delay on the third card, etc.
Alternatively you could use the Advanced Flow and string the cards together in a chain.
The new day 5 becomes the old day 4.
The new day 4 becomes the old day 3.
The new day 3 becomes the old day 2
The new day 2 becomes the old day 1
The new day 1 is calculated.
In this order with a little delay between each step.
You are setting day 4 to day 5. So day 5 and day 4 have the same value. Then you are setting day 3 to day 4. Now day 3, 4 and 5 have the same value
@Marc_Jurriens you always have to start updating the oldest value first so you can create for new value i do have similar scenario where i store average daily temperature value from my outside sensor, and i am keeping the values for 3 days and based on that calculate if “heating season” should be enabled of disabled… in advanced flow it looks like this:
I prefer to use regular flows, i have a few advanced flows and the technics of them work fine bur i prefer having several simple flows that interact using variables instead of everything in one advanced flow, for me that is more flexible…
I am doing this to steer my energy usage and contract:
1 flow to check if energy prices go negative and set a variable if so
1 flow to take actions based on that variable (stop solar production, set home battery to charge only, turn on all the lights.
1 flow to check if energy prices are going to be negative in 2 hours, if the home battery is full enough then stop solar production and use the home battery untill the negative prices start to drain the battery before it starts charging against negative prices.
1 flow to on a daily basis check what the average production of my solar was and based on that change the battery strategy from solar only ((NOM) to solar+net (ECO).
First flow is used to check if prices are negative to set a variable (I use this to make sure if the app I use to define if prices are negative ever changes I only habe to change this flow and everything else does not need to change):
Then I have another flow that does the opposite when prices become positive again.
I also have a flow that, when prices go negative two hours from now, already turns of solar production to drain the home battery so it can charge the moment prices become negative.