Need testers for updated Enphase Envoy sensor

another update
it is not updating after first boot. I marked the REST sensor, which does update.
image

this is my config

- platform: enphase_envoy
  name: Enphase_new
  username: !secret string_18
  password: !secret string_19
  ip_address: 192.168.1.70
  scan_interval: 60
  monitored_conditions:
    - production
    - daily_production
    - seven_days_production
    - lifetime_production
    - inverters

I fixed a typo in the sensor code relating to the polling interval. The updated code is located here sensor.py.

Can you try out the updated sensor.py code?

EDIT: What I have noticed with the updated code I mentioned above, is that if the value retrieved from the Envoy device is the same as the last value than Home Assistant does not update the value or time since it was last retrieved. For example I have an older Envoy device which updates only every 15minutes. Even though I have Home Assistant poll every 1 minutes (60 seconds in the config) the data in Home Assistant only shows updates about every 15 minutes. So it seems Home Assistant (with my updated code) will only show an update if it has retrieved an updated value from the Envoy, which can be anywhere between 5 to 15 minutes based on the model of your Envoy device. I’ll look into that not sure if it’ll effect any calculations you maybe doing.

1 Like

hi, I downloaded te new sensor.py. I can tell you tomorrow if it updates correctly again. :smiley: too dark to see anything more than 0W. :stuck_out_tongue:

I will give an update tomorrow

1 Like

I think it is working fine now, based on the picture below.
I do see a very small delay (which is not a problem of course) compared to REST sensor. Seems like the REST sensor is faster. is it lighter or something than the Enphase integration? Just wondering :slight_smile:

In the picture below, in the graph, the lines of REST and Enphase integration are ontop of eachother.

PS
You are right. I do see as well sensors sometimes not updating if the value is the same. :+1:

Great! Thank you for the update. The REST sensor is lighter weight. Even though I have reduced some of the calls made from Home Assistant to the API in this code there are more improvements that need to be made on the API side. Which is actually being worked on now. I’ve reduced one of the main calls dramatically in this envoy_reader PR. Even though the PR talks about polling pages based on the Metering setup, there is an enhancement made to reduce polling.

“The PR also includes a reduction in HTTP calls that are made to the production pages to retrieve the data.”

So hopefully with this change in the Home Assistant sensor code and the changes on the API side, the speed should be the same as the REST sensor.

1 Like

Great. Good to read. If you need someone to test some more, just give me a nudge.

1 Like

Stumbled onto this post. I just started to include my envoy, the the communication is sporadic and not continuous, its an older model envoy from 2017 ENV-S-AB-120-A. Is there a setting I need to adjust? The data history has 2 hour gaps, very annoying! I really don’t see an API as I am connecting locally via LAN IP.

- platform: enphase_envoy
  name: Solar
  ip_address: XXX.XXX.XX.XX (private)
  monitored_conditions:
    - production
    - daily_production
    - seven_days_production
    - lifetime_production

EDIT: disregard, google wifi mesh network issue. Love the integration BTW, thanks for all the hard work!

1 Like

Hi, any plans to add phase information to this?

I have a Envoy-S Metered 3phase system and I would love to have the information added for the “per phase” data.
This can be extracted from the installer page, but for that you need to have an installer login. Maybe there is another way.
Anyhow, running:
curl --anyauth --user installer:pass http://192.168.1.65/stream/meter

outputs a stream of data:

