question

larsea-dk avatar image
larsea-dk asked

“Function” functionality in NodeRed

Hi

I have some NodeRed flow checking hourly price to determine if I should shut of feedin. So an hourly input.

I do this every hour(could be done once in an array if I had th skills). I do also have a NodeRed flow to lower the charge of the battery by chosen inputs(some fixed numbers, other based on the expected total sunpower). This flow do check numbers every second to always adjust depending on incoming solar power(clouds etc), done by tweaking grid setpoint.

I have integrated the hourly input, so if feedin status is “off”, it shall just set the grid offset to “0”( the chosen grid setpoint in my flow). But it seems like the chargeflow with every second input overrule the hourly input. Any ideas? Is it because im using a “function” that forget the “hourly” input and then this input will not set grid setpoint to “0”?

BR,

Lars (Denmark)

dadfe414-9b03-4796-b10c-9ba8580c7c11.jpeg

b7a1e85b-ec55-40a4-bb77-179c308705a5.jpeg

Node-RED
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·

Hi @larsea-dk

I'm not sure I fully understand the question. Are saying that your issues is that the Hourly input data isn't being stored due to it running again/resetting itself to 0?

If I've understood you could store the Hourly data in a global variable and read said variable from this node above. Have a separate flow to update the hour data and store it into a global variable?


I think that's done by global.set('varname', varcontent) and then read via

var varname = global.get('varname') || 0;

0 Likes 0 ·
larsea-dk avatar image larsea-dk matt1309 commented ·
It seems like the flow do set to 0 at negative pricing and lowers the mppt power. Then if I sudden have a peak power and hereafter the consumer is no longer there, the charge current will of course go up. But if this charge current goes past my set max charge in the flow, the flow will tweak the grid setpoint. Then it seems like the flow “forget to check” that I have set the grid setpoint to 0 due to the negative princing.

It might help what you suggested, I will look into this!

0 Likes 0 ·
1 Answer
Dirk-Jan Faber (Victron Energy) avatar image
Dirk-Jan Faber (Victron Energy) answered ·

Without seeing the actual flow files, this is a bit hard to diagnose. You might want to take a look at the filter node to filter out unwanted inputs. Using context storage (https://nodered.org/docs/user-guide/context) could also help.

You might also want to take a look at the alternative for your setup at https://flows.nodered.org/node/victron-dynamic-ess.

3 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

larsea-dk avatar image larsea-dk commented ·

great that you actually already been working on making such a flow for controlling this. Really great support. I’m no sure how to upload my flow here the easiest way.

But I will try to download your flow and take a step at a time to understand it. I do already control my grid set point to control the charge of the battery over the day since max battery charge does not always make sense eventhough this is the Victron mindset…at least for half a year ago. I do see a much more stable and controllable charging of my battery based on Louis van der Wahl BMS integration combined with node red control tweaking the grid set point. Great Victron has this Nodered.. just make me happy about choosing Victron eventhough its more expensive.

0 Likes 0 ·
larsea-dk avatar image larsea-dk commented ·

@Dirk-Jan Faber after trying the alternative, my own forecast solar do not work anymore. is this related somehow to your solar forecast or the VRM token?

Saying request error socket hang up https api.forecast.solar…

1fe9a18d-545d-461a-8db8-0ba71eb24c13.jpeg

0 Likes 0 ·
Dirk-Jan Faber (Victron Energy) avatar image Dirk-Jan Faber (Victron Energy) ♦ larsea-dk commented ·

I have not seen that error message before. Perhaps the same request object is used and the headers for the https request get messed up somehow.

What you can try is to add is setting msg.headers={} after the http request. (See https://stackoverflow.com/questions/43237390/socket-hang-up-when-doing-several-http-requests-inside-my-flow)

0 Likes 0 ·