briancmpbll / home_assistant_custom_envoy

178 stars 76 forks source link

None of the Daily/Weekly Sensors showing and data #88

Open asinla opened 1 year ago

asinla commented 1 year ago

Install went fine, thanks so much for this.

However the Daily, Weekly and Lifetime production sensors show 0.0 after 4 days of me installing the integration. My Enlighten app and website show the data fine but for some reason in HA it's just 0.

I do not have CT's installed (cannot do that with SCE meter unfortunately) so consumption will definitely show as 0. I am setting up my Emporia View data to work with this Enphase data as soon as I can figure out this issue.

Thanks for your time!

I'll buy you a coffee today!

Envoy Sensors

Hoffmann77 commented 1 year ago

So you are using an Envoy Model S Metered but the CT's are not connected? This raises some issues: First of all the integration is not really designed to support this type of setup at the moment. Even with support you could only get the Lifetime Energy Production data. There is currently no knowledge about a local endpoint that would provide the missing data in a configuration like yours.

Here you can see the output of the production endpoints in a similar configuration. https://github.com/briancmpbll/home_assistant_custom_envoy/issues/51#issuecomment-1507174875

asinla commented 1 year ago

Thanks for the reply.

Yes, the CT's are not able to be used in a SCE ( SoCal Edison ) panel. No-one but Edison has access and the in and out are connected to a busbar.

So I purchased and connected the Emporia Vue Utility Connect device which connects to the SCE meter via zigbee. Through their app I can see a graph that basically goes up and down with production and consumption and changes colour depending on which is greater. Graph turns green and starts from zero when production becomes more than consumption. There is a great HA integration that gets me that data in HA. My plan was to use the Enphase Envoy production data and the Emporia Vue data in HA to create the energy monitoring I would like to see which is basically recreate what the Enlighten app would show me if the CT's were connected. I am by no means a programmer so i do not 100% understand your reply.

Are you basically saying there is no way to do what I need to do?

Thanks again for your time!

Hoffmann77 commented 1 year ago

Hey @asinla,

to get values for "Lifetime Energy Production" right now you could fork the repository and change lines 653/654 in envoy_reader.py.

from:

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

to:

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

"Lifetime Energy Production" could to be used as an input for the home-assistant energy dashboard.

At the moment I am not aware of a local API endpoint that would provide the missing data for "Last Seven Days Energy Production" and "Today's Energy Production" in your type of configuration.

Maybe at some point in the future someone figures out a way to collect this data in a configuration like yours.

Hope I could help.

catsmanac commented 1 year ago

Think the key to detection if an envoy-s metered is using production meters is in the returned json.

A non-metered Envoy (mine) only returns 1 production element in 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"
    }
  ]
}

An ENVOY Metered returns a second production segment (see 51)

  "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
    }
  ],

An Envoy metered with no production CT connected will report activeCount 0 in the second production segment, see 51

{
  "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
    }
  ],

So if there's a production[1] and activecount = 0 then use the production[0][whlifetime] instead of the [1] one. Provided that this number is the correct number as there seems to be some discussion on that. You should be able the validate that number against the enphase website numbers.

asinla commented 1 year ago

Thanks so much for your time catsmanac. I really appreciate it.

I was sure that if the Enlighten app was giving me production numbers and the Emporia Vue app was giving me consumption numbers then I would be able to use those 2 in HA in some way. I will have to take my time and see if I can figure out a way to use what you said above. I have a friend who codes so I'll ask him for help.

Thanks again, have a great week.

Hoffmann77 commented 1 year ago

Hey @catsmanac, i am actually working on a fork that incorporates this kind of detection. It's still in an early state but it's currently working in my setup with an Envoy-S metered.

If you like you could give it a try.

catsmanac commented 1 year ago

Hey @catsmanac, i am actually working on a fork that incorporates this kind of detection. It's still in an early state but it's currently working in my setup with an Envoy-S metered.

If you like you could give it a try.

Trying it, feedback in your repo's issues

mvroosmalen1970 commented 1 year ago

Hey @asinla,

to get values for "Lifetime Energy Production" right now you could fork the repository and change lines 653/654 in envoy_reader.py.

from:

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

to:

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

"Lifetime Energy Production" could to be used as an input for the home-assistant energy dashboard.

At the moment I am not aware of a local API endpoint that would provide the missing data for "Last Seven Days Energy Production" and "Today's Energy Production" in your type of configuration.

Maybe at some point in the future someone figures out a way to collect this data in a configuration like yours.

Hope I could help.

Hi I can confirm this fix is working for me!! I changed the code on lines 657/658 (below ENVOY_MODEL_S and is not self.isMeteringEnabled) though...

dadek16 commented 1 year ago

Same issue here. No production values, only current production. I suppose above solution works for all production values? Thanks!

Theetjuh commented 1 year ago

Same issue here, the HA integration stopped working for me, but this custom integration works .. except the today, week and lifetime stays at 0 Wh.

Envoy-S-Metered-EU SKU: ENV-S-WM-230 Firmware: D7.6.175

