• Have you tried out dark mode?! Scroll to the bottom of any page to find a sun or moon icon to turn dark mode on or off!

diy solar

diy solar

solved: SMA Sunny Island SI-6048US Monitoring with Home Assistant

Calvin98

Solar Enthusiast
Joined
Jun 29, 2022
Messages
416
This is a write up of how I managed to read SI 6048US values via a raspberry pi and send the values via MQTT to Home Assistant. Of coure you can use something else than Home Assistant.

I have 4 Sunny Islands in a 2Phase4 Setup with an external BMS (JK-BMS).


Part list:
- SI RS485 communication board
- Raspberry PI (I use the 3b+)
- USB-to-RS485 converter (be sure that the converter has a GND pin for a more reliable communication)
- I use this one: https://www.amazon.com/dp/B081NBCJRS
- MQTT Server (I use Mosquitto)
- RJ45 Communication cable
Mine came with the Sunny island. Its an RJ45-adapter to GND, DATA+ and DATA- Cable
You can also DIY it.


1. Connect the RJ45 Communication cable to the USB adapter.
GND <==> GND
DATA+ <==> A+
DATA- <==> A-

2. Plug in the RJ45 cable into the ComSMAOut RJ45-Port on the Master SI and the USB Connector to the raspberry pi.
Make sure you have terminating resistor on the ComSMAIn Port and the SI RS485 Communication board installed.


The Library I'm using uses the YASDI (Yet Another SMA Data Interface) protocol via RS485.

Make sure to set the correct Baud rate at the Sunny Island. Currently, I use 19200 to make 5 sec polling of the values possible.
I use the version 1.2 and not the latest (1.3). The latest doesnt work for me.

the mqtt topic consists of the prefix and the serialnumber of the SI. => "sunnyisland/<serialnumber>"

docker-compose.yml:
services:
yasdi2mqtt:
image: "pkwagner/yasdi2mqtt:1.2"
restart: always
volumes:
- "./devices:/home/pi/yasdi2mqtt-1.2/devices"
- "./yasdi.ini:/home/pi/yasdi2mqtt-1.2/yasdi.ini:ro"
devices:
- "/dev/ttyUSB0:/dev/ttyUSB0"
environment:
YASDI_CONFIG: "/home/pi/yasdi2mqtt-1.2/yasdi.ini"
YASDI_DRIVER_ID: 0
YASDI_MAX_DEVICE_COUNT: 1
YASDI_UPDATE_INTERVAL: 5
MQTT_TOPIC_PREFIX: "sunnyisland"
MQTT_SERVER: "<IP>"
MQTT_PORT: 1883
MQTT_QOS_LEVEL: 0
MQTT_USER: "<user>"
MQTT_PASSWORD: "<pwd>"
LOG_LEVEL: 0

yasdi.ini:
[DriverModules]
Driver0=yasdi_drv_serial

[COM1]
Device=/dev/ttyUSB0
Media=RS485
Baudrate=19200
Protocol=SMANet

[Misc]
DebugOutput=/dev/stdout


When you run docker compose from the terminal you can see the image is connecting to the SI and sending the data to the MQTT server.

