Writing to sensor from nodered

I may have started down the wrong path, so reel me in if I’m headed the wrong way. I have a MorningStar solar charge controller for which there is no integration. I’m polling data from it periodically via modbus and have those values available to me inside node red.

I don’t want to lose values such as total kwh production when I restart HA, so I’ve created a helper sensor as a number. It is my understanding that if I don’t spec an initial value, the current value will survive a restart.

So the question gets to be how to get the values I’m decoding from modbus over into the sensor value? I am aware you can’t write a value within a function block (ie javascript) but what about other nodes?

Or should I create a sensor with nodered and will it retain a value that survives a restart?

Or should I create a sensor with nodered and copy that value to the sensor I created to retain kwh produced?

Thanks for the help in advance… just trying to figure out any path forward.

1 Like

You can use a service call/action node to call a get/set value on the input helper.

1 Like