Imaginous commented 1 year ago

I have the same issue, today's and 7 day power counters are report 0.

With the 5.x firmware and default HA integration these values were reported. In the installer app they are also reported.

Update: It seems that with the latest firmware /api/v1/production returns 0 for the wattHoursToday and wattHoursSevenDays.

I have opened an issue in the Enphase installer app.

Firmware D7.6.175 (f79c8d) Envoy-s standard

Installer app: Screenshot_20230709-071559_Toolkit

catsmanac commented 1 year ago

My Envoy-s EU non metered now on 7.6.175 is still reporting all data as before in v1/production. Data in production.json was not correct before and now with the exceptions of wNow that matches wattsNow in v1/production. Seems metered ones are impacted (with and withouth meters connected/enabled)

catsmanac commented 1 year ago

Are all of you with this problem using ENVOY metered without CT's connected?

(With activeCount 0 for type eim in production.json

      "type": "eim",
      "activeCount": 0,

)

Imaginous commented 1 year ago

I have a non metered (Envoy-s standard).

In my Envoy-s the fields wattHoursToday and wattHoursSevenDays are both 0.

However the Enphase website shows them correctly. It looks something is fishy with my Envoy-s and current firmware. But Enphase is looking into it.

catsmanac commented 1 year ago

Keep us posted. I'm running Envoy-s standard EU with d7.6.175 as well and am getting v1/production correctly (fingers crossed I guess)

{
  "wattHoursToday": 30937,
  "wattHoursSevenDays": 342385,
  "wattHoursLifetime": 5089571,
  "wattsNow": 1068
}
catsmanac commented 1 year ago

@Imaginous can we close this one?

Theetjuh commented 1 year ago

Does it actually already work without modification of the code for non metered? I haven’t updated since I changed the code in version 0.0.11

asinla commented 1 year ago

Mine still not working.

I just got PTO officially yesterday and the system had been turned off the week prior by my installer so I’m waiting for at least a week of fresh data to try again. But currently it’s the same as it was when I started this thread.

catsmanac commented 1 year ago

@Theetjuh I'm running ENVOY-S EU Standard (non-metered) with V0.0.17. Which is something different as ENVOY-S metered without CT configured/connected. Sometimes there's confusion about this detail. For real plain vanilla ENVOY-S non metered the only fundamental change is the cached token so a restart/reload is not dependent on the Enphase web-site performance. You may consider switching to new HA Core enphase envoy expected in one of September releases.

catsmanac commented 1 year ago

@asinla the metered envoy without CT configured/connected is known to not return daily and last seven day values. Furthermore it reportedly resets lifetime production to 0 when it reaches ~1.2Mhh, see note 2 in the readme. Since mid july release the code recognizes this situation and grabs the lifetime and current values from a different location in the same report so these are at least available.

asinla commented 1 year ago

Got it, thanks.

I’ll keep my eye open for the HA Sept release and see if there’s any movement.

catsmanac commented 1 year ago

HA release will have same issue as it's an Envoy firmware problem, we worked around the best we could and I think HA core one did too.

Theetjuh commented 1 year ago

@Theetjuh I'm running ENVOY-S EU Standard (non-metered) with V0.0.17. Which is something different as ENVOY-S metered without CT configured/connected. Sometimes there's confusion about this detail. For real plain vanilla ENVOY-S non metered the only fundamental change is the cached token so a restart/reload is not dependent on the Enphase web-site performance. You may consider switching to new HA Core enphase envoy expected in one of September releases.

Well that didn't work, so I'm back :) The daily/week/lifetime sensors didn't update ... so the current implementation within HA is not working for me.

catsmanac commented 1 year ago

It's been reported at various locations that ENVOY-Metered without CT's installed/configured is not providing data in daily weekly entities.

Can you post the diagnostic report of the Envoy here just to confirm I'm not overlooking anything? (download it to your pc from the envoy device page in HA, Rename it to .txt and upload in a reply. Sensitive data like pw are hidden, but you may want to remove other entities if you like and/or replace the Envoy serial if you want to hide it as well)

Theetjuh commented 1 year ago

I’ll try and create a seperate HA instance, cause constant switching between the implementations causes major corruption in my energy history.

Give me some time for that please, for now I can tell you that this DEV implementation gives lifetime sensor data and the one in HA doesn’t.

catsmanac commented 1 year ago

HA release will have same issue as it's an Envoy firmware problem, we worked around the best we could and I think HA core one did too.

I see quite some activities in the HA Core Envoy environment, so they are probably working out the startup issues.

Theetjuh commented 1 year ago

HA 2023.9.1 seems to be working in my test environment, at least I see the same current power production and lifetime energy production as in my prod environment, so they probably changed something in the .1 release.

Will run it for a day or so and see if the energy dashboard is updated, then I'll update my prod environment. Will keep you posted.

Theetjuh commented 1 year ago

It works, so I migrated to the HA implementation, thanks for all the info and help @catsmanac!