home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.48k stars 30.69k forks source link

SMA plugin (emeter) unable to use as Grid consumption/Return to grid source #87720

Closed zyx360 closed 1 year ago

zyx360 commented 1 year ago

The problem

Hi,

I have used the SMA integration to add my SMA emeter to homeassistant. The emeter seems to be added fine and i can see sensor values being populated in homeassistant. However I am unable to use any of the emeter sensors as a Grid consumption/Return to grid source in the new energy dashboard, i assume because they report in W and not in kWh etc.

As the SMA emeter is precisely fulfilling the function of a grid consumption/return meter i am not sure if this is bug or expected behavior. I think most users use a P1 meter so the SMA emeter integration function might not have a lot of users testing it.

I run homeassistant Home Assistant 2023.2.2 with the latest SMA integration.

If you need additional information let me know.

Kind regards, Z

What version of Home Assistant Core has the issue?

Home Assistant 2023.2.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

SMA

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sma

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @kellerza, @rklomp, mind taking a look at this issue as it has been labeled with an integration (sma) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `sma` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign sma` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


sma documentation sma source (message by IssueLinks)

rklomp commented 1 year ago

What are the entity names you try to use?

pako10000 commented 1 year ago

Hi have the same issue. The Return to grid source shall be metering_power_supplied but thats not available. And for the other direction probably metering_power_consumed would be the right one. What is a P1 meter by the way?

Xeovar commented 1 year ago

I have the same problem since the energy dashboard went live. None of the SMA data are usable as information for energy dashboard. My SMA installation exposes these sensors: image but in energy dashboard config nothing is useable: image

jk-andersen commented 1 year ago

My workaround is to connect via modbus. this is my code in configuration.yaml:

Sensor-Sektion:

sensor:
# SMA Für das Energy Dashboard
  - platform: integration
    source: sensor.netzverbrauch
    name: energy_spent
    unit_prefix: k
    round: 2

Modbus:

#SMA
modbus:
  - type: tcp
    host: IP_ADRESS_STP
    port: 502
    name: "SMA-Tripower"
    close_comm_on_error: true
    delay: 5
    timeout: 5
    sensors:
      - name: PV_Status
        data_type: uint32
        unit_of_measurement: "status"
        slave: 3
        address: 30201
        count: 2
      - name: PV_Gesamtertrag
        unit_of_measurement: "kWh"
        slave: 3
        address: 30531
        input_type: input
        count: 2
      - name: PV_Leistung
        unit_of_measurement: "W"
        slave: 3
        address: 30775
        input_type: input
        count: 2
        data_type: int32
      - name: PV_Tagesertrag
        unit_of_measurement: "Wh"
        slave: 3
        address: 30517
        count: 4
        data_type: uint32
      - name: Netzverbrauch
        slave: 3
        address: 30865
        unit_of_measurement: "W"
        count: 2
        data_type: uint32
      - name: PV_Temperatur
        data_type: uint32
        device_class: "temperature"
        unit_of_measurement: "°C"
        slave: 3
        address: 30953
        count: 2
        scale: 0.1
      - name: PV_Spannung
        data_type: uint32
        device_class: "voltage"
        unit_of_measurement: "V"
        slave: 3
        address: 30783
        count: 2
        scale: 0.01
        precision: 2
      - name: PV_Frequenz
        data_type: uint32
        unit_of_measurement: "Hz"
        slave: 3
        address: 30803
        count: 2
        scale: 0.01
        precision: 2
  - type: tcp
    host: IP_ADRESS_BATTERY_INVERTER
    port: 502
    name: "SMA SBS"
    close_comm_on_error: true
    delay: 5
    timeout: 5
    sensors:
      - name: Batterie-SoC
        data_type: uint32
        unit_of_measurement: "%"
        slave: 3
        address: 30845
        count: 2

Some nice templates as well:


template:
# SMA Templates für die bessere Darstellung
  - sensor:
      - name: "pv_status_template"
        state: "{% if is_state('sensor.PV_Status', '35') %} Fault
          {% elif is_state('sensor.PV_Status', '303') %} Off
          {% elif is_state('sensor.PV_Status', '455') %} Warning
          {% elif is_state('sensor.PV_Status', '307') %} OK
          {% else %} Unknown Code
          {% endif %}"
      - name: "pv_leistung_template"
        unit_of_measurement: "W"
        state: "{% if states('sensor.PV_Leistung') is not none %}
          {% if states('sensor.PV_Leistung') | int < 0 %}
          {{ 0 }}
          {% else %}
          {{ states('sensor.PV_Leistung') | int }}
          {% endif %}
          {% else %}
          {{ 'error' }}
          {% endif %}"
      - name: "pv_temperatur_template"
        unit_of_measurement: "°C"
        state: "{% if states('sensor.pv_temperatur') is not none %}
          {% if states('sensor.pv_temperatur') | int < 0 %}
          {{ 0 }}
          {% else %}
          {{ states('sensor.pv_temperatur') | int }}
          {% endif %}
          {% endif %}"
      - name: "pv_spannung_template"
        unit_of_measurement: "V"
        state: "{% if states('sensor.pv_spannung') is not none %}
          {% if states('sensor.pv_spannung') | float(default=0) < 0 %}
          {{ 0 }}
          {% else %}
          {{ states('sensor.pv_spannung') | float(default=0) }}
          {% endif %}
          {% endif %}"
      - name: "pv_frequenz_template"
        unit_of_measurement: "Hz"
        state: "{% if states('sensor.pv_frequenz') is not none %}
          {% if states('sensor.pv_frequenz') | float(default=0) < 0 %}
          {{ 0 }}
          {% else %}
          {{ states('sensor.pv_frequenz') | float(default=0) }}
          {% endif %}
          {% endif %}"
JeroenAesseloos commented 1 year ago

I too am having problems with this.

I can only choose from 2 entities but neither is the right one to see the yield at that moment.

image

I can choose from the following 2 entities:

image

To be able to see how much energy is being delivered through the solar panels at that moment I think I should be able to select the entity "Grid_Power"?

image

Now I have chosen the entity PV_gen_meter, in the energy dashboard it shows that energy is supplied to the house. It is currently night and so it is not possible for energy to be supplied to the house. The value he shows is the total value of the proceeds of this month of March. (From the 1st of March to the 13th of March)

image

image

Any idea what a possible solution could be? Thank you in advance for your time and effort.

degroot79 commented 1 year ago

I have the same problem. I tried to changing the sensors from the SMA, because when you add the sensor it say's: "Pick a sensor which measures solar energy production in either of GJ, kWh, MJ, MWh, Wh." Standard unit is W..... So i change that to kWh, but it still won't work unfortunately :-( after that i also change the device_class from power to energie Still no luck.

dc911x commented 1 year ago

Hi

My set-up atm is also SMA Sunny Boy 3.6 + emeter. I don't have any troubles but maybe this helps for configuring your Energy Dashboard

afbeelding

The result is this

afbeelding

Also I said "atm" because I should be switching to a Home Manager 2.0 (not because I want to but because they force you if you have an SMA Charger). Atm I can only manually charge and can't integrate the charging point... But thats not in the scope of this thread.

zyx360 commented 1 year ago

stale