Best way to connect SMA SB 4000TL-20 to HA

Hello everyone,
I just moved from OpenHAB to HA on a Raspberry Pi, integrated a small Z-wave network with thermostats and plugs together with mobile access and I am quite pleased about convenience of progress.
Next step is to connect at least one of my inverters (SMA SB 3800 & SB 4000TL-20) to HA.
The latter one offers bluetooth interface and the possibility to add a RS485 data module.
Attaching of SWDM-10 to get a speedwire connection supposed to be not compatible!?!
After having read many posts, I see the following options:

  1. connect it via Bluetooth e.g. using SBFspot (is there no direct integration of bluetooth in HA possible?)
  2. buying the RS485 data module and attach it via a two wire cable to a RS485ToUSB-converter plugged in the Raspberry Pi. Still there supposed to be two options for configuration:
    2a) Modbus integration
    2b) SMA Solar integration, or does it work just with US inverters?
  3. Measuring AC currents with an Energy Meter of both inverters in the fuse box

Currently I tend towards option 2 since wiring to my Raspberry Pi is not a big deal.
Any recommendations, hints or other possibilities are welcome!
Eberhard

For those who might seek for a similar solution: I found the solution yasdi2mqtt (https://github.com/pkwagner/yasdi2mqtt), which provides a pretty good interface between the Software YASDI (Yasdi | SMA Solar) from SMA and MQTT. YASDI is an implementation of the old SMA Data Protocol before SMA switched over to Modbus protocol.
yasdi2mqtt runs currently on a docker container on a second Raspberry Pi, since I read, there are limitations of HA, if you use a docker installation of HA.
This second Raspberry Pi uses a cheap RS485 to USB converter with a ch341 chip, reads out the SMA inverter every 10s and sends the data to the Mosquitto MQTT broker integrated in HA.
You can find my steps to a working solution in this chat: https://github.com/pkwagner/yasdi2mqtt/discussions/18.

Before I started the approach, I tested the YASDI software standalone on the Raspberry Pi, to see, if the communication to the inverter will be popssible.

One more hint regarding parsing the data in JSON format in order to create the sensors.

{
    "sn": 2100521179,
    "time": 1644912539,
    "values": {
        "A.Ms.Amp": 0.4930000234162435,
        ....

The simple approach value_template: “{{ value_json.values.A.Ms.Amp }}” will not work since “values” is seen as a Python command and the points in “A.Ms.Amp” will lead to failure as well. Use value_template: “{{ value_json[‘values’][‘A.Ms.Amp’] }}” instead.

3 Likes

Thanks for all the good references, I was looking for exactly this! :ok_hand:

Hi @Eberhard ,

I have used Iobroker wth yasdi2Mqtt from Paul and now i switch to Home Assistant.

Could you please explain me or show me you YAML file how you extract the Values from the JSON Format?

1 Like

Hi.

After finding this I also bought and set-up a RS-485 piggy back for my SB 3000-TL20.
Got it attached to a Raspberry Pi 4 with an FTDI USB-RS485-WE cable and yasdi2mqtt running successfully.

Now comes the task of integrating this into HA and I was hoping you made progress on that you can share.

Here is my config:

mqtt:
  sensor:
  - name: "Solar generated total"
    unique_id: "solar_generated_total"
    device_class: "energy"
    state_class: "total"
    unit_of_measurement: "kWh"
    state_topic: "/solar/inverter/2100361840"
    value_template: "{{ value_json['values']['E-Total'] }}"
  - name: "Solar power"
    unique_id: "solar_power"
    device_class: "power"
    state_class: "measurement"
    unit_of_measurement: "W"
    state_topic: "/solar/inverter/2100361840"
    value_template: "{{ value_json['values']['Pac'] }}"

I tried this config as well, but didn’t work as is but if leading slash from state_topic is removed, than it works. Of sn was corrected as well.

Btw: I connected SB5000 TL20 via Yasdi2mqtt on rpi2b with the rs485 piggypack from Joy-IT.