SMA Energy Meter in Home Assistant

Much better, I wish I could pull the temperature from my Sunny Boys using WebConnect but I don’t see where they read and display the inverter temperaturer.

Not sure how to approach it but you know how to read the value, you just need to subtract a reading from after midnight from the current reading. Seems like some sort of automation is in order.

i went back and looked and i dont see the temps. i swore they were in the instant values tab. the only value i could ever extract from the webconnect sma platform was the L1 voltage and L2 voltage. It was pretty useless for me.

My next task is to make a sensor that subtracts my solar wattage from my shop wattage. I have clamps on my wires feeding my shop sub panel which has the solar backfed into. so its combining the watts

I went and tried every SMA key that had a unit of ºC, ºF, or just ‘º’ and none of them returned a value. If they have a temperature value in the inverter I don’t know how to access it.

There is lots of data accessible using WebConnect, AC side power/voltage/current, DC side power/voltage/current and individual string power values. Divide the AC power by the DC power and you have the inverter efficiency. I sample the Instantaneous tab every 5 seconds and and pick the data I want out of there.

Plus you can access the daily and monthly past production, here is an InfluxDB dashboard of my system with some of the information:

Here are some views from my Home Assistant Production dashboard, all the data but none of the graphics. The status is the codes used by the inverters, for now the icons change to something intuitive.

I see the same error coming up. I have two strings (for east faced and west faced panels):

  custom:
    pv_power_a:
      key: '6380_40251E00_0'
      unit: W
      factor: 1
    pv_power_b:
      key: '6380_40251E00_1'
      unit: W
      factor: 1

This results in the following error:

Logger: pysma
Source: /usr/local/lib/python3.8/site-packages/pysma/__init__.py:177

Duplicate SMA sensor key 6380_40251E00

However, both sensors run just fine. I guess I can safely ignore this error.

Hi folks, if you are using Home Assistant OS, you could try to add the following add-on to read the SMA energy meter values & publish them through MQTT. It includes auto-discovery for the sensors.

Quickly add the repo: Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.

Enjoy!

Hello KellerZa,

i am using a Raspi Installation of Home Assistant. Is there a way to add the AddOn directly out of the Home Assistant UI?

Frank

I think that error is because those the two values (pv_power) are already setup in the library
You don’t need to customise those ones

Hi Mate
Tried to install but received this error

Failed to install add-on

The command ‘/bin/ash -o pipefail -c apk add --no-cache git’ returned a non-zero code: 1

Hi @Nicko1, that seems fairly fundamental, what arch are you using? You can see that from info/the supervisor logs

I’ve got armv7l (32-bit R-Pi4), but these all use the same docker base image.

Do you see anything more in the supervisor logs?

Open your Home Assistant instance and show your Supervisor system logs.

A successful build should look like this:

21-03-10 03:18:15 INFO (SyncWorker_0) [supervisor.docker.addon] Starting build for 6a2c1c7a/armv7-addon-sma-em:0.5
21-03-10 03:19:04 INFO (SyncWorker_0) [supervisor.docker.addon] Build 6a2c1c7a/armv7-addon-sma-em:0.5 done
21-03-10 03:19:04 INFO (MainThread) [supervisor.addons] Add-on '6a2c1c7a_sma-em' successfully rebuilt
21-03-10 03:19:05 INFO (SyncWorker_1) [supervisor.docker.addon] Starting Docker add-on 6a2c1c7a/armv7-addon-sma-em with version 0.5

Yes @tropfen, if you have the latest Home Assistant & the my Home Assistant integration you can click this button to open the Supervisor add-on repository config, then just add the URL

Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.

1 Like

Hi @kellerza
Thanks for helping with this
Im probably doing thing wrong here

—> 1c9cf6b54197
Step 3/15 : RUN apk add --no-cache git
—> Running in ff1ba8aae4ab
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/armv7/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/armv7/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/main: temporary error (try again later)

WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/community: temporary error (try again later)

ERROR: unable to select packages:

git (no such package):
required by: world[git]
Removing intermediate container ff1ba8aae4ab

21-03-10 01:54:36 INFO (SyncWorker_5) [supervisor.docker.addon] Starting build for 6a2c1c7a/armv7-addon-sma-em:0.5
21-03-10 01:54:51 ERROR (SyncWorker_5) [supervisor.docker.addon] Can’t build 6a2c1c7a/armv7-addon-sma-em:0.5: The command ‘/bin/ash -o pipefail -c apk add --no-cache git’ returned a non-zero code: 1
21-03-10 01:54:51 ERROR (SyncWorker_5) [supervisor.docker.addon] Build log:
Step 1/15 : ARG BUILD_FROM
Step 2/15 : FROM ${BUILD_FROM}
—> 1c9cf6b54197
Step 3/15 : RUN apk add --no-cache git
—> Running in 916d2765fa73
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/armv7/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/main: temporary error (try again later)

fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/armv7/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/community: temporary error (try again later)

ERROR: unable to select packages:

git (no such package):
required by: world[git]
Removing intermediate container 916d2765fa73

Hi @Nicko1 I seem it says “temporary error”, there seems to be DNS issues for some 3.13 alpine linux users

I’ve added a ping to the Dockerfile build process to see if you can reach the repo

“Reload” your add-on repos (under the three dots in the Add-On Store window). The upgrade the add-on to 0.5.3). See if you can successfully ping the alpine linux repo in those logs

1 Like

Hello kellerza,

i have installed the AddOn. The protokoll - tab shows the following lines

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
ic| 'No SMA_SERIALS configured, capturing a SINGLE debug packet'
serial: value:3007889749

The configuration is pre filled.

What are the next steps to configure and get the SMA EM values?

Thanks in advance
Frank

That 300xxx value you see there is your serial number. Fill it into SMA_SERIALS in the config & start the addon again

Hello Kellerza,

Thanks, added the number.

Sorry for asking again and again. Is there a read.me saying what to do to get the AddOn working?
If have added to following lines to configuration.yaml

  - platform: filter
    name: grid power 1min
    entity_id: sensor.grid_power
    filters:
      - filter: time_simple_moving_average
        window_size: 00:01

  - platform: filter
    name: total yield 5min
    entity_id: sensor.total_yield
    filters:
      - filter: time_throttle
        window_size: 00:05

utility_meter:
  daily_yield:
    source: sensor.total_yield
    cycle: daily
  monthly_yield:
    source: sensor.total_yield
    cycle: monthly

After a restart i get 4 new sensor entries.

For two entries (daily_yield, monthly_yield) i get the value 0, for grid power 1min i get an unknown and total yield 5min i get nothing. Ok its dark outside.

But selecting each entry, i get the information that the entity has no unique ID.

Frank

Hi @kellerza
Looks like i have some thing different now
and how do i load 0.5.3

21-03-11 04:54:35 ERROR (SyncWorker_4) [supervisor.docker.addon] Can’t build 6a2c1c7a/armv7-addon-sma-em:0.5.4: The command ‘/bin/ash -o pipefail -c pip3 install --no-cache-dir paho-mqtt~=1.5.0 requests~=2.24.0 icecream’ returned a non-zero code: 1
21-03-11 04:54:35 ERROR (SyncWorker_4) [supervisor.docker.addon] Build log:
Step 1/15 : ARG BUILD_FROM
Step 2/15 : FROM ${BUILD_FROM}
—> 1c9cf6b54197
Step 3/15 : RUN pip3 install --no-cache-dir paho-mqtt~=1.5.0 requests~=2.24.0 icecream
—> Running in c32b3969b533
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.HTTPSConnection object at 0xb56d9808>: Failed to establish a new connection: [Errno -3] Try again’)’: /simple/paho-mqtt/

WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.HTTPSConnection object at 0xb56d9868>: Failed to establish a new connection: [Errno -3] Try again’)’: /simple/paho-mqtt/

WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.HTTPSConnection object at 0xb5674868>: Failed to establish a new connection: [Errno -3] Try again’)’: /simple/paho-mqtt/

WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.HTTPSConnection object at 0xb5674af0>: Failed to establish a new connection: [Errno -3] Try again’)’: /simple/paho-mqtt/

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.HTTPSConnection object at 0xb56749e8>: Failed to establish a new connection: [Errno -3] Try again’)’: /simple/paho-mqtt/

ERROR: Could not find a version that satisfies the requirement paho-mqtt~=1.5.0 (from versions: none)

ERROR: No matching distribution found for paho-mqtt~=1.5.0

Removing intermediate container c32b3969b533

@tropfen that config you added is only examples of filters, updated the add-on docs to make this more clear and explain exactly what they do.

To update the add-on and get the new docs see here

@Nicko1 You still seem to have connectivity issues, in the latest version I swapped pip & apk install see here. This is really fundamental networking stuff and I would check: Internet connection & DNS. Are you behind some proxy? Do you use some DNS addon like pi-hole/adguard - in which case you need static config for your IP&DNS on your Pi.

@kellerza yes thats correct I use Dnsmasq
My pi has a Static ip and the DNS server address in the Dnsmasq config
Ive had this problem for a long time Its like the programs within the Pi are not able to access the DNS server.
i might have to start a new thread and see if i can get to the bottom of this
Thanks for your help Mate really appreciate the help :grinning:

:+1: good luck! Important to get this right…

In Home Assistant OS you can even set static IPs/DNS through the UI these days:

Supervisor -> System tab --> Host