GithubHelp home page GithubHelp logo

home_assistant_custom_envoy's People

Contributors

bobvandevijver avatar briancmpbll avatar catsmanac avatar cddu33 avatar d1b avatar fracarma avatar opensourcesimon avatar poppypop avatar posixx avatar royto avatar spasma avatar testuser7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

home_assistant_custom_envoy's Issues

production lifetime is zero

I have envoy Envoy S Metered, Firmware D7.0.88 (but the meters are not enabled)

The integration works and I receive the Watts from the inverters, but my lifetime_energy_production is Zero.

I checked the following:
/api/v1/production
I also get:
{
"wattHoursToday": 0,
"wattHoursSevenDays": 0,
"wattHoursLifetime": 0,
"wattsNow": 0
}

But when I check production.json I receive the following data:
{"production":[{"type":"inverters",
"activeCount":20,
"readingTime":1677057243,
"wNow":218,
"whLifetime":103327},....

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...

Integration stopping randomally then restarting

The integration is stopping randomally with the below status and messages.
Restarts after a time but then stops again. Seems random?
System in Envoy with firmware D7.0.88

Integration page shows.
Retrying setup: Error communicating with API: Request URL is missing an 'http://' or 'https://' protocol.
and log:
Config entry 'Envoy XXXXXXXXXXXXX' for enphase_envoy integration not ready yet: Error communicating with API: Request URL is missing an 'http://' or 'https://' protocol.; Retrying in background
1:30:49 PM – (WARNING) config_entries.py - message first occurred at 12:00:03 PM and shows up 4 times

Can't authenticate: Could not get 6 month token

I'm trying to set up this integration now that my firmware got updated to v7, but I'm having trouble. I enter my enlighten username and password, check the "enlighten" box, it has my correct serial number and IP address listed, but when I submit it I receive the following exception:

Traceback (most recent call last):
  File "/config/custom_components/enphase_envoy/config_flow.py", line 154, in async_step_user
    envoy_reader = await validate_input(self.hass, user_input)
  File "/config/custom_components/enphase_envoy/config_flow.py", line 46, in validate_input
    await envoy_reader.getData()
  File "/config/custom_components/enphase_envoy/envoy_reader.py", line 359, in getData
    await self._getEnphaseToken()
  File "/config/custom_components/enphase_envoy/envoy_reader.py", line 252, in _getEnphaseToken
    token_json = await self._fetch_owner_token_json()
  File "/config/custom_components/enphase_envoy/envoy_reader.py", line 240, in _fetch_owner_token_json
    raise Exception("Could not get 6 month token: " + msg)
Exception: Could not get 6 month token: You need to sign in first

A warning in the log was detected about the usage of a deprecated system call (support stops per HA 2023.3)

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: February 8, 2023 at 08:01:45 (1 occurrences)
Last logged: February 8, 2023 at 08:01:45

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for enphase_envoy using this method at custom_components/enphase_envoy/init.py, line 108: hass.config_entries.async_setup_platforms(entry, PLATFORMS)

configuration flow fails

The envoy is D7.0.71 (a48a57). I get "failed to connect" when attempting the config flow. I can connect to the IP address fine from a browser.

Traceback in the HA logs:

2022-04-29 23:31:57 ERROR (MainThread) [custom_components.enphase_envoy.config_flow] Unexpected exception Traceback (most recent call last): File "/config/custom_components/enphase_envoy/config_flow.py", line 154, in async_step_user envoy_reader = await validate_input(self.hass, user_input) File "/config/custom_components/enphase_envoy/config_flow.py", line 46, in validate_input await envoy_reader.getData() File "/config/custom_components/enphase_envoy/envoy_reader.py", line 359, in getData await self._getEnphaseToken() File "/config/custom_components/enphase_envoy/envoy_reader.py", line 252, in _getEnphaseToken token_json = await self._fetch_owner_token_json() File "/config/custom_components/enphase_envoy/envoy_reader.py", line 240, in _fetch_owner_token_json raise Exception("Could not get 6 month token: " + msg) Exception: Could not get 6 month token: You need to sign in first

Value Format

Is there a way to customize the format of the values? Say from Wh to kWh for graphs or entities?

New async_forward_entry_setups needed and New state class

Hi, I have these errors with the new version for HA 2023.01:

1- New integration

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: 10:33:20 (1 occurrences)
Last logged: 10:33:20

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for enphase_envoy using this method at custom_components/enphase_envoy/init.py, line 131: hass.config_entries.async_setup_platforms(entry, PLATFORMS)

2- New state class

Logger: homeassistant.components.sensor
Source: components/sensor/init.py:503
Integration: Sensor (documentation, issues)
First occurred: 10:33:20 (3 occurrences)
Last logged: 10:33:20

Entity sensor.envoy_122238084071_last_seven_days_energy_production (<class 'custom_components.enphase_envoy.sensor.EnvoyEntity'>) is using state class 'measurement' which is impossible considering device class ('energy') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
Entity sensor.envoy_122238084071_today_s_energy_consumption (<class 'custom_components.enphase_envoy.sensor.EnvoyEntity'>) is using state class 'measurement' which is impossible considering device class ('energy') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
Entity sensor.envoy_122238084071_last_seven_days_energy_consumption (<class 'custom_components.enphase_envoy.sensor.EnvoyEntity'>) is using state class 'measurement' which is impossible considering device class ('energy') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.

Additional features over native HA integration?

Hello!

I've been using the native Enphase integration in HA for almost 9 months now. Aside from the fact the native integration requires a CT, and it appears HA Custom Envoy pulls data from the website - is there any additional data that this add-on provides that the CT doesn't?

Thanks!

Unable to assign current consumption and production in Energy Dashboard

I have a D7.0.85 system and using your repo, I was finally able to log in to the system using my Enphase username and password.
This integration installs 27 entities that have sensors for lifetime usage, week, day, and current.

When I go to the energy dashboard to add my panel and my consumption and production, the dropdown list only shows the sensors for lifetime, week, and day. I'm unable to assign current production/consumption sensors.

Is this by design? If so, which value (lifetime, week, day?) should I assign to the grid consumption and solar panel production fields?

Also, when I assign the day consumption, I get this error:

Last reset missing
The following entities have state class 'measurement' but 'last_reset' is missing:
sensor.envoy_[serial]_today_s_energy_consumption

Unexpected error via Use Enlighten

Trying to setup a brand new system and HACS install; but getting this on the adding of the system. System FW: D7.0.153 (5957ef)
HA Details:
"installation_type": "Home Assistant OS",
"version": "2022.11.1",

Thanks!

Warning messages

Logger: homeassistant.components.sensor.recorder
Source: components/sensor/recorder.py:312
Integration: Sensor (documentation, issues)
First occurred: 8:55:11 PM (1 occurrences)
Last logged: 8:55:11 PM

Entity sensor.envoy_20....._lifetime_energy_consumption from integration enphase_envoy has state class total_increasing, but its state is not strictly increasing. Triggered by state 6818564 (6818.565) with last_updated set to 2022-04-22T00:53:58.089229+00:00. Please report it to the custom component author.

What is needed to fix this one? Thanks!

Energy consumption does not show up on the Energy dashboard

I installed v0.9 through HACS. On the Energy Dashboard, for consumption, I selected the "Today's Energy Consumption". This produces an error:

The following entities have state class 'measurement' but 'last_reset' is missing:

image

I know nothing about this, but I noticed that the sensors for production and consumption are different. I modified the const.py file, setting state_class=SensorStateClass.TOTAL_INCREASING to match the production configuration.

    SensorEntityDescription(
        key="daily_consumption",
        name="Today's Energy Consumption",
        native_unit_of_measurement=ENERGY_WATT_HOUR,
        state_class=SensorStateClass.TOTAL_INCREASING,
        device_class=SensorDeviceClass.ENERGY,
    )

This looks working to me. Does it make sense? I can submit a PR if it does.

Envoy not reached because of API error

I am getting then the error message in the home-assistant.log file:

WARNING (MainThread) [homeassistant.config_entries] Config entry 'Envoy ' for enphase_envoy integration not ready yet: Error communicating with API: Request URL is missing an 'http://' or 'https://' protocol.; Retrying in background

Plugin loads, but Envoy will not add

I believe I'm missing a step.
I completed the install successfully, and after adding the:
URL: https://LOCAL-IP
User: envoy
Pass:
Serial Number: 12-DIGIT-Serial_Number
Checkbox = Checked

I receive
`
This error originated from a custom integration.

Logger: custom_components.enphase_envoy.config_flow
Source: custom_components/enphase_envoy/envoy_reader.py:240
Integration: Enphase Envoy (DEV)
First occurred: 9:38:32 PM (3 occurrences)
Last logged: 9:41:48 PM

Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/enphase_envoy/config_flow.py", line 154, in async_step_user
envoy_reader = await validate_input(self.hass, user_input)
File "/config/custom_components/enphase_envoy/config_flow.py", line 46, in validate_input
await envoy_reader.getData()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 359, in getData
await self._getEnphaseToken()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 252, in _getEnphaseToken
token_json = await self._fetch_owner_token_json()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 240, in _fetch_owner_token_json
raise Exception("Could not get 6 month token: " + msg)
Exception: Could not get 6 month token: You need to sign in first
`

I've done both https://LOCAL-IP and just LOCAL-IP
Any ideas what I may be missing?

Current Power Production update interval

First of all thank you for making a working Add On for enphase FW 7.

I have one question: Currently the sensor current_power_production (watt produced by the system) is updated every 5 minutes. This is kind of useless because this value can go up and down easily in 5 minutes. Is there a way to adjust this to 10s for example? Data polling is still done locally right, so 10s won't hurt anyone?

In init.py i found SCAN_INTERVAL = timedelta(seconds=60), but changing this value doesn't seemto do anything.

Wrong number formatting.

All the values I get use commas instead of dots for decimals. This makes everything thousands and hundreds of thousands.

Number format should be 1,234.56.

Loss of communication with Envoy for whole day

Every so often I notice that homeassistant cannot poll the envoy. When this happens, it lasts all day. I do not reboot the docker container every day, so I am unsure why it fixes itself daily. I am almost sure it is due to wifi signal issues, but those issues would not last all day.

Is there a way to get this integration, or homeassistant to retry more often?

Add phase data to integration

Hi, in addition to the (official) enhpase integration I used to also get phase data by running this script:

#!/bin/bash
timeout 15 curl --silent --anyauth --user installer:password http://192.168.207.62/stream/meter | sed 's,data,{"data",g' | sed 's,}}},}}}},g' | head -1 > /config/www/enphase/stream.json

This will output:

data: {"production":{"ph-a":{"p":-0.0,"q":99.446,"s":100.409,"v":228.883,"i":0.439,"pf":0.0,"f":50.0},"ph-b":{"p":-1.567,"q":102.556,"s":116.856,"v":230.953,"i":0.506,"pf":-0.05,"f":50.0},"ph-c":{"p":-0.0,"q":91.706,"s":91.706,"v":230.538,"i":0.398,"pf":0.0,"f":50.0}},"net-consumption":{"ph-a":{"p":306.995,"q":-338.221,"s":517.157,"v":229.041,"i":2.256,"pf":0.6,"f":50.06},"ph-b":{"p":664.371,"q":-234.739,"s":712.775,"v":230.915,"i":3.087,"pf":0.94,"f":50.06},"ph-c":{"p":214.227,"q":-280.693,"s":373.197,"v":230.522,"i":1.62,"pf":0.57,"f":50.06}},"total-consumption":{"ph-a":{"p":306.995,"q":-437.668,"s":617.253,"v":228.962,"i":2.696,"pf":0.5,"f":50.03},"ph-b":{"p":662.804,"q":-337.295,"s":829.621,"v":230.934,"i":3.592,"pf":0.8,"f":50.03},"ph-c":{"p":214.227,"q":-372.399,"s":465.303,"v":230.53,"i":2.018,"pf":0.46,"f":50.03}}}

And then read the created (json) file like this:

  - platform: rest
    name: Enphase production phase 1
    resource: http://ha-ip:8123/local/enphase/stream.json
    scan_interval: 30
    verify_ssl: false
    force_update: true
    device_class: energy
    value_template: "{{ (value_json['data']['production']['ph-a']['p'] | float / 1000) | round(2) }}"
    unit_of_measurement: "kWh"
    json_attributes_path: $['data']['production']['ph-a']
    json_attributes:
      - f
      - i
      - q
      - p
      - s
      - pf
      - v

And then repeat this proces by adding the other production and consumption phases.

I was then able to show this in the front-end

image

and use the data for automating power users on different phases on order to consume as much as possible solar energy.

Since firmware 7 this won't work anymore.

It would be really great if you could add the phase data to your hass Enphase component!

last_seven_days_energy_production has wrong state class?

2023-04-20 10:13:53.552 WARNING (Recorder) [homeassistant.components.sensor.recorder] Entity sensor.envoy_XXXX_last_seven_days_energy_consumption from integration enphase_envoy has state class total_increasing, but its state is not strictly increasing. Triggered by state 168127 (168161.0) with last_updated set to 2023-04-20T17:06:44.471756+00:00. Please report it to the custom integration author.

I'm using the latest version of this Integration with:
Home Assistant 2023.4.5
Supervisor 2023.04.0
Operating System 10.0
Frontend 20230411.1 - latest

Exposing wNow from storage (battery) entity in production.json?

Looking to expose the wNow field from storage here to view the input/output wattage into/out of the batteries:

https:///production.json?details=1

e.g.:

  "storage": [
    {
      "type": "acb",
      "activeCount": 0,
      "readingTime": 0,
      "wNow": 0,
      "whNow": 0,
      "state": "idle"
    }
  ]

It's confusing sometimes to see high "consumption" wattage when the batteries are charging, and showing this value would help (and being able to do something like summing it with the overall consumption since it shows negative when charging, positive when discharging, etc).

I've poked through the reader, etc some but don't see exactly where this would be the easiest to add.

Fails to finish install when no battery is connected to system

2022-05-25 15:54:53 ERROR (MainThread) [custom_components.enphase_envoy] Unexpected error fetching envoy Envoy ############ data: division by zero
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 191, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data
return await self.update_method()
File "/config/custom_components/enphase_envoy/init.py", line 78, in async_update_data
data[description.key] = round(battery_sum / len(battery_data), 2)
ZeroDivisionError: division by zero
2022-05-25 15:54:53 DEBUG (MainThread) [custom_components.enphase_envoy] Finished fetching envoy Envoy ############ data in 3.165 seconds (success: False)

temp solution is to wrap the math on line 78 in a try catch. Fixed it locally on my system,.

Cannot setup integration / connect to the envoy box locally

Hello,
latest HASSIO 9.5 with latest envoy firmware 07.00.88
im assuming i need to check Enlighten which i did and leave password empty with user envoy. as i never set a password i dont even know if i can set user/password somewhere ? i believe we are not talking about the cloud credential here either ?

2023-04-01 03:44:37.544 ERROR (MainThread) [custom_components.enphase_envoy.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/enphase_envoy/config_flow.py", line 150, in async_step_user
    envoy_reader = await validate_input(self.hass, user_input)
  File "/config/custom_components/enphase_envoy/config_flow.py", line 42, in validate_input
    await envoy_reader.getData()
  File "/config/custom_components/enphase_envoy/envoy_reader.py", line 368, in getData
    await self._getEnphaseToken()
  File "/config/custom_components/enphase_envoy/envoy_reader.py", line 261, in _getEnphaseToken
    token_json = await self._fetch_owner_token_json()
  File "/config/custom_components/enphase_envoy/envoy_reader.py", line 246, in _fetch_owner_token_json
    resp_json = resp.json()
  File "/usr/local/lib/python3.10/site-packages/httpx/_models.py", line 756, in json
    return jsonlib.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Gateway setup fails - ZeroDivisionError: division by zero

I am receiving this error when adding the integration\Gateway. I can see in the home-assistant.log file that a valid token is being obtained. I can also see individual inverter data coming in as well as my Enpower smart switch data. Due to this error it appears that no devices are created. I will note that I do not have any batteries in this system as the error seems to indicate that is may be trying to divide the number of batteries (0 in my case).

This error originated from a custom integration.

Logger: custom_components.enphase_envoy
Source: custom_components/enphase_envoy/init.py:78
Integration: Enphase Envoy (DEV)
First occurred: 12:00:50 PM (35 occurrences)
Last logged: 12:38:06 PM

Unexpected error fetching envoy Envoy ENVOYSERIALNUMBER data: division by zero
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 191, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data
return await self.update_method()
File "/config/custom_components/enphase_envoy/init.py", line 78, in async_update_data
data[description.key] = round(battery_sum / len(battery_data), 2)
ZeroDivisionError: division by zero

I have much disconnection with API problems

I am getting then the error message in the home-assistant.log file:

2023-04-06 00:17:04.466 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Envoy 122227045337' for enphase_envoy integration not ready yet: Error communicating with API: Request URL is missing an 'http://' or 'https://' protocol.; Retrying in background

Here a graphic of a day of my current usage with in red my disconnections.

disconnections

Randomly dropping data in HA throughout the day.

My current power production and power consumption sensors are reporting nothing for a period of time multiple times throughout the day. A thread was opened that said this was related to ipv6 but I'm seeing it happening. Let me know what info I need to add to help get this resolved. One thing to note is that each time the data drops the measurement is a floating point number.
HA data solar

Integration broke legacy Envoy (Envoy-R)

I have both a legacy Envoy (Envoy-R) to support my M190 and M215 devices, and an IQ Combiner 4 with IQ Envoy to support my IQ8+ devices.

After installing this integration from HACS, my legacy Envoy stopped working in HomeAssistant.

Screenshots are attached along with log entries.

image

image

image

image

Can't connect to Envoy anymore - no 6 month token?

Hi there.

This was working great for me up until a few days ago. I have changed nothing on my login info and suddenly I'm getting this error and it can't connect to anything.

This error originated from a custom integration.

Logger: custom_components.enphase_envoy
Source: custom_components/enphase_envoy/envoy_reader.py:240
Integration: Enphase Envoy (DEV)
First occurred: 8:13:47 PM (39 occurrences)
Last logged: 8:56:50 PM

Unexpected error fetching envoy Envoy 202149140517 data: Could not get 6 month token: You need to sign in first
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 191, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data
return await self.update_method()
File "/config/custom_components/enphase_envoy/init.py", line 50, in async_update_data
await envoy_reader.getData()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 359, in getData
await self._getEnphaseToken()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 252, in _getEnphaseToken
token_json = await self._fetch_owner_token_json()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 240, in _fetch_owner_token_json
raise Exception("Could not get 6 month token: " + msg)
Exception: Could not get 6 month token: You need to sign in first

Retrying serup : 0

After upgrading from HACS I started to get this error. I was previously able to connect without problems. Logs shows the following:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 239, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 195, in _async_update_data
return await self.update_method()
File "/config/custom_components/enphase_envoy/init.py", line 62, in async_update_data
battery_data = await envoy_reader.battery_storage()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 730, in battery_storage
if len(ensemble_json) > 0 and "devices" in ensemble_json[0].keys():
KeyError: 0

Any reason why I suddenly get this error? Cheers!

Long term (6 months) JWT token

Hi,

first I want to thank you for creating this form for the newer Envoy local APIs and that nonsensical custom authentication scheme they rolled out. I've used it locally in my Home Assistant setup. While I was researching the topic, I found out that there is a way to grab a token that lasts more than 1h and it's very similar to what you have, albeit with a slightly different web flow (but very close to the form POST that you do today).

I copy pasted some code here if you want to check it out. I would write a PR but I don't know Python/HomeAssitant well.

In essence, it's a similar web flow that you can experience by going to: https://enlighten.enphaseenergy.com/entrez-auth-token?serial_num=SERIALNUMBER - If you don't want to have the user input the serial number (in addition to Enlighten Credentials) on setup, maybe this provides a way to find the serial through ZeroConf/mDNS.

Wh metrics are 0 and but W metrics are filled, so Energy Dashboard shows nothing coming from Solar

First off, thank you for your custom integration, it's the only one I could find (Home Assistant or otherwise) that implements the (@#$*! JWT token system.

I have been able to connect to my Emphases Envoy Gateway and from what I can see in the HE logs, it's successfully connecting and getting the information it needs. However (and per this issue response), when I am using "Envoy 202206107334 Today's Energy Production", it (and other Wh) based metrics are all 0 (while the W based metrics are not).

image

Here is the JSON captured by your integration as displayed in the HE logs:

{
    "production": [
        {
            "type": "inverters",
            "activeCount": 34,
            "readingTime": 1655831513,
            "wNow": 10168,
            "whLifetime": 498808
        },
        {
            "type": "eim",
            "activeCount": 0,
            "measurementType": "production",
            "readingTime": 1655831527,
            "wNow": -10015.072,
            "whLifetime": 0.0,
            "varhLeadLifetime": 0.0,
            "varhLagLifetime": 0.0,
            "vahLifetime": 0.0,
            "rmsCurrent": 78.117,
            "rmsVoltage": 256.955,
            "reactPwr": 35.634,
            "apprntPwr": 10037.038,
            "pwrFactor": -1.0,
            "whToday": 0.0,
            "whLastSevenDays": 0.0,
            "vahToday": 0.0,
            "varhLeadToday": 0.0,
            "varhLagToday": 0.0
        }
    ],
    "consumption": [
        {
            "type": "eim",
            "activeCount": 0,
            "measurementType": "total-consumption",
            "readingTime": 1655831527,
            "wNow": -10015.072,
            "whLifetime": 0.0,
            "varhLeadLifetime": 0.0,
            "varhLagLifetime": 0.0,
            "vahLifetime": 0.0,
            "rmsCurrent": 78.487,
            "rmsVoltage": 256.967,
            "reactPwr": -35.634,
            "apprntPwr": 20168.729,
            "pwrFactor": -0.5,
            "whToday": 0.0,
            "whLastSevenDays": 0.0,
            "vahToday": 0.0,
            "varhLeadToday": 0.0,
            "varhLagToday": 0.0
        },
        {
            "type": "eim",
            "activeCount": 0,
            "measurementType": "net-consumption",
            "readingTime": 1655831527,
            "wNow": 0.0,
            "whLifetime": 0.0,
            "varhLeadLifetime": 0.0,
            "varhLagLifetime": 0.0,
            "vahLifetime": 0.0,
            "rmsCurrent": 0.371,
            "rmsVoltage": 256.98,
            "reactPwr": 0.0,
            "apprntPwr": 47.732,
            "pwrFactor": 0.0,
            "whToday": 0,
            "whLastSevenDays": 0,
            "vahToday": 0,
            "varhLeadToday": 0,
            "varhLagToday": 0
        }
    ],
    "storage": [
        {
            "type": "acb",
            "activeCount": 0,
            "readingTime": 0,
            "wNow": 0,
            "whNow": 0,
            "state": "idle"
        }
    ]
}

As you can see, whLifetime seems correct (498 kWh or so) but whToday (I think that's where you read the kWh for today from) is 0. Any idea why that would be?

I am on software version of D7.0.85 (e269f2)

Today's production

The energy Today's production doenst work. Is it an configuration in my home assistant that could be wrong?

Cannot login to API

Is there a new issue with this plugin and the new HA core? I just updated HA core and it stopped working it says it cannot authenticate with Enlighten

This error originated from a custom integration.

Logger: custom_components.enphase_envoy.config_flow
Source: custom_components/enphase_envoy/envoy_reader.py:238
Integration: Enphase Envoy (DEV)
First occurred: 9:49:30 AM (2 occurrences)
Last logged: 9:50:25 AM

Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/enphase_envoy/config_flow.py", line 166, in async_step_user
envoy_reader = await validate_input(self.hass, user_input)
File "/config/custom_components/enphase_envoy/config_flow.py", line 45, in validate_input
await envoy_reader.getData()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 367, in getData
await self._getEnphaseToken()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 260, in _getEnphaseToken
self._token = await self._fetch_owner_token_json()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 238, in _fetch_owner_token_json
raise Exception("Could not Authenticate via Enlighten auth form")
Exception: Could not Authenticate via Enlighten auth form

This error originated from a custom integration.

Logger: custom_components.enphase_envoy.config_flow
Source: custom_components/enphase_envoy/envoy_reader.py:240
Integration: Enphase Envoy (DEV)
First occurred: 9:50:04 AM (3 occurrences)
Last logged: 9:52:37 AM

Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/enphase_envoy/config_flow.py", line 166, in async_step_user
envoy_reader = await validate_input(self.hass, user_input)
File "/config/custom_components/enphase_envoy/config_flow.py", line 45, in validate_input
await envoy_reader.getData()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 367, in getData
await self._getEnphaseToken()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 260, in _getEnphaseToken
self._token = await self._fetch_owner_token_json()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 240, in _fetch_owner_token_json
response_data = json.loads(resp.text)
File "/usr/local/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Integration configuration fails with 'Retrying setup: 0'

Have tried a few times to move from the official Envoy integration to this one, and each time the integration fails to complete setup. The integration status shows as Retrying Setup: 0

Logs show:

Unexpected error fetching envoy Envoy 122121001072 data: 0
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/enphase_envoy/__init__.py", line 63, in async_update_data
    battery_data = await envoy_reader.battery_storage()
  File "/config/custom_components/enphase_envoy/envoy_reader.py", line 721, in battery_storage
    if len(ensemble_json) > 0 and "devices" in ensemble_json[0].keys():
KeyError: 0

No titles in configuration screen when using dutch (nl) language

Image-1331

When configuring the enphase envoy there's no labels in the configuration screen, I'm using Dutch (nl) locale.

The customization itself is working fine for my envoy installed in February and running version D.7.0.88 software. It's providing all data needed for the energy dashboard and handling the new token mechanism very well, thanks for that!

After a bit of a search I found the meaning of the fields and was able to configure. But I guess the translations are not being picked up for some reason. The dutch file nl.json in the translation folder was missing some translations, but these were hard-coded in the strings.json anyway, adding these did not solve it.

I've tested this with all released HA versions since February on both HA in Docker and HA in HA Os in vmware player. Both behave the same. Might be overlooking something and I can test as needed.

Last Seven Days Production now matches Lifetime production

On Sun Apr 23, the last seven days production entity now matches the lifetime production value for one of my two IQ Gateways. It jumped 1.5mwh overnight ;)

I'm running version 0.0.10 with the latest everything in Home Assistant and firmware D7.3.120 on the IQ Gateway.

This has been the setup ever since I first got everything up and running back in mid February. It's been running flawlessly since then.

image
image

Can you configure through the web page?

When I attempt to add this integration I get the following error message:

"This integration does not support configuration via the UI. If you followed this link from the Home Assistant website, make sure you run the latest version of Home Assistant."

Is this the expected result?

My Home Assistant version is 2022.9.5 and my Frontend is listed as : 20220907.2 - latest

Divide by zero error?

I was attempting to troubleshoot something else when I went into me HA logs and realized this component is having fits. I have one of the newer enphase systems that uses sunlight backup but no batteries. I'm guessing that's why the "storage type" is "ac b". Is this making the code think I have batteries and then doing a divide by 0? Also, please don't mind there being no production on this system. It's been installed 3 weeks and I'm still waiting on the utility to change my meter and let me connect to the grid.

2023-01-13 09:57:03.368 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Checking Token value: eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg
2023-01-13 09:57:03.368 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Token is populated: eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg
2023-01-13 09:57:03.368 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Token expires at: 2024-01-13 03:04:46
2023-01-13 09:57:03.368 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: https://192.168.1.60/production.json: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg'}
2023-01-13 09:57:05.541 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Fetched from https://192.168.1.60/production.json: <Response [200 OK]>: {"production":[{"type":"inverters","activeCount":40,"readingTime":0,"wNow":0,"whLifetime":87},{"type":"eim","activeCount":1,"measurementType":"production","readingTime":1673629032,"wNow":0.0,"whLifetime":390.925,"varhLeadLifetime":46.389,"varhLagLifetime":936.073,"vahLifetime":24697.283,"rmsCurrent":0.28,"rmsVoltage":244.647,"reactPwr":0.0,"apprntPwr":33.778,"pwrFactor":0.0,"whToday":0.925,"whLastSevenDays":0.925,"vahToday":330.283,"varhLeadToday":1.389,"varhLagToday":2.073}],"consumption":[{"type":"eim","activeCount":1,"measurementType":"total-consumption","readingTime":1673629032,"wNow":549.297,"whLifetime":2936714.393,"varhLeadLifetime":67123.278,"varhLagLifetime":78251.217,"vahLifetime":3003677.23,"rmsCurrent":5.419,"rmsVoltage":244.692,"reactPwr":-218.942,"apprntPwr":1325.897,"pwrFactor":0.41,"whToday":28344.393,"whLastSevenDays":624447.393,"vahToday":29210.23,"varhLeadToday":993.278,"varhLagToday":858.217},{"type":"eim","activeCount":1,"measurementType":"net-consumption","readingTime":1673629032,"wNow":549.297,"whLifetime":2936362.039,"varhLeadLifetime":67076.889,"varhLagLifetime":77315.144,"vahLifetime":3003677.23,"rmsCurrent":5.139,"rmsVoltage":244.738,"reactPwr":-218.942,"apprntPwr":629.887,"pwrFactor":0.88,"whToday":0,"whLastSevenDays":0,"vahToday":0,"varhLeadToday":0,"varhLagToday":0}],"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle"}]}
2023-01-13 09:57:05.543 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: https://192.168.1.60/ivp/ensemble/inventory: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg'}
2023-01-13 09:57:05.836 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Fetched from https://192.168.1.60/ivp/ensemble/inventory: <Response [200 OK]>: [
    {
        "type": "ENCHARGE",
        "devices": []
    },
    {
        "type": "ENPOWER",
        "devices": [
            {
                "part_num": "865-00376-r29",
                "installed": 1673464750,
                "serial_num": "MySerialNumber",
                "device_status": [
                    "envoy.global.ok",
                    "prop.done"
                ],
                "last_rpt_date": 1673628959,
                "admin_state": 24,
                "admin_state_str": "ENPWR_STATE_OPER_CLOSED",
                "created_date": 1673464750,
                "img_load_date": 1673464750,
                "img_pnum_running": "2.0.4780_rel/22.10",
                "zigbee_dongle_fw_version": "100F",
                "operating": true,
                "communicating": true,
                "temperature": 53,
                "comm_level_sub_ghz": 4,
                "comm_level_2_4_ghz": 4,
                "mains_admin_state": "closed",
                "mains_oper_state": "closed",
                "Enpwr_grid_mode": "grid-tied",
                "Enchg_grid_mode": "multimode-ongrid",
                "Enpwr_relay_state_bm": 15664,
                "Enpwr_curr_state_id": 16
            }
�      
]
    }
]
2023-01-13 09:57:05.837 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: https://192.168.1.60/home.json: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg'}
2023-01-13 09:57:09.749 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Fetched from https://192.168.1.60/home.json: <Response [200 OK]>: {"software_build_epoch":1665679533,"is_nonvoy":false,"db_size":7778304,"db_percent_full":"  2.06","timezone":"US/Mountain","current_date":"01/13/2023","current_time":"09:57","network":{"web_comm":true,"ever_reported_to_enlighten":true,"last_enlighten_report_time":1673628803,"primary_interface":"wlan0","interfaces":[{"signal_strength":20,"signal_strength_max":31,"network":true,"type":"cellular","interface":"ppp0","dhcp":true,"ip":"100.73.191.195","carrier":true},{"type":"ethernet","interface":"eth0","mac":"00:1D:C0:B8:39:13","dhcp":true,"ip":"169.254.120.1","signal_strength":0,"signal_strength_max":1,"carrier":false},{"signal_strength":3,"signal_strength_max":5,"type":"wifi","interface":"wlan0","mac":"20:D7:78:C2:6F:BA","dhcp":true,"ip":"192.168.1.60","carrier":true,"supported":true,"present":true,"configured":true,"status":"connected"}]},"tariff":"none","comm":{"num":1,"level":0,"pcu":{"num":0,"level":0},"acb":{"num":0,"level":0},"nsrb":{"num":0,"level":0},"esub":{"num":1,"level":5},"encharge":[{"num":0,"level":0,"level_24g":0,"level_subg":0}]},"alerts":[],"update_status":"not-satisfied","wireless_connection":[{"signal_strength":0,"signal_strength_max":0,"type":"zigbee","connected":true},{"signal_strength":0,"signal_strength_max":0,"type":"subghz","connected":true}],"enpower":{"connected":true,"grid_status":"closed"}}
2023-01-13 09:57:09.750 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: https://192.168.1.60/api/v1/production/inverters: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg'}
2023-01-13 09:57:09.983 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Fetched from https://192.168.1.60/api/v1/production/inverters: <Response [200 OK]>: [
  {
    "serialNumber": "202218100716",
    "lastReportDate": 1671059892,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202219042158",
    "lastReportDate": 1671060044,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219043076",
    "lastReportDate": 1671059902,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219066898",
    "lastReportDate": 1671059905,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124102",
    "lastReportDate": 1671059911,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124112",
    "lastReportDate": 1671059914,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219124544",
    "lastReportDate": 1671059915,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124593",
    "lastReportDate": 1671059919,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124964",
    "lastReportDate": 1671059923,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219125397",
    "lastReportDate": 1671060086,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219125472",
    "lastReportDate": 1671060088,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219125531",
    "lastReportDate": 1671059932,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219127756",
    "lastReportDate": 1671059938,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219128312",
    "lastReportDate": 1671059941,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219131561",
    "lastReportDate": 1671059944,
    "devType": 1,
    "lastReportWatts": 4,
    "maxReportWatts": 4
  },
  {
    "serialNumber": "202219132160",
    "lastReportDate": 1671059949,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219133917",
    "lastReportDate": 1671059951,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219133923",
    "lastReportDate": 1671060091,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219137190",
    "lastReportDate": 1671059959,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219137225",
    "lastReportDate": 1671060092,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219139066",
    "lastReportDate": 1671059966,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219139187",
    "lastReportDate": 1671059967,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221037625",
    "lastReportDate": 1671059970,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221037790",
    "lastReportDate": 1671059181,
    "devType": 1,
    "lastReportWatts": 1,
    "maxReportWatts": 1
  },
  {
    "serialNumber": "202221037815",
    "lastReportDate": 1671059975,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221041871",
    "lastReportDate": 1671059978,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202221041934",
    "lastReportDate": 1671059983,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221042811",
    "lastReportDate": 1671060097,
    "devType": 1,
    "lastReportWatts": 1,
    "maxReportWatts": 1
  },
  {
    "serialNumber": "202221043902",
    "lastReportDate": 1671060099,
    "devType": 1,
    "lastReportWatts": 2,
    "maxReportWatts": 2
  },
  {
    "serialNumber": "202221044077",
    "lastReportDate": 1671060101,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221044331",
    "lastReportDate": 1671060104,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044502",
    "lastReportDate": 1671060106,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044733",
    "lastReportDate": 1671060109,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202221044762",
    "lastReportDate": 1671060111,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221044767",
    "lastReportDate": 1671060113,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044768",
    "lastReportDate": 1671060115,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202221044778",
    "lastReportDate": 1671060117,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202221044782",
    "lastReportDate": 1671060121,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221045009",
    "lastReportDate": 1671060123,
    "devType": 1,
    "lastReportWatts": 2,
    "maxReportWatts": 2
  },
  {
    "serialNumber": "202221045503",
    "lastReportDate": 1671060127,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  }
]
2023-01-13 09:57:09.983 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Fetched from https://192.168.1.60/api/v1/production/inverters: <Response [200 OK]>: [
  {
    "serialNumber": "202218100716",
    "lastReportDate": 1671059892,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202219042158",
    "lastReportDate": 1671060044,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219043076",
    "lastReportDate": 1671059902,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219066898",
    "lastReportDate": 1671059905,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124102",
    "lastReportDate": 1671059911,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124112",
    "lastReportDate": 1671059914,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219124544",
    "lastReportDate": 1671059915,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124593",
    "lastReportDate": 1671059919,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124964",
    "lastReportDate": 1671059923,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219125397",
    "lastReportDate": 1671060086,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219125472",
    "lastReportDate": 1671060088,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219125531",
    "lastReportDate": 1671059932,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219127756",
    "lastReportDate": 1671059938,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219128312",
    "lastReportDate": 1671059941,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219131561",
    "lastReportDate": 1671059944,
    "devType": 1,
    "lastReportWatts": 4,
    "maxReportWatts": 4
  },
  {
    "serialNumber": "202219132160",
    "lastReportDate": 1671059949,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219133917",
    "lastReportDate": 1671059951,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219133923",
    "lastReportDate": 1671060091,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219137190",
    "lastReportDate": 1671059959,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219137225",
    "lastReportDate": 1671060092,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219139066",
    "lastReportDate": 1671059966,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219139187",
    "lastReportDate": 1671059967,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221037625",
    "lastReportDate": 1671059970,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221037790",
    "lastReportDate": 1671059181,
    "devType": 1,
    "lastReportWatts": 1,
    "maxReportWatts": 1
  },
  {
    "serialNumber": "202221037815",
    "lastReportDate": 1671059975,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221041871",
    "lastReportDate": 1671059978,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202221041934",
    "lastReportDate": 1671059983,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221042811",
    "lastReportDate": 1671060097,
    "devType": 1,
    "lastReportWatts": 1,
    "maxReportWatts": 1
  },
  {
    "serialNumber": "202221043902",
    "lastReportDate": 1671060099,
    "devType": 1,
    "lastReportWatts": 2,
    "maxReportWatts": 2
  },
  {
    "serialNumber": "202221044077",
    "lastReportDate": 1671060101,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221044331",
    "lastReportDate": 1671060104,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044502",
    "lastReportDate": 1671060106,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044733",
    "lastReportDate": 1671060109,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202221044762",
    "lastReportDate": 1671060111,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221044767",
    "lastReportDate": 1671060113,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044768",
    "lastReportDate": 1671060115,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202221044778",
    "lastReportDate": 1671060117,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202221044782",
    "lastReportDate": 1671060121,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221045009",
    "lastReportDate": 1671060123,
    "devType": 1,
    "lastReportWatts": 2,
    "maxReportWatts": 2
  },
  {
    "serialNumber": "202221045503",
    "lastReportDate": 1671060127,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  }
]
2023-01-13 09:57:09.985 DEBUG (MainThread) [custom_components.enphase_envoy] Retrieved data from API: {'production': 0, 'daily_production': 0, 'seven_days_production': 0, 'lifetime_production': 390, 'consumption': 549, 'daily_consumption': 28344, 'seven_days_consumption': 624447, 'lifetime_consumption': 2936714, 'inverters_production': {'202218100716': [5, '2022-12-14 16:18:12'], '202219042158': [6, '2022-12-14 16:20:44'], '202219043076': [6, '2022-12-14 16:18:22'], '202219066898': [8, '2022-12-14 16:18:25'], '202219124102': [8, '2022-12-14 16:18:31'], '202219124112': [6, '2022-12-14 16:18:34'], '202219124544': [8, '2022-12-14 16:18:35'], '202219124593': [8, '2022-12-14 16:18:39'], '202219124964': [8, '2022-12-14 16:18:43'], '202219125397': [6, '2022-12-14 16:21:26'], '202219125472': [7, '2022-12-14 16:21:28'], '202219125531': [7, '2022-12-14 16:18:52'], '202219127756': [6, '2022-12-14 16:18:58'], '202219128312': [7, '2022-12-14 16:19:01'], '202219131561': [4, '2022-12-14 16:19:04'], '202219132160': [8, '2022-12-14 16:19:09'], '202219133917': [7, '2022-12-14 16:19:11'], '202219133923': [7, '2022-12-14 16:21:31'], '202219137190': [7, '2022-12-14 16:19:19'], '202219137225': [7, '2022-12-14 16:21:32'], '202219139066': [7, '2022-12-14 16:19:26'], '202219139187': [6, '2022-12-14 16:19:27'], '202221037625': [3, '2022-12-14 16:19:30'], '202221037790': [1, '2022-12-14 16:06:21'], '202221037815': [3, '2022-12-14 16:19:35'], '202221041871': [7, '2022-12-14 16:19:38'], '202221041934': [3, '2022-12-14 16:19:43'], '202221042811': [1, '2022-12-14 16:21:37'], '202221043902': [2, '2022-12-14 16:21:39'], '202221044077': [3, '2022-12-14 16:21:41'], '202221044331': [6, '2022-12-14 16:21:44'], '202221044502': [6, '2022-12-14 16:21:46'], '202221044733': [7, '2022-12-14 16:21:49'], '202221044762': [3, '2022-12-14 16:21:51'], '202221044767': [6, '2022-12-14 16:21:53'], '202221044768': [5, '2022-12-14 16:21:55'], '202221044778': [5, '2022-12-14 16:21:57'], '202221044782': [3, '2022-12-14 16:22:01'], '202221045009': [2, '2022-12-14 16:22:03'], '202221045503': [5, '2022-12-14 16:22:07']}, 'batteries': {}, 'grid_status': 'closed'}
2023-01-13 09:57:09.985 DEBUG (MainThread) [custom_components.enphase_envoy] Finished fetching envoy Envoy 202239051596 data in 6.617 seconds (success: True)
2023-01-13 09:57:12.570 ERROR (Recorder) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 316, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 121, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 381, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 556, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 597, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 562, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 855, in state
    value = self.native_value
  File "/config/custom_components/enphase_envoy/sensor.py", line 365, in native_value
    return round(battery_sum / len(batteries), 2)
