Giter Club home page Giter Club logo

Comments (29)

rbuffi avatar rbuffi commented on September 12, 2024

I have got the same issue.

from home_assistant_custom_envoy.

briancmpbll avatar briancmpbll commented on September 12, 2024

Looks like meters not being enabled causes different behavior in how the api reports production data. I'll need someone with this setup to help work on this.

from home_assistant_custom_envoy.

chosee avatar chosee commented on September 12, 2024

I can help you. The change described above provides the desired value for me.

from home_assistant_custom_envoy.

filmgarage avatar filmgarage commented on September 12, 2024

Which file of the integration contains this code that needs to be changed?

from home_assistant_custom_envoy.

catsmanac avatar catsmanac commented on September 12, 2024

That's envoy_reader.py.

I'm running ENVOY-S non metered D7. 0.88 and https://envoy/production.json returns wnow (below example 0 as it's dark outside) and whlifetime

{
  "production": [
    {
      "type": "inverters",
      "activeCount": 24,
      "readingTime": 1681325285,
      "wNow": 0,
      "whLifetime": 1159907
    }
  ],
  "storage": [
    {
      "type": "acb",
      "activeCount": 0,
      "readingTime": 0,
      "wNow": 0,
      "whNow": 0,
      "state": "idle"
    }
  ]
}

But it doesn't include the Watthourstoday nor last 7 days watthours which is in https://envoy/api/v1/production

{
  "wattHoursToday": 33455,
  "wattHoursSevenDays": 189414,
  "wattHoursLifetime": 1159907,
  "wattsNow": 0
}

So it looks like such a change would be compatible with ENVOY-S non metered for watthoursLifetime and wattsNow.

from home_assistant_custom_envoy.

filmgarage avatar filmgarage commented on September 12, 2024

whlifetime is acteually the only one I really care about and it works now. I have no idea why I couldn't find this myself... Thanks for your help!

from home_assistant_custom_envoy.

chosee avatar chosee commented on September 12, 2024

therefore I changed in def lifetime_production(self):

raw_json = self.endpoint_production_json_results.json() lifetime_production = raw_json["production"][0]["whLifetime"]

And now I receive the lifetime production...

Those changes are in file:

/config/custom_components/enphase_envoy/envoy_reader.py

in row 653/654

original code:
raw_json = self.endpoint_production_v1_results.json()
lifetime_production = raw_json["wattHoursLifetime"]

replaced with:
raw_json = self.endpoint_production_json_results.json()
lifetime_production = raw_json["production"][0]["whLifetime"]

This works for the situation "self.endpoint_type == ENVOY_MODEL_S and not self.isMeteringEnabled" but I don't know if this also works for the situation self.endpoint_type == ENVOY_MODEL_C

from home_assistant_custom_envoy.

filmgarage avatar filmgarage commented on September 12, 2024

I can confirm it works on my metered Envoy Model S

from home_assistant_custom_envoy.

catsmanac avatar catsmanac commented on September 12, 2024

I tried the change shared by @chosee on my (European) Envoy-S not metered and it is only reading the value from production.json at startup and after that value never changes anymore. No debug trace of it going after production.json again, only v1/production. So there's some other places that may need change for the change to be compatible with ENVOY-S not metered.

from home_assistant_custom_envoy.

posixx avatar posixx commented on September 12, 2024

