patience4711 / read-APSystems-YC600-QS1-DS3

Software for an esp8266 nodemcu to read data from APS inverters.
130 stars 24 forks source link

Home Assistant data and reboots #92

Closed ErikKok closed 1 year ago

ErikKok commented 1 year ago

Hi,

I am using Home Assistant to track energy generation.

But for some unknow reason, could be a reboot, bad signal, or just clouds which block solar production altogether, i get these 'gaps' in the data:

zRMKj2dM9ww6gvrqdSRilN6O

I am using this as a sensor (as found in some other topic here): ` - name: "APS West1 Energy Total"

  unique_id: "APS West1 Energy Total"
  device_class: energy
  state_topic: "APS/in/1"
  value_template: '{{ ((value_json["energy"] | float(0)) / 1000) | round(3) }}'
  unit_of_measurement: "kWh"
  state_class: "total"`

Which results in jumps in the corresponding utility meter: Untitled

I tried different cycles, total_increasing, delta's etc., but i don't seem to get rid of this.

I have seen the promising development on v9.7 which should be more stable, but I seem to get this problem on cloudy days as well, so I guess i have to find some solution to fix it in HA.

Does anyone know the cause of this, or, how to correct this problem?

Thanks.

swbouman commented 1 year ago

@Aikonnnn , this is the sensor code I use in Home Assistant:

` sensor:

This results in a perfect history chart:

62EE7596-51CE-4F3E-876D-F8B6D1B5C3BB

I had much trouble with reboots of the esp ecu. But these graphs never resets, a part from the noon reset.

ErikKok commented 1 year ago

Dankjewel @swbouman ,

I have a sensor with total_increasing as well, and it's the same result: Untitled2

patience4711 commented 1 year ago

@Aikonnnn For some background info on the reported values please read here. In theory, there is only such low value reported when both the ESP and the inverter have rebooted. Must be a coincident.

frtz13 commented 1 year ago

@patience4711 ... but how do you explain the rise from 0.15kWh to 0.8kWh at about 16:00h?

swbouman commented 1 year ago

What mqtt do you use? It looks like you take the current energy production as a total. That would explain the wrong output.

I use mqtt 4 and as you can see I take the energy value at the totals section.

patience4711 commented 1 year ago

@frtz13 I can't explain that. I can only explain what data is "mosquittoed" and what can go wrong with that. I have no knowledge of HA or how users process the data.

ErikKok commented 1 year ago

I use format 2, with this automation and the above mqtt sensor:

service: mqtt.publish data: topic: APS/in/2 payload: "{{ trigger.payload }}" qos: "0" retain: false

I'd like to see the current wattage as well, what automation do you use?

frtz13 commented 1 year ago

I use format 3. Note that with the most recent versions of the ESP_ECU, automations to publish data from different inverters to different MQTT topics are no longer needed. with format 3 you get power and energy data for each panel separately. maybe the strange behavior of your sensor comes from the fact that it represents the sum of energy production of both panels. in my installation, I have an energy sensor for each panel, which I all add individually to the "solar panels" in the "Energy" dashboard. Do NOT make a template sensor (total_increasing) to sum up data from different inverters, because this sensor will have a "strange" behavior when energy values will be reset to 0 at night. for different inverters, these resets do not happen at the exact same time, so this template sensor will not go back to 0 in one single step, as required.

ErikKok commented 1 year ago

@patience4711 those two screenshots are sensors directly recieving the mqtt messages, so this IS the data directly from the ESP

@frtz13 what automation and sensor are you using?

The sensor in the screenshot is from 1 inverter with 2 panels btw. I have the same, each inverter is added seperatly in the Energy Dashboard.

frtz13 commented 1 year ago

no automation, ESP-ECU v. 9_7xc. MQTT topic configured with a trailing /. "Dom.Idx" different for each inverter. MQTT format 3.

mqtt:
    sensor:
      - name: "PV prod Inv1 P1"
        device_class: energy
        state_topic: "home/pv/1"
        value_template: '{{ ((value_json["en"][0] | float(0)) / 1000) | round(3) }}'
        unit_of_measurement: "kWh"
        state_class: "total_increasing"

etc. for the other inverters and panels.

ErikKok commented 1 year ago

Thanks @frtz13 , i've upgraded to 9_7xc and figured it out I guess :) I'll report back if I get those weird gaps in the data again.

I noticed the dom.idx was the same for all 3 inverters I have, maybe just my error, maybe this not being populated as supposed is a kind of bug. Just wanted to mention it here.

Can I sum up the 2 panels connected to the same inverter for the Energy Dashboard, or is it best to leave them separate?

Just for future reference my MQTT for all sensors, maybe it helps someone:

- name: "APS-ESP West1 Energy Total Increasing MPPT 0"
  unique_id: "APS-ESP West1 Energy Total Increasing MPPT 0"
  state_topic: "APS/in/0"
  device_class: energy
  value_template: '{{ ((value_json["en"][0] | float(0)) / 1000) | round(3) }}'
  unit_of_measurement: "kWh"
  state_class: "total_increasing"

- name: "APS-ESP West1 Energy Total Increasing MPPT 1"
  unique_id: "APS-ESP West1 Energy Total Increasing MPPT 1"
  state_topic: "APS/in/0"
  device_class: energy
  value_template: '{{ ((value_json["en"][1] | float(0)) / 1000) | round(3) }}'
  unit_of_measurement: "kWh"
  state_class: "total_increasing"

- name: "APS-ESP West1 Temperature"
  unique_id: "APS-ESP West1 Temperature"
  state_topic: "APS/in/0"
  device_class: "temperature"
  value_template: '{{ value_json["temp"] }}'
  unit_of_measurement: "°C"

- name: "APS-ESP West1 MPPT 1"
  unique_id: "APS-ESP West1 MPPT 1"
  state_topic: "APS/in/0"
  device_class: power
  value_template: '{{ value_json["pwr"][0] }}'
  unit_of_measurement: "W"

- name: "APS-ESP West1 MPPT 2"
  unique_id: "APS-ESP West1 MPPT 2"
  state_topic: "APS/in/0"
  device_class: power
  value_template: '{{ value_json["pwr"][1] }}'
  unit_of_measurement: "W"
frtz13 commented 1 year ago

I'd add the separately to the Energy dashboard. at least unless we fully understand why you got the strange sensor behavior, as documented at the beginning of this issue.

ErikKok commented 1 year ago

I did not forget about this topic, but wanted to wait a while to be sure. Please re-open @patience4711 The original problem sometimes only occured after a few weeks. The first day I noticed some dips to 0 watt, i suspected that voltage maybe was too high, so started logging that. Until yesterday all was fine, but then again a drop to zero. Net voltage was well within specs: 234v.

fdghfhdgdfgh

Edit: wtw, when this happens, the energy, kWh, flatlines too. After the wattage goes up, only then the kWh goes up as well. No correction, just picks up where it left.

The log seems fine:

25-19:20:27 | system | start nightmode -- | -- | -- 25-16:23:56 | mqtt | connected 25-16:23:54 | zigbee | ZB coordinator started 25-16:23:43 | zigbee | zigbee module reset 25-16:23:42 | zigbee | zb down, received : 25-6:17:35 | system | wake-up from nightmode 25-3:0:0 | system | time retrieved 25-0:0:1 | system | all values reset

Would a signal loss to the inverter cause this, and would that be visible in the log? How to troubleshoot this any further?

ErikKok commented 1 year ago

I just updated to the latest version ESP-ECU_v9_7xf btw.

ErikKok commented 1 year ago

@patience4711 can you please re-open this topic, it's not completed :)

Anybody has any idea about this?