This is the data that gets sent from the pi to the MQTT Server:
{
"sn": <serialnumber>,
"time": 1726852630,
"values": {
"Msg": 0,
"Soh": 100,
"TotInvPwrAt": -0.9999023601412773,
"TotInvCur": 19.20009794086218,
"TotInvPwrRt": 1.9000976830720901,
"BatSoc": 82.0000988766551,
"BatVtg": 53.60000079870224,
"BatChrgVtg": 55.10000082105398,
"AptTmRmg": 0,
"TotBatCur": -17.69990260899067,
"BatTmp": 20.20009795576334,
"RmgTmFul": 13,
"RmgTmEqu": 179,
"BatSocErr": 0,
"GnRmgTm": 0,
"InvPwrAt": -0.2999023497104645,
"InvPwrAtSlv1": -0.19990234822034836,
"InvPwrAtSlv2": -0.19990234822034836,
"InvPwrAtSlv3": -0.19990234822034836,
"InvVtg": 120.00300569983665,
"InvVtgSlv1": 119.90000178664923,
"InvVtgSlv2": 119.90000178664923,
"InvVtgSlv3": 120.00000178813934,
"InvCur": 4.300097718834877,
"InvCurSlv1": 5.800097741186619,
"InvCurSlv2": 4.400097720324993,
"InvCurSlv3": 4.500097721815109,
"InvFrq": 60.00300284998957,
"InvPwrRt": 0.40009766072034836,
"InvPwrRtSlv1": 0.6000976637005806,
"InvPwrRtSlv2": 0.40009766072034836,
"InvPwrRtSlv3": 0.40009766072034836,
"ExtPwrAt": 0.00009765475988388062,
"ExtPwrAtSlv1": 0.00009765475988388062,
"ExtPwrAtSlv2": 0.00009765475988388062,
"ExtPwrAtSlv3": 0.00009765475988388062,
"ExtVtg": 3.1990001519443467,
"ExtVtgSlv1": 3.1000000461935997,
"ExtVtgSlv2": 0.7000000104308128,
"ExtVtgSlv3": 1.3000000193715096,
"ExtCur": 0.20009765774011612,
"ExtCurSlv1": 0.5000976622104645,
"ExtCurSlv2": 0.20009765774011612,
"ExtCurSlv3": 0.10009765625,
"ExtFrq": 0,
"ExtPwrRt": 0.00009765475988388062,
"ExtPwrRtSlv1": 0.00009765475988388062,
"ExtPwrRtSlv2": 0.00009765475988388062,
"ExtPwrRtSlv3": 0.00009765475988388062,
"TotExtPwrAt": 0.00009765475988388062,
"TotExtCur": 1.1000976711511612,
"TotExtPwrRt": 0.00009765475988388062,
"TotLodPwr": -0.9999023601412773,
"GdRmgTm": 0,
"Pac": -0.9999023601412773,
"Firmware": 7.304000346921384,
"Iac": 4.300097718834877,
"Vac": 120.00000178813934,
"Fac": 60.00000089406967,
"ChpPwrAt": 0.00009765475988388062,
"ChpRmgTm": 0,
"ChpStrRmgTm": 0,
"Sic1PvPwr": 0,
"Sic2PvPwr": 0,
"Sic3PvPwr": 0,
"Sic4PvPwr": 0,
"TotSicPvPwr": 0,
"TotSicBatCur": 0.00009765475988388062,
"TotMccLodPwr": 0.00009765475988388062,
"TotPvPwrAt": 0,
"TotLodPwrAt": 0,
"SlfCsmpPwrAt": 0,
"SlfCsmpIncPwr": 0,
"BatCpyThrpCnt": 0,
"GdCsmpPwrAt": 0,
"GdFeedPwrAt": 0,
"PacPV": 0.00009765475988388062,
"PacFeed-In": 0.00009765475988388062,
"PacConsumption": 0.00009765475988388062,
"kWhPV": 0,
"FwVer": 7.304000346921384,
"OnTmh": 16333.100243382156,
"FwVer2": 7.3000003467313945,
"EgyCntIn": 2998.3000446781516,
"EgyCntOut": 1022.3000152334571,
"EgyCntTm": 8534.60012717545,
"GnEgyCnt": 119.50000178068876,
"GnEgyTm": 196.30000292509794,
"GnOpTmh": 199.50000297278166,
"GnStrCnt": 212,
"GdEgyCntIn": 1.4000000208616257,
"GdEgyCntOut": 1521.1000226661563,
"GdEgyTmh": 7017.800104573369,
"GdOpTmh": 12671.000188812613,
"GdCtcCnt": 0,
"TotTmh": 5.700000084936619,
"Sic1EgyCntIn": 0,
"Sic2EgyCntIn": 0,
"Sic3EgyCntIn": 0,
"Sic4EgyCntIn": 0,
"TotSicEgyCntIn": 0,
"Sic1TdyEgyCntIn": 0,
"Sic2TdyEgyCntIn": 0,
"Sic3TdyEgyCntIn": 0,
"Sic4TdyEgyCntIn": 0,
"TotSicDyEgyCntI": 0,
"Serial Number": 1260043278,
"E-Total-In": 2998.3000446781516,
"E-Total": 1022.3000152334571,
"h-On": 16333.100243382156,
"TotLodEgyCnt": 0,
"SlfCsmpIncEgy": 0,
"SlfCsmpEgy": 0,
"SlfCsmpIncTdy": 0,
"GdCsmpEgyTdy": 0,
"kWhFeed-In": 0,
"kWhConsumption": 0,
"GdFeedEgyTdy": 0,
"Adr": "Master",
"OpStt": "Operating",
"OpSttSlv1": "Operating",
"OpSttSlv2": "Operating",
"OpSttSlv3": "Operating",
"CardStt": 2,
"Prio": "Ina",
"BatChrgOp": 10,
"AptPhs": "---",
"GnDmdSrc": "None",
"GnStt": "Off",
"InvOpStt": "Run",
"InvOpSttSlv1": "Run",
"InvOpSttSlv2": "Run",
"InvOpSttSlv3": "Run",
"Rly1Stt": "Off",
"Rly2Stt": "Off",
"GnRnStt": "On",
"Mode": "Operation",
"Error": "-----",
"ChpStt": "Idle",
"PvGdConStt": "---",
"LodGdConStt": "---",
"BatMntStt": "Off"
}
}

