Hi, can you please share your configuration.yaml ?
Hi Frank, can you please share the configuration.yaml for this ? TIA
OK, i tried a lot. So far i have the part which answers the production for a day.
I really would like to see the actual consumption.
Anyhow, i am struggling to create this template Sensors:
‘’’
- platform: template
sensors:
pv_energie:
value_template: ‘{%- if is_state(“sensor.pv_periode”, “Today”) and (states.sensor.pv_wert.state | float) < 150 -%}{{ states.sensor.pv_wert.state | round(1) }}{% else %}0{% endif %}’
friendly_name: ‘SMA’
unit_of_measurement: ‘kW/h’
‘’’
Hello Carsten,
yes i can.
Several aspects are important for a successful readout. First, the sharing must be activated on the sunnyportal page. To do this, activate inside the ‘Anlagenübersicht’ in the share. The link that appears there is required.
you need this link in your configuration.yaml
sensor:
- platform: scrape
resource: "https://www.sunnyportal.com/Templates/PublicPage.aspx?page=a2f24cdd-7e9c......"
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
If you want to use the readout in the Energy section you need to set the following properties for the entity:
device_class: energy
state_class: total_increasing
To have this the following must be entered at the beginning of configuration.yaml.
homeassistant:
customize: !include customize.yaml
Then a file with the name customize.yaml must be created. The following must be entered there:
sensor.sma_tagesertrag_energy_total:
device_class: energy
state_class: total_increasing
Now it should work.
Frank
Hi Frank,
thanks a lot.
Any idea how to read the consumption from the Sunny Portal ?
I can see it in the sunny portal, but no luck to read it for HA.
Regards
Carsten
Hello Carsten,
all i can get is the daily and total production. Unfortunately SMA is not giving more via this special webpage. Yes a also have more inside the sunnyportal …
Frank
Similar question to others here…is there a way to get the “current production” number? Rather than just the daily total?
Tried to read into the scraping tools, but I’m too new at this to make any progress.
You may try to find proper CSS select here.
I have no luck to get CSS selector for “Current PV Power”.
Hello, i need to get data from SMA Sunny portal to HA DB and grafana. Can you share how?? i am beginner in HA Thank you so much
A solution for reading out the “Current PV Power” from sunny portal is available here:
Hi Frank, can you help me out please?
I opened up the public link in Sunnyportal
I added the text to the configuration.yaml file (and replaced your link with mine)
I guess i dont need to replace the SMA_username and SMA_password cause its a public link?
But the step after that you lost me
Where do I have to add this code →
device_class: energy
state_class: total_increasing
Thanks!
Hello mvanimpe,
if you go back to my post #23 you will find the file …
o have this the following must be entered at the beginning of configuration.yaml.
homeassistant:
customize: !include customize.yaml
Then a file with the name customize.yaml must be created. The following must be entered there:
sensor.sma_tagesertrag_energy_total:
device_class: energy
state_class: total_increasing
But this was not working for me anymore. You have to move on to the scrape integration:
see also:
Frank
Thank you Frank!
I’ll look into that!
Hello,
i am installer and need monitoring all systems. can you help me with text to yaml?
For reference, here is my scrape for the SMA Sunnyportal, using the new way to scrape:
scrape:
- resource: https://www.sunnyportal.com/Templates/PublicPage.aspx?page=fb.... #change to yours
sensor:
- name: SMA_pv_unit
select: "#ctl00_ContentPlaceHolder1_PublicPagePlaceholder1_PageUserControl_ctl00_PublicPageLoadFixPage_energyYieldWidget_energyYieldUnit"
- name: SMA_pv_period
select: "#ctl00_ContentPlaceHolder1_PublicPagePlaceholder1_PageUserControl_ctl00_PublicPageLoadFixPage_energyYieldWidget_energyYieldPeriodTitle"
- name: SMA_pv_wh
select: "#ctl00_ContentPlaceHolder1_PublicPagePlaceholder1_PageUserControl_ctl00_PublicPageLoadFixPage_energyYieldWidget_energyYieldValue"
value_template: '{{ value | replace (",", ".") | float }}'
template:
- sensor:
- name: SMA_energy
unique_id: id_SMA_energy
unit_of_measurement: "Wh"
state_class: "total_increasing"
device_class: "energy"
state: >
{% if is_state('sensor.SMA_pv_period', 'Today') %}
{% if is_state('sensor.SMA_pv_unit', 'kWh') %}
{{ states('sensor.SMA_pv_wh') | round(1) *1000 }}
{% else %}
{{ states('sensor.SMA_pv_wh') | round(1) }}
{% endif %}
{% else %}
0
{% endif %}
Stefan