ZeroDivisionError: division by zero

Can I request addition of on-grid vs off-grid state?

Thank you for providing this excellent integration.

The instantaneous on-grid or off-grid state is available in the /ivp/ensemble/inventory URL, in an "ENPOWER" block that's below the "ENCHARGE" battery info. Would it be possible to add a sensor for this, reading either the "admin_state_str" or "Enpwr_grid_mode" variables?

This is what that block looks like when on-grid:

        "type": "ENPOWER",
        "devices": [
            {
                "part_num": "860-00376-r33",
                "installed": 1655021043,
                "serial_num": "122202056375",
                "device_status": [
                    "envoy.global.ok",
                    "prop.done"
                ],
                "last_rpt_date": 1655125519,
                "admin_state": 24,
                "admin_state_str": "ENPWR_STATE_OPER_CLOSED",
                "created_date": 1655021043,
                "img_load_date": 1655021043,
                "img_pnum_running": "2.0.4134_rel/21.21",
                "zigbee_dongle_fw_version": "100D",
                "operating": true,
                "communicating": true,
                "temperature": 81,
                "comm_level_sub_ghz": 5,
                "comm_level_2_4_ghz": 5,
                "mains_admin_state": "closed",
                "mains_oper_state": "closed",
                "Enpwr_grid_mode": "multimode-ongrid",
                "Enchg_grid_mode": "multimode-ongrid",
                "Enpwr_relay_state_bm": 15856,
                "Enpwr_curr_state_id": 16
            }
        ]

