Batrium Watchmon4 in Node Red

Bloater

New member
Joined
Aug 22, 2017
Messages
2
Hi all from a damp UK,

I've finally finished off my 'fully node red' Watchmon dashboard that has been an on-and-off project for a long while now... I've not seen another one around (or I would have used that!) so I thought I'd share it in case it was useful to anyone else...

My needs are simple, so my example dashboard gives me what I need to be able to see on my phone, however, all the Watchmon output is exposed, so you could really go to town if you wanted to replicate the entire Watchmon Toolkit... I've also not included writing to a database or other storage as that's well documented elsewhere. If you have more than one Watchmon (you have too much money!) you will have to work out how to put a filter in based on the system ID - unless they broadcast on different ports???

Dashboard example:

image_rkdmol.jpg


I tried to post the flow here previously and it exceeds the character limit so I've just popped off and created a git repository... I think I've done it right! https://github.com/Bloats/Powerwall-stuff

Anyway - happy to answer questions if I can

Cheers all

Tim
 
Clean and simple - I love it...
 
Good work. I run watchmon listener to Mqtt to My node red
 
whoinow said:
How are you querying each cell voltage?

Basically the Watchmon exposes everything you see in the provided toolkit software (and more) and by working through the protocol datasheet you can pull out the bits that you actually need... I probably didn't make it clear that Node Red simply listens for the Watchmon's wifi broadcast and grabs all the data from that directly - it's an alternate way of doing it to using a Pi to convert everything to Mqtt which I was using through the grafpi until yet another SD card died and I needed something else whilst Amazon did their thing!

Specifically for cell voltages, every 150ms message type 0x4232 transmits a data packet for each (in my case) longmon - they are numbered and sequentialso you know which longmon it is, and one of the fields is"MaxCellVolt" - so in the space of (in my case) 14 x 150ms I get the entire string's cell voltages.

Hope that helps?
 
I also had a few SD cards died while using grafpi soft from Daniel.
So I decided to use a SSD instead with backups to an HDD, and so far so good.
 
Cheap SD cards die easily :)
You need ad cards made for heavy writing.
But best is SSD . You can now also get SSD adaptors for rasp 4 now
 
Hey Tim - this is totally awesome, thanks for posting this.

One thing I am struggling with is getting the Bar Chart to display the cell voltages. I have 28 mon's and was playing around with the barchart component and I just can't get it to display the chart. I think it might be something incredibly silly, and I can get the Watts, volts and amps from the Shunt successfully, but is there atrick to getting the bar chart to display values. It always shows blank, and I have tried hard-coding the response and it still doesn't show up- any tricks?

return msg.payload = [{"series":["Cells"],"data":[[3.7,3.6,3.9]],"labels":["1","2","3"]}];
 
Hi

I'm trying to use your flow but im getting an error and i think its to do with binary parser

the section in each function right at the top has

global.get('binary_parser');

my understanding it to do a get you must have this stored somewhere first, my assumption was that using npm install binary-parser woudl fix this but it seems not, what am i missing ?

each fuction is spamming the following err:

TypeError: Packet is not a constructor

Boysie

[Answer]

You need to add thebinary_parser to the settings file for node red, foudn the details here:

https://discourse.nodered.org/t/flo...through-on-how-to-install-the-npm-module/5174

Boysie
 
For anyone using the ISO made by @daromer and wanting to try this you have to disable the Batrium service first because it uses the same listening port.
To do this go to webmin: https://127.0.0.1:10000/ then System and Bootup and Shutdown and make sure the Batrium service is turned off.

Then turn off node-red: with node-red-stop