data: {"production":{"ph-a":{"p":5.953,"q":85.77,"s":86.864,"v":227.468,"i":0.381,"pf":0.06,"f":50.0},"ph-b":{"p":4.48,"q":79.023,"s":79.023,"v":222.525,"i":0.356,"pf":0.07,"f":50.0},"ph-c":{"p":5.107,"q":70.649,"s":97.889,"v":223.626,"i":0.438,"pf":0.06,"f":50.0}},"net-consumption":{"ph-a":{"p":326.534,"q":-194.884,"s":428.075,"v":227.55,"i":1.881,"pf":0.77,"f":50.0},"ph-b":{"p":42.295,"q":-68.316,"s":92.793,"v":222.464,"i":0.418,"pf":0.47,"f":50.0},"ph-c":{"p":125.388,"q":-229.094,"s":279.196,"v":223.345,"i":1.25,"pf":0.45,"f":50.0}},"total-consumption":{"ph-a":{"p":332.487,"q":-280.655,"s":514.554,"v":227.509,"i":2.262,"pf":0.65,"f":50.0},"ph-b":{"p":46.775,"q":-147.34,"s":172.139,"v":222.495,"i":0.774,"pf":0.27,"f":50.0},"ph-c":{"p":130.496,"q":-299.744,"s":377.25,"v":223.486,"i":1.688,"pf":0.35,"f":50.0}}}

Which corresponds to this (this is not the data from the exact same time):

More information on this on this brilliant page:

More on the installer password here:

Sadly my skills are not sufficiënt to code this myself :frowning:

@michel72 If the current pages that the API polls contains the 3 phase info than it might be possible.

The pages that are retrieved from the API are
/api/v1/production
/production.json

It may not contain the live stream data but if the pages contain the phase data and behave like the other Envoys than data is updated every 5 to 15 minutes for individual inverters and 5 mins or less for the total Production and Consumption values

Yes, but this page only contains the data of the sum of all phases. Better then nothing though👍

For anyone interested, I have a really hacky way of getting this individual phase data into home assistant. I would much prefer Greg’s integration to support production and consumption values (sums), so when that gets done, I’ll use that :slight_smile:

For now:

shell_command:
  envoy_phase_data: 'bash /config/include/curl/envoy_phase_data.sh'

envoy_phase_data.sh

#!/bin/bash
timeout 15 curl --silent --anyauth --user installer:PASSWORD http://192.168.1.65/stream/meter | sed 's,data,{"data",g' | sed 's,}}},}}}},g' | head -1 > /config/www/enphase/stream.json
sensor:
  - platform: enphase_envoy
    name: Envoy-S metered
    ip_address: 192.168.1.65
    username: installer
    password: PASSWORD
    monitored_conditions:
      - production
      - daily_production
      - seven_days_production
      - lifetime_production
      - consumption
      - daily_consumption
      - seven_days_consumption
      - lifetime_consumption
      - inverters

  - platform: rest
    name: Enphase productie fase 1
    resource: https://https://your_HA_instance:8123/local/enphase/stream.json
    scan_interval: 30
    verify_ssl: false
    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

  - platform: rest
    name: Enphase productie fase 2
    resource: https://https://your_HA_instance:8123/local/enphase/stream.json
    scan_interval: 30
    verify_ssl: false
    value_template: "{{ (value_json['data']['production']['ph-b']['p'] | float / 1000) | round(2) }}"
    unit_of_measurement: 'kWh'
    json_attributes_path: $['data']['production']['ph-b']
    json_attributes:
      - f
      - i
      - q
      - p
      - s
      - pf
      - v
  - platform: rest
    name: Enphase productie fase 3
    resource: https://your_HA_instance:8123/local/enphase/stream.json
    scan_interval: 30
    verify_ssl: false
    value_template: "{{ (value_json['data']['production']['ph-c']['p'] | float / 1000) | round(2) }}"
    unit_of_measurement: 'kWh'
    json_attributes_path: $['data']['production']['ph-c']
    json_attributes:
      - f
      - i
      - q
      - p
      - s
      - pf
      - v
automation:
  - id: get_envoy_phase_data
    alias: get envoy phase data
    trigger:
    - seconds: '/30'
      platform: time_pattern
    action:
      service: shell_command.envoy_phase_data

I hope someone can help me :slight_smile:

This is my config:

sensor:
  - platform: enphase_envoy
    name: Envoy-S metered
    ip_address: 192.168.1.65
    username: installer
    password: PASSWORD
    monitored_conditions:
      - production
      - daily_production
      - seven_days_production
      - lifetime_production
      - consumption
      - daily_consumption
      - seven_days_consumption
      - lifetime_consumption
      - inverters

