Turn Your Dumb Solar Inverter Into a Smart One With This Home Assistant Hack
As I ventured into the world of renewable energy two years ago, my interest in IoT devices and hardware grew exponentially. One crucial aspect that became apparent is the need for data from solar inverters to monitor energy consumption. While some inverters come with basic monitoring solutions, there are limitations to these built-in features.
I've had experience with SRNE inverters and more recently switched to Growatt SPF 6000 ES PLUS. However, their OEM energy monitoring solution using ShineWifi data logger wasn't sufficient for me as it only updated every 5 minutes and relied on the Growatt Cloud service, which I wanted to minimize my dependence on.
That's why this tutorial is designed for those who own the same inverter and want to make it work locally within their Home Assistant network. We'll be taking data from the inverter's Modbus RTU Protocol, sending it over TCP, decoding the information, and displaying it as entities inside Home Assistant.
Hardware Setup: Connecting Your Waveshare RS485 to ETH Adapter
The first step is connecting your Waveshare RS485 device to your home network. The device comes with a power adapter; plug it into power and then connect it to the DC 5V port on the side of the device.
Next, take an Ethernet cable and plug one end to your router's LAN port and the other end to the Waveshare device. Once connected, observe if the Ethernet port has a steady and blinking light to confirm the connection was successful.
Check the back of the Waveshare device for the default IP address, username, and password (mine is 192.168.0.7, admin, and admin). Visit the default IP, and you should see the Waveshare homepage.
Temporary IP Configuration
To communicate with the Waveshare device, your computer's IP must match its network address. Since my router's range is 192.168.8.x, I temporarily changed my PC's IP to 192.168.0.10 (or any other 192.168.0.x, except .7).
Go to your Network & Internet settings, click on edit IP Assignment, and toggle IPv4. Set the IP Address to 192.168.0.10 and the Subnet Mask to 255.255.255.0.
Connecting the Inverter to the Waveshare Device
The next step is connecting the inverter itself to the Waveshare device. Insert pin 1 into B- and pin 2 into A+ on the Waveshare device.
Configuring Home Assistant for Modbus RTU Over TCP
We've successfully connected the Waveshare device to our network and configured it to send data using the Modbus RTU protocol. Now, we need to configure Home Assistant to decode this information and display it as entities.
Home Assistant has a built-in Modbus integration that allows us to achieve this. We just need to configure it by updating the modbus.yaml file and enabling template sensors in templates.yaml.
The High and Low values are stored as two registers (high and low bytes), so we need to combine them correctly using template sensors.
Conclusion
This Home Assistant hack allows you to turn your dumb solar inverter into a smart one, providing real-time energy monitoring data. By following this tutorial, you can take control of your energy consumption and make informed decisions about your renewable energy setup.
Thanks for reading, and feel free to share your experience with this project!