Support for more SMA Devices (e.g. Tripower X)

Unfortunately, it only works for consumers.
Producers cannot be integrated in this way.

Ah so my solution is not totally redundant. :grinning:
If you want me to do some testing on de Enneos Portal for this I am happy to help out. I just do not have a home manager so what I can do is limited.

I am wondering if changing the power limit of the inverter a lot (like every 20s) could cause unwanted side effects. Because I have read that you need to be careful with some modbus registers to not change them to much.

Legitimate point.

You should check the parameter before changing a value extremely often.
This is difficult for you, because SMA does not provide a modbus list for the SBSE-series.

For Tripower X you can check it as follows:

  • Download the Modbus overview from SMA for your(!) device. (Not just any one, but exactly the one for your product series)[*]
  • In the Modbus list, search for the parameter you want to change. (The names of the parameters in the modbus list correspond to the channel names on the web interface)
  • Critical Values are marked with a grafik
  • The Parameter.Inverter.WMax is not marked with the warning sign, so it should be safe to change it. (My opinion. I cannot guarantee this.)

[*]
https://www.sma.de/produkte/solar-wechselrichter/sunny-tripower-x
File:
Technical Information - Parameters and Measured Values STP 12-50 / STP 15-50 / STP 20-50 / STP 25-50 (Sunny Tripower X) with firmware package 03.02.07.R

Hi,
just tried to install this integration. It seems to work really well - thank you for that! One of the most promising ones I think :slight_smile:
However :slight_smile: I’m looking for one specific value for a long time already and I can’t figure out a way how to get it: the current power consumption of the house. I have a Tripower 8 and a Home Manager 2.0.
With this integration I connected the SHM 2.0 and the connection works well. But I can’t find any value for that. There are 3 “Power Draw” and “Power Feed” values, but they don’t sum up to the actual value that I see in the sunny portal or the app.
But it should be possible in my opinion - both the SHM and the Tripower show the value. Either in the app or on the web-interface (tripower).


At this point the app showed about 370 watts of consumption.

Any ideas?
Thanks!

I don’t quite understand what devices you have already set up.

If I have understood you correctly, you have added only the SHM.
Without the inverter, you won’t get all the necessary values.

You have to calculate the power consupmtion, as no device return it. You need the production of the inverter (sensor.sma_power in the example) and the feed-in or grid consumption from the SHM2 (pconsume and psupply).

I’m using a Template Sensor:

      - name: "power_total_usage"
        state: "{{ (states('sensor.sma_power')|int(0) +  states('sensor.pconsume')|int(0) - states('sensor.psupply')|int(0)) }}"
        unit_of_measurement: "W"
        state_class: measurement

Hi,
right, I think I got it. I thought because the value is visible on both the inverter and the shm, it should be there as a value already. Will try your template. Thanks!
I have integrated both the inverter and the shm.

Hi @swante ,
I tested it. It works during the day - thanks :slight_smile:

But when it’s dark and no power is produced by the solar panels, the calculation doesn’t work. It shows a very low number like 5 or even low minus values.

Any idea how I can calculate it during day and night?

Thanks,
Viktor

Can you post your template?

Sure thing.

{{ (states('sensor.sunny_tripower_80_pv_power')|int(0) +  states('sensor.sunny_home_manager_2_metering_power_absorbed')|int(0) - states('sensor.sunny_home_manager_2_metering_power_supplied')|int(0)) }}

The only thing I’m not sure about is the absorbed value. It seems to be the consume value but I’m not sure if it’s the same actually.

The sensor looks good.

I don’t understand how a power consumption of 0 can be achieved. You have devices that are running. And the inverter also needs power.

As I have already been asked by several people.

Has anyone found a way to change the battery charge and discharge rate for the SMA Sunny Boy Smart Energy devices? According to the users, there would be no setting for the battery charge and discharge rate available on the parameter list on the web ui. A list with the Modbus addresses has not yet been made public.

[Since I don’t have an SBSE device, I can’t say much about it and I’m just passing the question on]

1 Like

I am one of these people :slight_smile: So yes, any help is greatly appreciated, because I’m stuck searching for a way to control the battery charging of my SBSE4.0. I get no reaction to the typical Modbus commands 40149/40151 and can’t find a paramater in the webUi that would affect the battrry charging except for turning battery off completely. Thanks.

Hi Swante, and thank you for the awesome work!

I managed to setup my SHM2.0, but having trouble adding my inverter: Sunny Tripower 5.0 Smart Energy (hybrid inverter)

I tried all the interface options; others didn’t seem promising (not able to add device), but with the SpeedWire one I got it to recognize my inverter, and claim adding device is successful, but it shows up like this:

Diagnostic information is not available.

Normal logs: https://pastebin.com/TR6V1bmM

I see that a kind of similar device Tripower 10 Smart Energy was in the tested devices with Webconnect. This is baffling, as I was not able to add the device with webconnect regardless of SSL options or user/installer choices.

Any ideas what to try next?

The enneox-OS interface should worked.
Have to tried to just use the IP of the inverter?
have you verified that the username and password work directly on the inverter?

Speedwire has had some problems since version 0.3.5, which I have not yet been able to isolate as they do not occur in my case.

For host I have always used the direct ip address of the inverter.

The same IP in browser opens up the Inverter’s admin page, and I’m using the same “installer” / <pw> on my inverter successfully to open the admin page.

Some notes:

  • When opening up the Inverter using a browser; it opens with http (not secured).

I was looking at your source code; I wasn’t able to test it yet, but I’m wondering if line 84 in init.py should be removed await sma.new_session().

