diy solar

diy solar

API control of SMA Home Manager to charge battery based on tariff

placetobe

New Member
Joined
Jun 12, 2024
Messages
6
Location
Lancashire
New to this forum, so apologies for any breach of etiquette or incorrect capitalisation of common acronyms.

I'm in a rural location and wanting to get off fuel oil, so I've been installing underfloor heating as rooms are renovated as a secondary method of heating. I'm now at the point where the key areas have that installed, and I'm looking more seriously at switching to using it as the primary method for at least some portions of the year.

I've got a solar array (10Kw), a BYD battery (13.5Kwh), a SMA Sunny Island inverter and a SMA Home Manager. I will definitely need more panels, and probably need another battery, but I'd like to try to make most efficient use of the kit I have until I can afford more.

What I'm wanting to do is to monitor tariff info (e.g. from Octopus Agile), and then kick the Home Manager to charge the battery when the tariff is low. I'm not on an agile tariff yet, but I could switch if this is possible.

I can write code, and I believe the SMA kit has APIs - I can find Swagger info. But I'm probably not the first person to want to do this. So:
  • Anyone know if this is possible?
  • If it's possible, anyone know of any pre-existing code that does it?
Thanks for any pointers.
 
Which Sunny Island have you got, there are several and they all differ in what functionality is available. My SI5048's only do SMAnet, later ones do modbus RTU and eventually Modbus TCP.
 
The web UI for the Sunny Island has a section for Modbus. Activating that, I can connect on the port (502). So it looks like it has that.

I gather (sorry, new to this) that modbus is a standard interface, so that presumably makes it more likely that there's some existing code which can use that?
 
First off get to the SMA website and download the Modbus register file, note they identify the registers you should not write to as the memory used will only take so many writes.


Note also for the 13 there are several version of the modbus/parameters depending on the firmware loaded.

This one is for firmware 1.04


This one is for firmware 3.2009


You could use Node-red to write to registers based on data you set yourself or monitored.

Github is a good place to look for software, this is for SMA Home Manager

 
My firmware is 3.30.12.R. I'm assuming it's safe to use the 3.20.09.R list.

I'm not familiar enough with the kit to find it easy to spot which register is the "make it charge now" control, if there is one. Any pointers on that?

Not used Node-red before, but I think I get the kind of thing it does. https://github.com/mkgeiger/node-red-sma looks like a possible starting point.
 
I don't have your SI so you will need to look at the SMA files, SMA have posted the 3.20.09 as the latest version so a later firmware will use the same registers.

Node-red is based on Node.js which is javascript, so even though its supposed to be graphical it helps to set the nodes up if you know a bit about javascript. Which I don't so I bludgeon away and try this and that until it works or I try another node.
 
Try this just to get you going, it does Modbus TCP.


Runs on a PC with Java installed, your port is 502 and the ID for an SI is normally 3, with 1 and 2 reserved for Webbox and Home Managers. Play around with first getting a connection, then reading registers and comparing the register number and content with the SMA documentation. You can try connecting directly to the SI or possibly through the Home manager, you could do that on the old webbox but no idea for the HM.
 
Try this just to get you going, it does Modbus TCP.


Runs on a PC with Java installed, your port is 502 and the ID for an SI is normally 3, with 1 and 2 reserved for Webbox and Home Managers. Play around with first getting a connection, then reading registers and comparing the register number and content with the SMA documentation. You can try connecting directly to the SI or possibly through the Home manager, you could do that on the old webbox but no idea for the HM.
Thanks, I'll have a play.
 

diy solar

diy solar
Back
Top