Now you can use any application you want to read the values from the given MQTT topic.

I use this sensor config to import the values that i need into from the MQTT tpoic into Home Assisant

mqtt:
sensor:
- name: "si-mqtt-BatVtg"
unique_id: "si-mqtt-BatVtg-0001"
state_topic : "sunnyisland/<serialnumber>"
value_template: '{{ (value_json["values"].BatVtg | float) | round(2, default=0) | float }}'
unit_of_measurement: "V"
entity_category: "diagnostic"
state_class: "measurement"


Enjoy your timely archived SI data!

This helped me a lot to diagnose a SI to JK-BMS CAN communication Error, which im doing a write up about soon.


Thanks to Kommando for helping me out with this one!
 
On the baud rate, I use a variation of this setup and after a few weeks operation have dropped from 19200 to 9600. Every 4 or 5 days my SI RS485 froze so info flow stopped and was only recovered by turning off and on the master SI. Changing to 9600 fixed this issue. When my current slave was the master it had no issues at 19200 so it looks to be down to the SI internals, maybe a board revision as the slave is a year younger than the master.

So if you get data flow lockups at 19200 then drop to 9600.
 
I see that HA comes with or can install MQTT on the same device. Is a separate device for the MQTT desirable, required, or not necessary? And if either of the first two what should we run it on to reduce cost while maintaining integration.
 
I don't run HA but use node-red instead and Yasdi2mqtt, MQTT and node-red run concurrently on a Pi 4B with no issues.
 
Last edited:
Very cool. I run home assistant and using the SMA solar integration it sees all my PV inverters via Modbus. Wonder if you could use the RPi to read the rs485 data and put it on the net as just another modbus address that the HA SMA Solar integration would see?

I think if the Sunny Island showed up as a modbus device then my venus OS RPi might could see it as well? I'd like the Venus OS RPi to recognize the SI inverters... madsci1016 is the only person I've seen that got it working via the CAN bus..

My sunny island 485 is currently being used by a SMA DATA MANAGER M which I run to give my sunny islands a nice web interface. Would running both on the 485 would cause problems??
 
You need a webbox to get the SI to show as a modbus device and as that is RS485 TCP then it can handle multiple clients.

 
Don't have one, best if you query it's modbus for signs of the SI. The pdf you linked to is silent on smanet to modbus and only has ref to inverter modbus registers not SI registers which are different.
 

diy solar

diy solar
Back
Top