I am trying to figure out how to spilt my battery charge and discharge values.
The output reads currently as a positive value (Charging) or a negative value (Discharging).
I want to split these outputs so I can use them accordingly.
I tried to use this post as a guide line but I couldn't figure it out.
Data is being read from Modbus with the following function node.
Hi Colin, thanks for the help with that. I could not figure that out.
So the current function node works perfectly, but it only gives me one outcome, either a negative value or a positive value. The current value from the debug node it -783. So the battery is currently discharging.
I am needing to add 2 sensors to my flow chart so I need to split the positive and negative values so I can create the 2 sensors. Hope that makes sense?
You can use a Switch node to check for >= 0 or <0 and send it to two outputs, is that what you mean? Alternatively, in your function node, if you are detecting +ve and -ve then use two outputs on the function node and send it to the appropriate one there.
Great, that worked using the switch node. Appreciate the help.
Now I am wanting to change the negative output into a positive? Are you able to assist with that?
The other issue I am getting now is that when the battery stops charging and the value changes to negative, the positive output value just remains as the last known value. Is there a way to make the value 0 if it's not getting an active value from the sensor?
Feed the negative output into a Change node that sets the payload to 0 and merge that in with the positive wire, so each time you get a negative value it sends 0 as the positive value. Do the same the other way round for the negative value.