I think before 0.35.0, that line was only executed inside the try/except block. Now, with the getPysmaInstance() function it gets always executed?

The other function that calls getPysmaInstance() will later anyway call await sma.new_session() inside the try/except like before.

When trying with

SMA Devices with EnnexOS (e.g. Tripower X Serie)

I get error:
2024-08-31 21:06:09.351 ERROR (MainThread) [pysmaplus.device_ennexos] Request to https://192.168.88.71/api/v1/token did not return a valid json. Code 400

I’m a SMA noob, but I’m not sure if Tripower Smart Energy devices are ennexOS devices like the Tripower X series. The data sheet doesn’t mention anything about ennex?

Forked the repo, removed line 84 // new_session.

Now it failed with a new error:


Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/pysmaplus/config_flow.py", line 47, in validate_input
    device_list = await sma.device_list()
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pysmaplus/device_speedwire.py", line 440, in device_list
    await self._protocol.start_query(["TypeLabel", "Firmware"], fut, self._group)
          ^^^^^^^^^^^^^^
AttributeError: 'SMAspeedwireINV' object has no attribute '_protocol'

I haven’t yet understood what is the version link between the ha-pysmaplus and pysma repositories. Is there a corresponding version change on pysma repo side to 0.34 → 0.35?

I was able to run the discovery:

discovery:
  - addr: 192.168.88.72
    port: 9522
    identify:
      - access: speedwireem
        status: found
        tested_endpoints: 192.168.88.72:38153
        exception: None
        remark: ""
        device: Sunny Home Manager 2 (3014942681)
      - access: ennexos
        status: failed
        tested_endpoints: https://192.168.88.72/api/v1/system/info
        exception: >-
          Could not connect to SMA at https://192.168.88.72: Cannot connect to
          host 192.168.88.72:443 ssl:default [Connect call failed
          ('192.168.88.72', 443)]
        remark: https
        device: ""
      - access: ennexos
        status: failed
        tested_endpoints: http://192.168.88.72/api/v1/system/info
        exception: None
        remark: http
        device: ""
      - access: speedwireinv
        status: failed
        tested_endpoints: 192.168.88.72:9522
        exception: "No connection to device: 192.168.88.72:9522  (3/3)"
        remark: ""
        device: ""
      - access: webconnect
        status: failed
        tested_endpoints: https://192.168.88.72
        exception: >-
          Could not connect to SMA at https://192.168.88.72: Cannot connect to
          host 192.168.88.72:443 ssl:default [Connect call failed
          ('192.168.88.72', 443)]
        remark: https://192.168.88.72
        device: ""
      - access: webconnect
        status: failed
        tested_endpoints: http://192.168.88.72
        exception: Server at http://192.168.88.72 disconnected 3 times.
        remark: http://192.168.88.72
        device: ""
      - access: shm2
        status: failed
        tested_endpoints: 192.168.88.72
        exception: Could not connect to 192.168.88.72:502
        remark: needs Installer Grid Guard Code. Usage not recommended.
        device: ""
  - addr: 192.168.88.71
    port: 9522
    identify:
      - access: speedwireinv
        status: maybe
        tested_endpoints: 192.168.88.71:9522
        exception: Login failed! Credentials wrong (user/install or password)
        remark: only unencrypted Speedwire is supported
        device: ""
      - access: ennexos
        status: failed
        tested_endpoints: https://192.168.88.71/api/v1/system/info
        exception: None
        remark: https
        device: ""
      - access: ennexos
        status: failed
        tested_endpoints: http://192.168.88.71/api/v1/system/info
        exception: None
        remark: http
        device: ""
      - access: webconnect
        status: failed
        tested_endpoints: https://192.168.88.71
        exception: ""
        remark: https://192.168.88.71
        device: ""
      - access: webconnect
        status: failed
        tested_endpoints: http://192.168.88.71
        exception: ""
        remark: http://192.168.88.71
        device: ""
      - access: speedwireem
        status: failed
        tested_endpoints: 192.168.88.71
        exception: None
        remark: no multicast packet received.
        device: ""
      - access: shm2
        status: failed
        tested_endpoints: 192.168.88.71
        exception: Could not connect to 192.168.88.71:502
        remark: needs Installer Grid Guard Code. Usage not recommended.
        device: ""
status: {}

2024-08-31 21:40:17.740 ERROR (MainThread) [pysmaplus.device_speedwire] Login failed!
2024-08-31 21:40:19.751 WARNING (MainThread) [asyncio] socket.send() raised exception.
2024-08-31 21:40:20.252 WARNING (MainThread) [asyncio] socket.send() raised exception.
2024-08-31 21:40:20.956 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/pysmaplus/device_speedwire.py", line 106, in controller
await self._send_next_command()
File "/usr/local/lib/python3.12/site-packages/pysmaplus/device_speedwire.py", line 158, in _send_next_command
f.set_result(True)
asyncio.exceptions.InvalidStateError: invalid state

please ignore my enneox comment. I made a mistake with the device type.

According to the discovery-action, speedwire should work:

     - access: speedwireinv
        status: maybe
        tested_endpoints: 192.168.88.71:9522
        exception: Login failed! Credentials wrong (user/install or password)
        remark: only unencrypted Speedwire is supported
        device: ""

Unfortunately, as already mentioned, speedwire is currently problematic.
You could try installing HACS 0.3.4 and test whether Speedwire works with this version.

The differences between the two versions of the integration should be the following:

And for the used library:

1 Like

@Choppahh

Can you please test the latest version (0.4.2) from today.
I changed the logic for new_session. Not sure if this helps with the speedwire problem.