Closed rlindner closed 1 year ago
@HoLo85 Could you do a quick sanity check here?
Hi, sry for the late response, I haven't logged in for a while.
Your fix looks good, since the message is only used in getValues()
it did not make sense to define it globally, sry for that. A further improvement would be to declare message
as let
inside the method. Also I think deviceConfigs
could be declared as const
because its only set once on init. My plan was to be able to reload the configs, but I think for now it does not make sense.
As I currently don't always have access to my solar installation I can not test your update, but I will try it the next time I can access my setup.
I did some investigation regarding https://github.com/rlindner/node-red-contrib-sma-webconnect/issues/22 and think I found the issue. What caught my interest is that all reporters on the issue were using at least two instances of this node in their flow and I thought there must be a problem with shared state.
The
message
var was defined "globally" in the scope of the exported function. And it appears that this function may only be called once from the runtime and then reused for all nodes. So I've just moved themessage
into thegetValues
function now, as there's no need for it to be defined outside of it.