Hello,
some time ago the Energy Management in Home Assistant (Energy Management in Home Assistant - Home Assistant) was introduced. So far, it does not seem to have access to SMA devices that I use. Are there any plans or ways to do this?
Frank
It depends on your sma device
Either this:
or this:
Hello,
i have a set of SMA Storage Boy, SMA Energy Meter and SMA Home Manager 2.0. My Inverter is to old to have internet access. Bluetooth only. The first two are integrated via the Home Assistant SMA Integration
Frank
Hello Frank,
I have an STP 5000TL-20 474 Inverter which is from 2013. I upgraded it to latest FW and now it works fine via the modbus integration.
I use the this in my config:
# Modbus
modbus:
- type: tcp
host: 192.168.xx.xx # SMA TriPower
port: 502
name: "sma"
close_comm_on_error: true
delay: 5
timeout: 5
sensors:
- name: PV_Gesamtertrag
unit_of_measurement: kWh
slave: 3
address: 30531
input_type: input
count: 2
device_class: energy
state_class: total_increasing
- name: PV_Leistung
unit_of_measurement: W
slave: 3
address: 30775
input_type: input
count: 2
device_class: power
state_class: measurement
- name: PV_Tagesertrag
unit_of_measurement: Wh
slave: 3
address: 30517
count: 4
data_type: int
device_class: energy
state_class: total_increasing
I adapted it from this link:
Hello,
probably my inverter too old. It can only do Bluetooth and RS485.
Frank
I use sbfspot for my SMA Bluetooth inverter. It’s not an official addon though.
(You will also need SMA explorer to get some inverter details)
So depends how you have homeassistant installed.
I am using a docker install, so I can run sbfspot there. Or you can use Windows desktop.
It sends the inverter info out via Mqtt or PVoutput.
The energy dashboard will read either. Although MQTT needs to be correctly formatted with device_class and state_class.
https://github.com/SBFspot/SBFspot
https://github.com/SBFspot/sbfspot-config
- platform: mqtt
name: "SMA Daily Energy"
state_topic: "homeassistant/sbfspot_SMA5000/sbfspot_231serial"
value_template: '{{ value_json.EToday }}'
unit_of_measurement: "kWh"
icon: "mdi:solar-power"
device_class: energy
state_class: total_increasing
sensor:
- platform: pvoutput
system_id: your SystemID from PVoutput (the same as needed for SBFSPOT
api_key: yourAPIkey from PVoutput
- platform: template
sensors:
power_consumption:
value_template: "{% if is_state_attr('sensor.pvoutput', 'power_consumption', 'NaN') %}0{% else %}{{ state_attr('sensor.pvoutput', 'power_consumption') }}{% endif %}"
friendly_name: "Using"
unit_of_measurement: "Watt"
energy_consumption:
value_template: '{{ "%0.1f"|format(state_attr("sensor.pvoutput", "energy_consumption")|float/1000) }}'
friendly_name: "Used"
unit_of_measurement: "kWh"
power_generation:
value_template: '{% if is_state_attr("sensor.pvoutput", "power_generation", "NaN") %}0{% else %}{{ state_attr("sensor.pvoutput", "power_generation") }}{% endif %}'
friendly_name: "Generating"
unit_of_measurement: "Watt"
energy_generation:
value_template: '{% if is_state_attr("sensor.pvoutput", "energy_generation", "NaN") %}0{% else %}{{ "%0.2f"|format(state_attr("sensor.pvoutput", "energy_generation")|float/1000) }}{% endif %}'
friendly_name: "Generated"
unit_of_measurement: "kWh"
Hello Nic,
i will try to get it work on my raspi 4.
Frank
If it’s pi4 with raspbian use the sbfspot-config. It should be fairly straightforward to install.
it is a installation with the Home Assistant Operating System. No docker, container …
Ahh yeah the HAOS version is limited here. It’s actually why I ended up on the raspbian/docker build.
If you have an alternative device such as winpc that can run sbfspot that works. It doesn’t need to be installed on the same device for MQTT or PVoutput to work. It’s very lightweight. I used to have it in my desktop. I only just recently moved it to my rpi. Which is mostly documented in that other thread you found.
I sort of started looking at making a docker addon that will work with HAOS. It’s abit beyond me at the moment though.
Hello,
have read out via scrape (Scrape - Home Assistant) some values of my solar production from the SMA Sunnyportal. However, I cannot find these sensor values in the energy report from the HA.
Do I have to define the name, unit, etc. of the entity specifically for this?
device_class: energy
state_class: total_increasing
are both not possible in scrape
Frank
Yeah you have to define those. They don’t exist in the inverter. The state_class may need to use a customisation. The device_class can be added to your device(homeassistant config) directly usually.
but how and where to add? If i define both in configuration.yaml
- platform: scrape
resource: "https://www.sunnyportal.com/Templates/PublicPage.aspx?page=a2f24cdd-7e9c..." #"https://www.sunnyportal.com/FixedPages/Dashboard.aspx"
username: !secret SMA_username
password: !secret SMA_passwort
name: SMA_Tagesertrag_energy_total
select: "#ctl00_ContentPlaceHolder1_PublicPagePlaceholder1_PageUserControl_ctl00_PublicPageLoadFixPage_energyYieldWidget_energyYieldValue"
unit_of_measurement: Wh
device_class: energy
state_class: total_increasing
i get those errors:
Invalid config for [sensor.scrape]: [device_class] is an invalid option for [sensor.scrape]. Check: sensor.scrape->device_class. (See ?, line ?).
Invalid config for [sensor.scrape]: [state_class] is an invalid option for [sensor.scrape]. Check: sensor.scrape->state_class. (See ?, line ?).
Thanks in advance
Frank
what i have now found is, that i can change a few attributes for the entities in the entity section.
For device_class the entry energy is possible.
For state_class only measurement is possible. Not total_increasing
Then i get the error [translation from the german error message]:
It seems that your configuration.yaml is not correct. include customize.yaml.
The changes made here will be entered, but will not be applied until the configuration is reloaded if the include is present.
A restart has not changed this error.
Frank
Now I have also solved the “classic” of the inclusion of
homeassistant:
customize: !include customize.yaml
and there I could also change the state_class:. Now it works.
Frank
Customize is also available right down the bottom of the configuration tab in Web view.
Hi & a wonderful happy New Year!
I’m new to HA and I have been running my IDM heatpump in PV mode with a workaround via OpenWB. As I don’t have coding capabilities at all, some guys on Photovoltaikforum helped me to get my SMA PV talking to the IDM heatpump.
Since I have now started with HA I was happy to see theses activities here and your post about the inverter connected to HA.
I have a Tripower 25000TL from 2020 and I just tried to add your code to my config, but so far I haven’t found any sensors on HA…
Just to get it right: you only added the lines to the config and got the sensors defined right away?
As I mentioned I’m new to HA and I’m still a bit helpless how to find out why I can’t see them…
Could you please give me some hints?
Thanks
Michael
This is working perfectly!
Except for the unit of measurement. As you can see on my PublicPage:
https://www.sunnyportal.com/Templates/PublicPage.aspx?page=5b628919-c02f-4956-a734-c4976f31e917
Sometimes Wh / sometimes kWh.
Any help is welcome
Hello, how do I set it up to see the same thing you see? I only have system information there, but no graphs or blocks with current daily production.
I am an administrator of several systems and I would like to collect data from all PV systems. Can someone help me?
Hello jmachi88,
Do you have a web page?
Could you send an example?