But I’m not getting the correct inverter information:

But the data seems to be there: http://192.168.1.65/api/v1/production/inverters

[
  {
    "serialNumber": "122022009125",
    "lastReportDate": 1606045464,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 198
  },
  {
    "serialNumber": "122022007165",
    "lastReportDate": 1606045471,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 233
  },
  {
    "serialNumber": "122022010765",
    "lastReportDate": 1606045462,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 200
  },
  {
    "serialNumber": "122022007141",
    "lastReportDate": 1606045467,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 235
  },
  {
    "serialNumber": "122022003320",
    "lastReportDate": 1606045473,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 176
  },

@michel72 I can see from the Home Assistant screenshot that the inverter serial number is retrieved but not the actual data. The older sensor code had this behavior of not populating the data until the second poll. It could be an intermittent problem as the older code did overwhelm some Envoys causing them to not return inverter data sometimes.

Unfortunately it’s hard to debug the older sensor code as there is no logging. Unless something obvious is being printed in the Home Assistant log. You can look in the log.

I think the better solution would be to update the envoy sensor code and associated api library in Home Assistant and see if the problem still exists.

You can get the updated sensor.py and manifest.json here and put them in the homeassistant/components/enphase_envoy directory overwriting the older ones. Than restart Home Assistant and see what the data looks like.

Greg

Hi,

I don’t have a components folder. I put it in custom_components. How should I do this? Just create the components folder?

That should work putting it in the custom_components folder like you did, of course using the sensor.py and manifest.json that I linked to earlier, than restarting the HA server. Earlier in this thread it was mentioned you can do that. I’ve never tried it because I didn’t know you could do that do overwrite existing integrations. Pretty cool!

OK, then I was already running your latest version with the [“envoy_reader==0.16.2”], in the manifest.

I am getting this in my log:

2020-11-25 22:46:51 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022007165 fails

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state

await self.async_device_update()

File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update

raise exc

File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update

self._state = self.coordinator.data.get("inverters_production").get(

TypeError: 'NoneType' object is not subscriptable

2020-11-25 22:46:51 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022010765 fails

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state

await self.async_device_update()

File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update

raise exc

File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update

self._state = self.coordinator.data.get("inverters_production").get(

TypeError: 'NoneType' object is not subscriptable

2020-11-25 22:46:51 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022007141 fails

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state

await self.async_device_update()

File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update

raise exc

File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update

self._state = self.coordinator.data.get("inverters_production").get(

TypeError: 'NoneType' object is not subscriptable

Hardware: Envoy-S Metered:

  • Serial Number xxxxxxxxxxxx
  • Part Number 800-00554-r03
  • Software Version R4.10.35 (6ed292)
  • Software Build Date 13 Nov, 2018 2:57 AM

The manifest I linked to has [“envoy_reader==0.17.0”] should get that one too. Doesn’t really change much, fixes an issue when getting Production values and also a slight change in retrieving pages.

But anyway, can you enable debug in the configuration.yaml and see what the output is? This what I use in my development setup.

logger:
  default: info
  logs:
    homeassistant.components.cloud: debug
    homeassistant.components.enphase_envoy: debug

Yes, that Is what I have in my configuration.

I will try the updated envoy_reader now.

Another thing I noticed, is that my Envoy-S firmware seems to be a lot older then others, even though my Unit has just been installed.

I’m getting the same errors. Just to be sure, can you point me to your latest version? There are so many links here.

2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009125 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022007165 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022010765 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022007141 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022003320 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009897 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022008144 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009149 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009197 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009871 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009122 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009124 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009643 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009395 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009244 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009799 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable
2020-11-25 23:06:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.envoy_s_meteredenvoy_inverter_122022009268 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/enphase_envoy/sensor.py", line 248, in async_update
self._state = self.coordinator.data.get("inverters_production").get(
TypeError: 'NoneType' object is not subscriptable