@catsmanac @chosee please post the json output of the production node see what differs between your systems ( https://envoy/production.json that is)

from home_assistant_custom_envoy.

catsmanac avatar catsmanac commented on September 12, 2024

envoy/api/v1/production:

{
  "wattHoursToday": 37544,
  "wattHoursSevenDays": 179126,
  "wattHoursLifetime": 1197450,
  "wattsNow": 4830
}

envoy/production.json

{
  "production": [
    {
      "type": "inverters",
      "activeCount": 24,
      "readingTime": 1681398307,
      "wNow": 4829,
      "whLifetime": 4404
    }
  ],
  "storage": [
    {
      "type": "acb",
      "activeCount": 0,
      "readingTime": 0,
      "wNow": 0,
      "whNow": 0,
      "state": "idle"
    }
  ]
}

Note differences in whlifetime between v1/production and production.json. Device is ENVOY-S-Standard-EU according to Enphase site. Firmware D7.0.88.

Running HA production in Docker on Synology and test using HASSOS in VMWARE Player. All tests are done in the latter.

from home_assistant_custom_envoy.

chosee avatar chosee commented on September 12, 2024

envoy/api/v1/production:

{
  "wattHoursToday": 0,
  "wattHoursSevenDays": 0,
  "wattHoursLifetime": 0,
  "wattsNow": 0
}

envoy/production.json

{
  "production": [
    {
      "type": "inverters",
      "activeCount": 20,
      "readingTime": 1681399316,
      "wNow": 3762,
      "whLifetime": 997588
    },
    {
      "type": "eim",
      "activeCount": 0,
      "measurementType": "production",
      "readingTime": 1681399542,
      "wNow": -0.029,
      "whLifetime": 0,
      "varhLeadLifetime": 0,
      "varhLagLifetime": 0,
      "vahLifetime": 0,
      "rmsCurrent": 0.256,
      "rmsVoltage": 253.917,
      "reactPwr": 0,
      "apprntPwr": 17.449,
      "pwrFactor": 0,
      "whToday": 0,
      "whLastSevenDays": 0,
      "vahToday": 0,
      "varhLeadToday": 0,
      "varhLagToday": 0
    }
  ],
  "consumption": [
    {
      "type": "eim",
      "activeCount": 0,
      "measurementType": "total-consumption",
      "readingTime": 1681399542,
      "wNow": -2.492,
      "whLifetime": 0,
      "varhLeadLifetime": 0,
      "varhLagLifetime": 0,
      "vahLifetime": 0,
      "rmsCurrent": 0.007,
      "rmsVoltage": 254.695,
      "reactPwr": 0,
      "apprntPwr": 1.906,
      "pwrFactor": -1,
      "whToday": 0,
      "whLastSevenDays": 0,
      "vahToday": 0,
      "varhLeadToday": 0,
      "varhLagToday": 0
    },
    {
      "type": "eim",
      "activeCount": 0,
      "measurementType": "net-consumption",
      "readingTime": 1681399542,
      "wNow": -2.463,
      "whLifetime": 0,
      "varhLeadLifetime": 0,
      "varhLagLifetime": 0,
      "vahLifetime": 0,
      "rmsCurrent": 0.248,
      "rmsVoltage": 255.473,
      "reactPwr": 0,
      "apprntPwr": 51.584,
      "pwrFactor": -0.1,
      "whToday": 0,
      "whLastSevenDays": 0,
      "vahToday": 0,
      "varhLeadToday": 0,
      "varhLagToday": 0
    }
  ],
  "storage": [
    {
      "type": "acb",
      "activeCount": 0,
      "readingTime": 0,
      "wNow": 0,
      "whNow": 0,
      "state": "idle"
    }
  ]
}

Envoy-S-Metered-EU (Meters Not Enabled)
Software Version
D7.0.88 (5580b1)

from home_assistant_custom_envoy.

posixx avatar posixx commented on September 12, 2024

@chosee we cannot solve your reading as they are all 0 due to not having meters enabled. The proposed change isn't the correct lifetime production value. It needs to come from the eim node not the inverters node. So easiest fix is to connect your meters.

from home_assistant_custom_envoy.

chosee avatar chosee commented on September 12, 2024

Thanks for your advice :) I am still trying to figure out why the installer did not install the meters ;)

But in envoy/production.json -> production -> whLifetime is the number I am reading out to import the lifetime production to home assistant, this is perfect for me.

from home_assistant_custom_envoy.

posixx avatar posixx commented on September 12, 2024

I get that you want some reading available, but that value is not reflecting the actual lifetime production of your system.

This is my output:

"production": [{
"type": "inverters",
"activeCount": 36,
"readingTime": 1681415788,
"wNow": 0,
"whLifetime": 2257824
}, {
"type": "eim",
"activeCount": 1,
"measurementType": "production",
"readingTime": 1681415832,
"wNow": 16.887,
"whLifetime": 2290568.952,
"varhLeadLifetime": 10.06,
"varhLagLifetime": 1574734.433,
"vahLifetime": 3509103.029,
"rmsCurrent": 2.525,
"rmsVoltage": 700.504,
"reactPwr": 566.519,
"apprntPwr": 589.95,
"pwrFactor": 0.03,
"whToday": 56433.952,
"whLastSevenDays": 315611.952,
"vahToday": 63388.029,
"varhLeadToday": 0.06,
"varhLagToday": 13068.433
}

As you can see the whLifetime value of the eim node is completely different from the inverters node..

from home_assistant_custom_envoy.

catsmanac avatar catsmanac commented on September 12, 2024

Interesting question would then be how @chosee enlighten web site is reporting data to get better understanding how it deals with envoy metered without ct's. The sum of all panels lifetime should match envoy lifetime production I guess.

Looking at the code his case distinguishes as has_production_and_consumption true and has_metering_setup false where the envoy-s non metered would be has_production_and_consumption false and has_metering_setup false. Weather this can be used depends on the reported number making sense compared to the enlighten data.

And of course getting the metered one comes with CT's so why not use them.

from home_assistant_custom_envoy.

chosee avatar chosee commented on September 12, 2024

In the enlighten web site (and app) the reporting looks good and correct:

https://enlighten.enphaseenergy.com/pv/public_systems/YLST3906300/overview

from home_assistant_custom_envoy.

posixx avatar posixx commented on September 12, 2024

Well that is current production, this issue is about lifetime production..

from home_assistant_custom_envoy.

catsmanac avatar catsmanac commented on September 12, 2024

That is right, but I wouldn't be surprised if @chosee switches the view to lifetime or sums the values for all days there would a number close to what is in the invertors report section.

from home_assistant_custom_envoy.

posixx avatar posixx commented on September 12, 2024

Sorry but this plugin uses actual readings, not computed values. If someone is using an envoy in an unsupported scenario (ie metered without meters connected) it will result in limitations / unavailable data.

EDIT: the only thing we can do is when metered lifetime is 0, we use inverter lifetime. I will add this to my pull request

from home_assistant_custom_envoy.

chosee avatar chosee commented on September 12, 2024

When I compare the information I get from the "inverter lifetime" and I compare it with the information in enlighten -> it's exactly the same.

When I look at your inverter lifetime -> "whLifetime": 2257824 and your eim node lifetime -> "whLifetime": 2290568.952 -> the difference is about 33000 (about 1.5%). Is this what the installation itself uses? Or where does this go?

from home_assistant_custom_envoy.

posixx avatar posixx commented on September 12, 2024

I have no idea. Maybe the envoy does the same as my latest commit; when measurements are not done it takes inverter value. In my case the webgui from envoy reports the same value (rounded) as the eim vhLifetime:

afbeelding

afbeelding

inverters whLifetime is lower. I guess meters are more acurate?

from home_assistant_custom_envoy.

catsmanac avatar catsmanac commented on September 12, 2024

The envoy manual states:

Select the Envoy-S Type to Install
• The Envoy-S Metered uses precision Current Transformers (CTs) to measure PV production (accuracy 2.5%) from the solar main supply switch and home energy consumption from the AC mains.
• The Envoy-S Standard offers microinverter PV production monitoring (accuracy +/- 5%).

from home_assistant_custom_envoy.

catsmanac avatar catsmanac commented on September 12, 2024

As for the code change, I wonder if the test

        if self.endpoint_type == ENVOY_MODEL_S and self.isMeteringEnabled:
            raw_json = self.endpoint_production_json_results.json()
            lifetime_production = raw_json["production"][1]["whLifetime"]
            """If envoy is used without meters connected, lifetime_production will be 0, so we use inverters whLifetime"""
            if lifetime_production == "0":
                lifetime_production = raw_json["production"][0]["whLifetime"]

is in the correct spot. The test

def has_metering_setup(json):
    """Check if Active Count of Production CTs (eim) installed is greater than one."""
    return json["production"][1]["activeCount"] > 0

will result in false as the count in eim is 0 and that would activate the next code section instead

        elif self.endpoint_type == ENVOY_MODEL_C or (
            self.endpoint_type == ENVOY_MODEL_S and not self.isMeteringEnabled
        ):
            raw_json = self.endpoint_production_v1_results.json()
            lifetime_production = raw_json["wattHoursLifetime"]

which is the change @chosee tested before. So something similar to:

        elif self.endpoint_type == ENVOY_MODEL_C or (
            self.endpoint_type == ENVOY_MODEL_S and not self.isMeteringEnabled
        ):
            raw_json = self.endpoint_production_v1_results.json()
            lifetime_production = raw_json["wattHoursLifetime"]
            """If envoy is used without meters connected, lifetime_production will be 0, so we use inverters whLifetime"""
            if lifetime_production == "0":
                raw_json = self.endpoint_production_json_results.json()
                lifetime_production = raw_json["production"][0]["whLifetime"]

altough I would be tempted to come up with alternate status based on has_production_and_consumption. If that is true and isMeteringEnabled id false that we have the case at hand.

from home_assistant_custom_envoy.

posixx avatar posixx commented on September 12, 2024

I will keep this issue out of my pull request as it isn't related to 3-phase.

from home_assistant_custom_envoy.

swannet avatar swannet commented on September 12, 2024

Hi,

Just hitting the same issue (no lifetime value anymore after switch to this Custom Intergration because of the new v7 auth method.

I've also a Metered Version without CT's installed (my installer says its common in the Netherlands and that is there 'normal' way of installing it just as a lot of other companies does) I won't start a discussion if its correct or not. I just want to check the status of your PR where you pick

Any update regarding you PR where you pick the lifetime inverter value when the metered info is 0?

from home_assistant_custom_envoy.

filmgarage avatar filmgarage commented on September 12, 2024

I am experiencing the same problem, also located in The Netherlands

from home_assistant_custom_envoy.

catsmanac avatar catsmanac commented on September 12, 2024

@vincentwolsink has it fixed in his fork. The change he applied is the same test as for production watts.

His one is different but compatible with this one. He also creates a device for each individual solarpanel but the solar production entity has same naming scheme as this one. If you have a installer or diy account you get more data. If homeowner account only check that option in the configuration and you'll have same as this one (with underlying improvements).

from home_assistant_custom_envoy.

catsmanac avatar catsmanac commented on September 12, 2024

PR #97 now has a fix for this as well

from home_assistant_custom_envoy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.