jesserizzo / envoy_reader

MIT License
37 stars 26 forks source link

Envoy S Production data is not read / read incorrectly when current transformers are not enabled/installed [bug] #37

Closed lnlp closed 3 years ago

lnlp commented 4 years ago

Problem

Envoy S Production data is not read when not using current transformers which renders reported Production data useless.

This is because envoy_reader assumes that when `envoy/production.json' exists that this is the location to read the Production data from. But that is an incorrect assumption because it is only valid when current transformers (CT) are enabled/installed.

Situation

I use Envoy S but without any CT's installed. For a 3-phase installation I would need to buy 4 additional CT's while consumption and production data is already provided by my smart electricity meter (via DSMR P1 port). I therefore did not install any CT's.

When using Envoy S without having CT's enabled then production data in envoy/production.json is NOT updated.

Actual Production that gets updated is available via envoy/api/v1/production however. But envoyreader does not read it. It only reads envoy/production.json. As a result the reported Production values are either 0 or some bogus value. (I have observed bogus values for 'production' and 'consumption' in range between 0 and 2)._

An Envoy S (and probably Envoy IQ) without CT's enabled should be handled as 'endpoint_type' "P" instead of 'endpoint_type' "PC".

Details about my Envoy: Enphase Envoy S 'metered' Multiphase (probably identical to Envoy IQ). Part number: 800-00554-r03, Software Version: R4.10.35 (6ed292) Electrical system: 3-phase 230V.

Solution

Handle Envoy S (and Envoy IQ) without CT's as 'endpoint_type' "P" instead of 'endpoint_type' "PC".

There are 2 options to implement this:

By default envoy_reader should automatically determine whether CT's are enabled and act accordingly. By providing an optional ct_enabled parameter the user can override it for testing purposes.

This is what is shown on the envoy/home page when CT's are not enabled:

Meters Not Enabled

Let me know if you need more information or help.

pedrocr commented 3 years ago

@rct the scraping blog was where I got that URL. Can you confirm that you can get this without any authentication? If so this may end up being the best solution, although it requires 2 requests.

lnlp commented 3 years ago

Can you confirm that you can get this without any authentication?

I just tested it in Windows Sandbox: No authentication required for both url's.

pedrocr commented 3 years ago

Seems like this is the winner for #46

lnlp commented 3 years ago

I discovered that /production.json can also provide per-phase values.

See following comment in #46 for more information.

gtdiehl commented 3 years ago

Well sorry to say but there was a bug in the code. It causes Home Assistant to not update after a couple of polls. I have made the change to fix it, actually just removed a single line of code, PR #51. Now I have to get this included in a bugfix-release for Home Assistant as 2020.12.0 includes the envoy_reader with the bug. I'm sorry about this!

lnlp commented 3 years ago

Too bad, but no need to feel sorry. 🙂 Thanks for your continuing efforts!

I was happy to see it working in 2020.12.0 now but then noticed values reported in HA don't match /api/v1/production. Your message explains this.

Do you expect to get the fix into the next (bug-fix) release (presumably 2020.12.1)?

Mmm, just wondering: will a HA 2020.12.1 bug-fix release automatically become 2021.01.0 if released in January 2021?

gtdiehl commented 3 years ago

@lnlp Thanks! 😃 The fix was merged into the dev branch yesterday, which usually means it will make it into the next release (2021.01.0). Though this time I had someone add my PR to the list of PRs that should be included in 2020.12.1. Cross your fingers, and I'm hoping it will be included in 2020.12.1.

lnlp commented 3 years ago

I upgraded to HA 2020.12.1 today and the /api/v1/production counters now appear to report properly in HA. (Envoy-S metered multi-phase (EU) with no CT's installed.)

Matthew1471 commented 7 months ago

Do you know what the "eim" stands for? (I suspect something like: electrical induction metering)

Envoy Integrated Meter