The ultimate goal is to be able to monitor my power-wall in the Home Assistant (HA) dashboard. In my case, HA runs on a 10″ android tablet out in the Kitchen. Firstly, I need to throw some recognition to a couple of people. The first being @Wolf. Absolute legend helped me out with some Node-red issues, and basically, without him, the 2-3 days development time would have turned into weeks. A Full list of recognition is at the bottom of the past! Enjoy!
Oh and yes I could have done this whole install on Docker/Portainer and I most likely will go down that route, but for now, this is the down-and-dirty version line by line.
- Ubuntu 20.04 LTS Server Installed on a VM or PC.
- A Batrium Watchmon on the same network as your VM/PC.
- Node-Red Flow (JSON file) Download Here.
- Grafana Dashboard (JSON File) Download Here.
Step 1 – Update/Upgrade
Step 2 – Install Grafana
Step 3 – Install InfluxDB and Chronograf
CHRONOGRAF Install (Not Essential, but good for fault finding.)
CREATE INFLUX DATABASE (For use with Grafana)
Step 4 – Install Node-Red
NODE-RED BOOT ON STARTUP
Step 5 – Configure Node-Red
Once Node-Red is installed we need a few additional packages installed to allow Node-Red to interpret the UDP data coming from the Batrium Watchmon. The 3 packages are:
- Binary-Parser (Install via Linux CLI)
- node-red-contrib-influxdb (Installed in Node-Red GUI)
- node-red-dashboard (Installed in Node-Red GUI)
The latter two items can be installed via the “Manage Palette” function in the Node-Red Settings. The Binary Parser function needs to be installed via the CLI.
Now you need to import the Flow into Node-Red. You can download the flow here. Of note here is that this flow is set up to listen for the Batrium UDP data on port 18542. We opened up this UDP port during the Node-Red install. This flow is also set up for a string of 14 longmons. If you have more as I do, then you will need to edit some of the nodes to reflect this.
We now need to configure a couple of nodes in Node-Red. The main configuration is pointing node-red influx flow to the database we created after we installed influxDB. In this tutorial we created a database called “batrium” and we know that the port for influx is 8086.
Now we need to Deploy the Node-Red flow and check the debug tab for any errors. If you see some “TypeErrors” then it is usually because the Binary-Parser was not installed correctly. Also, you can toggle the green msg.payload debug filters on and off to see the data being received in the debug window.
Step 6 – Configure Grafana
We now need to set up Grafana. In a nutshell, we need to do two things. First, add the influxdb data source. Secondly, import the Dashboard that Mr @Wolf has been nice enough to allow us to share. You can find a copy of the JSON file here.
Setup Data Source:
Depending on your battery type, amount of longmons, etc. you will need to play around with the visualization. If you have come this far I’ll let you figure out your ideal settings.
Step 7 – Configure Home Assistant
We are going to add the Grafana dashboard into Home Assistant using an embed from Grafana. Log back into your Grafana instance and locate the share button on your dashboard.
Find the Grafana Dashboard share/embed tab:
Use the link created in Grafana to create a new entity in HA. I also append the following to my link to ensure it opens in ‘fullscreen’ and ‘kiosk’ mode in HA. &kiosk&fullscreen
If your dashboard does not show up in HA, read on below to fix.
Dashboard embed fix – From what I have found online, most users report that just enabling the ‘allow_embedding = true’ function sorted the issue. I had to allow anonymous logins also. But that is probably because I have not set up a user in Grafana for Home Assistant. Use the anonymous logins at your own risk.
Well it’s been emotional, thanks for sticking with me. If you find something wrong here let me know and I’ll fix it up asap. I hope it helps and again, thanks to the contributors.
https://github.com/Bloats/Powerwall-stuff – Bloats for the original Flow
https://secondlifestorage.com/showthread.php?tid=8645&pid=59143 – Of course, the Second Life Storage Forum!
https://discourse.nodered.org/t/flow-to-decode-binary-data-and-a-walk-through-on-how-to-install-the-npm-module/5174 – Binary-Parser info
https://github.com/daromer2 – For his initial work with the UDP listener!
I look forward to the docker version
Looks like daromer2 has “released” the docker version of the UDP listener.
Just got it working
God wish i could create a docker container (one day)