StephanJoubert / home_assistant_solarman

Home Assistant component for Solarman collectors used with a variety of inverters.
Apache License 2.0
540 stars 196 forks source link

Show total_production when inverter is offline #116

Open Geliras opened 1 year ago

Geliras commented 1 year ago

Is there a way for a sensor that will always show the total_production even if the inverter is offline?

honikos commented 1 year ago

Hi Geliras, do you mean if your inverter is off by night? Inverters without battery usually shut down when the panels don't produce electrical power (at night) therefore you won't retrieve data from your inverter because he is offline or the other way you can't check the inverter log, because the build in logger is offline. Ways to check your total_production even the inverter is offline:

  1. connect your inverter to an online monitoring platform (usually provided by your inverter supplier)
  2. receive data on a local monitoring platform in your local network (e.g. homeassistant, openhab and smaller solutions). You have to find out if the inverter supplier allows to receive inverter data on a local platform or if the community build a software to do this (decoded the data provided by an interface).
Geliras commented 1 year ago

Yes thats right, but i found a work-around with input_number

VaillantHassIo commented 1 year ago

@Geliras mind sharing with us?

distancerunner commented 1 year ago

I found a workaround. In my configuration.yaml I added a custom sensor template and I added this to the energy dashboard, and removed the solarman sensor. This will change your data and remove your solardata from dashboard: I think the value availability is the one, which is needed during night times.

template: 
    - sensor:
        - name: "Ertrag Pergola Total (kWh) custom"
          unique_id: solarman2mppt_total_production_custom
          unit_of_measurement: kWh
          icon: mdi:solar-power
          device_class: energy
          state_class: total_increasing
          state: "{{ states('sensor.solarman2mppt_total_production')|float(default=0) }}"
          availability: "{{ states('sensor.solarman2mppt_total_production')|is_number }}"
lenwar commented 1 year ago

@distancerunner 's workaround did not work for me. I'm not sure why not, but I got the following as a workaround. Effectively checking if the current value is greater than 0, if so, use that value, if not, keep the current value.

    - name: "Solarman Total Production 1-1"
      unique_id: solarman_total_production_1_1_custom
      unit_of_measurement: kWh
      icon: mdi:solar-power
      device_class: energy
      state_class: total_increasing
      state: >
        {% if states('sensor.solarman1_total_production_1') | int > 0 %}
        {{ states('sensor.solarman1_total_production_1')|float(default=0) }}
        {% else %}
        {{ states('sensor.solarman_total_production_1_1')|float(default=0) }}
        {% endif %}

Background: I use a Deye 2-port-microconverter with the deye_2mppt.yaml file. The combined total production doesn't reset, but the individual ones do. Hence I have the above workaround. I of course could also use the combined one, but I like to keep everything specific to each panel (because I can :) ) afbeelding