and this is when offgrid:

        "type": "ENPOWER",
        "devices": [
            {
                "part_num": "860-00376-r33",
                "installed": 1655021043,
                "serial_num": "122202056375",
                "device_status": [
                    "envoy.global.ok",
                    "prop.done"
                ],
                "last_rpt_date": 1655156216,
                "admin_state": 21,
                "admin_state_str": "ENPWR_STATE_OPER_NO_GRID",
                "created_date": 1655021043,
                "img_load_date": 1655021043,
                "img_pnum_running": "2.0.4134_rel/21.21",
                "zigbee_dongle_fw_version": "100D",
                "operating": true,
                "communicating": true,
                "temperature": 103,
                "comm_level_sub_ghz": 5,
                "comm_level_2_4_ghz": 5,
                "mains_admin_state": "closed",
                "mains_oper_state": "open",
                "Enpwr_grid_mode": "multimode-offgrid",
                "Enchg_grid_mode": "multimode-offgrid",
                "Enpwr_relay_state_bm": 243,
                "Enpwr_curr_state_id": 256
            }
        ]

Could not get 6 month token: You need to sign in first - on 2023.1.6

Getting this error after upgrading to the latest HA - Tried removing and reinstalling integration and it says it finishes but still get this error:

Logger: custom_components.enphase_envoy
Source: custom_components/enphase_envoy/envoy_reader.py:249
Integration: Enphase Envoy (DEV)
First occurred: January 21, 2023 at 12:26:06 AM (475 occurrences)
Last logged: 12:29:31 PM

Unexpected error fetching envoy Envoy ####### data: Could not get 6 month token: You need to sign in first
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 181, in _async_update_data
return await self.update_method()
File "/config/custom_components/enphase_envoy/init.py", line 49, in async_update_data
await envoy_reader.getData()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 368, in getData
await self._getEnphaseToken()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 261, in _getEnphaseToken
token_json = await self._fetch_owner_token_json()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 249, in _fetch_owner_token_json
raise Exception("Could not get 6 month token: " + msg)
Exception: Could not get 6 month token: You need to sign in first

Sensors won't appear in solar panel dropdown field on Energy config page

Hi,

I just did a fresh installation of this repository in my HA.
Looking at the device and entities all data seem to be updating which is nice.

See screenshot:
image

Next step would be to setup the Energy config page, but when trying to configure solar panels in the pop-up. The dropdown field doesn't show the sensors.

See screenshot:
image

Am I missing something or am I facing a bug here?

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.