Then edit the following file so it looks like this: /root/.node-red/settings.js
...
functionGlobalContext: {

binary_parser:require('binary-parser').Parser
...


EDIT: Then we have to install the module like this:

pi@grafpi /energy-logger/solar-sis/example/PCM60x $ sudo su

root@grafpi:/energy-logger/solar-sis/example/PCM60x# cd /root/.node-red
root@grafpi:~/.node-red/node_modules# npm i binary-parser

Then start up node-red again with: node-red-start

I'm having the same problem as @mbrunton though, i can display all the info except for the bar chart. I'll report back if i can get it working.
 
Bloater said:
Anyway - happy to answer questions if I can
Cheers all
Tim

Cell-King said:
I'm having the same problem as @mbrunton though, i can display all the info except for the bar chart. I'll report back if i can get it working.

Great stuff Tim and Cell-King.

Got it working with Cell-Kings info on the settings.js edit.
Changed the color and all is good.


image_mabytd.jpg


Wolf
 
Hi Wolf, Could you explain how you got the bar chart working in a little bit more detail please? I have seven cells in my pack, I can display the cell voltages but I can't display them on the graph, I'm sending the chart_ui the following array:

msg.payload : array[1]

array[1]
0: object
labels: array[7]
0: "1"
1: "2"
2: "3"
3: "4"
4: "5"
5: "6"
6: "7"
data: array[7]
0: 3.88
1: 3.87
2: 3.88
3: 3.89
4: 3.88
5: 3.88
6: 3.88
series: array[1]
0: "Cells"
 
Cell-King said:
Hi Wolf, Could you explain how you got the bar chart working in a little bit more detail please? I have seven cells in my pack, I can display the cell voltages but I can't display them on the graph, I'm sending the chart_ui the following............
Make sure you have the y-axis min and max settings.

image_htafez.jpg


If you have the min max settings and it still doesn't work I can send you the flow as I just created the barchart in seconds and it works just fine.

image_llknxy.jpg

Wolf
 
Thanks for that, yes I have the min and max set as you describe but I still can't get it to work. Does your "Get the set of saved global variables" look like the following?

var ONE = Number(global.get('ONE')) || 0;
var TWO = Number(global.get('TWO')) || 0;
var THREE = Number(global.get('THREE')) || 0;
var FOUR = Number(global.get('FOUR')) || 0;
var FIVE = Number(global.get('FIVE')) || 0;
var SIX = Number(global.get('SIX')) || 0;
var SEVEN = Number(global.get('SEVEN')) || 0;

var m = {};
m.series = ["A", "B", "C"];
m.data = [ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN];
m.labels = [""];
return {payload:[m],topic:msg.topic};

I've been playing around with it so yours might look slightly different. Yes, if you could paste your flow somewhere that would be great.
 
Yea mine looks a bit different.
M.label and m.series are not right in yours I believe.

Here you go.

Code:
var ONE = global.get('ONE') || 0;
var TWO = global.get('TWO') || 0;
var THREE = global.get('THREE') || 0;
var FOUR = global.get('FOUR') || 0;
var FIVE = global.get('FIVE') || 0;
var SIX = global.get('SIX') || 0;
var SEVEN = global.get('SEVEN') || 0;




var m = {};
m.labels = ['1', '2', '3', '4', '5', '6', '7'];
m.data = [[ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN]];
m.series = ['Cell'];
return {payload:[m],topic:msg.topic};

image_ggsytd.jpg



Here is the flow

Code:
[{"id":"e7cd0e18.4f55b","type":"function","z":"a60793ee.ec643","name":"7Cell","func":"\nvar ONE = global.get('ONE') || 0;\nvar TWO = global.get('TWO') || 0;\nvar THREE = global.get('THREE') || 0;\nvar FOUR = global.get('FOUR') || 0;\nvar FIVE = global.get('FIVE') || 0;\nvar SIX = global.get('SIX') || 0;\nvar SEVEN = global.get('SEVEN') || 0;\n\n\n\n\nvar m = {};\nm.labels = ['1', '2', '3', '4', '5', '6', '7'];\nm.data = [[ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN]];\nm.series = ['Cell'];\nreturn {payload:[m],topic:msg.topic};","outputs":1,"noerr":0,"x":1180,"y":120,"wires":[["bbffd6bc.05b508"]]}]

Wolf
 
Thanks for that, still no luck. I even copied your function over to my existing flow to see if it was a bug with the existing one. I wonder if it's to do with dependencies somewhere else.
 
Cell-King said:
Thanks for that, still no luck. I even copied your function over to my existing flow to see if it was a bug with the existing one. I wonder if it's to do with dependencies somewhere else.
Whats your debug msg.payload look like?



image_dzillf.jpg


Wolf
 
Hmmm.

The only thing I can think of is that there is a conflict with one of the palettes.

Do you have more than one ui_chart installed?

image_sjvwkl.jpg


Wolf
 
Back
Top