Need testers for updated Enphase Envoy sensor

@hollapm Yeah if you can run the updated sensor code that would be great. It really only solves the issue where you might see inverter data not being updated sometimes. Even if you don’t have that issue it would be nice to run this code on systems before releasing it.

I looked into how to remove old retired inverters. Given that the envoy device is returning inverters I probably shouldn’t filter out entities based on a time-stamp. What I can do is use Home Assistant’s unique_id property and then you can go into Configuration >> Entities to find the inverter that is retired and you can disable it and remove it from being displayed in HA, that way. How does that sound?

I’ll look into notification of inverters going offline

@DHoefakker That’s interesting I’ve never used the name attribute for the envoy sensor. I’ll look it that. Looking into the code is appears the name is pre-appended to the default sensor name

What type of envoy do you have? When viewing the api info did you use http://ip/api/v1/production? I’m guessing the wattsNow from the browser is different from Home Assistant?

Can you capture some debug output, when the sensors are returning 0 and production is half?

I use a envoy-s
The only line i see in the log is the following warning:
2020-10-29 12:30:13 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.envoy_lifetime_energy_production is taking over 10 seconds

I also added a rest sensor with the same IP and that sensor displays the values from the JSON.
The REST sensor code:

- platform: rest
    name: solar production
    json_attributes:
      - wattHoursToday
      - wattHoursSevenDays
      - wattHoursLifetime
      - wattsNow
    resource: http://LOCAL_IP_FOR_ENVOY/api/v1/production
  - platform: template
    sensors:
      solar_now_kw:
        friendly_name: "Solar current production"
        value_template: "{{ (states.sensor.solar_production.attributes['wattsNow'] | float / 1000 ) | round(3) }}"
        unit_of_measurement: "kW"
      solar_today_kwh:
        friendly_name: "Solar Today"
        value_template: "{{ (states.sensor.solar_production.attributes['wattHoursToday'] | float / 1000 ) | round(1) }}"
        unit_of_measurement: "kWh"
      solar_week_kwh:
        friendly_name: "Solar last 7 days"
        value_template: "{{ (states.sensor.solar_production.attributes['wattHoursSevenDays'] | float / 1000 ) | round(1) }}"
        unit_of_measurement: "kWh"
      solar_lifetime_mwh:
        friendly_name: "Solar Lifetime"
        value_template: "{{ (states.sensor.solar_production.attributes['wattHoursLifetime'] | float / 1000000 ) | round(2) }}"
        unit_of_measurement: "mWh"

this is in the same sensor section as the envoy component config.

@DHoefakker This might be because of an issue with the envoy_reader api. I have opened a PR for it on and the timeout issue should be included in the next HomeAssistant release I think 0.118.

If you don’t want to wait you can make the change yourself but after every HA update (until the fix is merged into HA) you will have to make the same change until the envoy_reader api is updated.

The file that needs to be changed is .../lib/python/site-packages/envoy_reader/envoy_reader.py. Since this path is system dependent you could find the file by doing a search first for envoy_reader.py. In this Issue in Github it says where you need to add the text timeout=30, (yes don’t forget the comma!)

After you make the change, save it, and restart HA the timeout issue should be resolved.

HI,
I just stumbled upon this thread. too bad I just noticed.
I have been annoyed by the fact envoy is limiting the data polling frequency to once per 5 minutes. This is so not 2020. Anyway.

I am unable to see the folder you mention. Inside config I dont have a /components/ folder. I am running HASSIO / HomeAssistant OS, virtually on proxmox. Where do I put this sensor.py?

My info:
HA v117.0
Envoy Type: 800-00553-r02 (Envoy-S-Standard-EU)
16 converters.

Software Version
D5.0.34 (6e87e2)

I have connected it directly to ethernet, to get rid of connection time-out issues through wifi. (stupid they hooked it up like that in the first place anyway… the thing is next to my modem … duh…)
I have admin password and I have installation password of the envoy.
Currently I read the data once per 60 seconds with REST.

So, How can I help :slight_smile: what do you need.

edit:
find / | grep enphase > no reply through putty or addon ssh terminal

I’m not familiar with proxmox but it should act just like most other virtualization software. You might have to ssh into the HomeAssistant VirtualMachine and do run a search for the file. There is probably a better command but I usually run as root 'find / | grep enphase_envoy'

Which pages are you polling on your Envoy for the REST sensor?

I only have an older Envoy device it only updates once every 15mins using the /api/v1/production web page. With newer models a different page is used /production.json which has more info. The inverter production section of that page seems to update anywhere between every 1 to 15mins, I don’t know why. The other section (if you have CT installed) will give you instantaneous information everytime you access the page.

Just only this one.

- platform: rest # Enphase zonneenergie uitlezing (handmatig ipv via api)
  resource: http://192.168.1.70/api/v1/production
  scan_interval:
    seconds: 60
  name: rest_solar_production_now
  value_template: "{{ value_json.wattsNow }}"
  unit_of_measurement: "W"

I am fighting to get the find command to work.

as can be seen in the picture below, mine updates once per 5 minutes. Its te yellow line in the graph. I think it is an older model as well, similar to yours.

You won’t be able to use the command in the Home Assistant CLI. Can you ssh to the HomeAssistant VM IP address using port 22222?

I have came one step closer (I think)

I installed the comunity addon, instead of the regular addon. this is now what I see…
image

THe problem I have is that I find it difficult to get into the folder of HomeAssistant, from the console of Proxmox.
I run Proxmox on a ZFS disk, I have the VM running on there. but getting the mount dir of the local-lvm, I dont seem to get working.
inside proxmos, I find the HA image in /dev/zvol/rpool/data/vm-101-disk-1. But im unable to mount it direclty. fstab error. dont know.

anyway. tomorrow more.

Finally got my envoy connected… I’m seeing results now
image

Curious if there is a settings to convert the unit of measure to kWh instead of W / Wh?

The W and Wh hours are the values coming from the Envoy device. The API doesn’t change the values but you can create a template in Home Assistant converting the measurement to what you want

Here is an example that I use to convert W to kW

sensor:
  - platform: template
      sensors:
        envoy_current_energy_production_kw:
          friendly_name_template: 'Envoy Current Energy Production (kW)'
          unit_of_measurement: 'kW'
          value_template: "{{ (states('sensor.envoy_current_energy_production')| float / 1000| round(2)) }} "
1 Like

Was able to do some tweaking after you provided the template example (THANK YOU for that, very helpful). Here’s what I have now:

I might need to do some additional tweaking on the upper/lower bounds for the graph (mini-graph-card)

1 Like

@DHoefakker took some of your code and refined my output… Think this will work better now

hi,
your card looks good.

question.
how often do you receive data from the envoy?

every few min… seems very close to real-time.

ah, ok.
I have it limited to once / 5 minutes. using REST currently.

I have tried to find that sensor.py, but failed. maybe I will give it an other try if you tell me that the update frequency will be higher using this method instead of rest :slight_smile:

thanks for the update !!

The updated sensor.py code was updating the values every 30 seconds. Probably a little over kill. So I updated the sensor.py code to update every 60 seconds. This can be changed to a higher value if you want such as 120 seconds, by using the scan_interval setting in the envoy sensor section.

Example:

sensor:
  - platform: enphase_envoy
    ip_address: !secret enphase_ip_addr
    username: !secret enphase_user
    password: !secret enphase_pass
    scan_interval: 120
    monitored_conditions:
      - production
      - daily_production
      - seven_days_production
      - lifetime_production
      - inverters

The updated code is located at envoy sensor.py

@fireheadman can you share your cards yaml ?

Great work

I recently learnt one can override the inbuilt integration with custom component. I did it with DSMR sensor. Works like a charm.
Do you maybe have a github link so I can copy the complete envoy component and all files in the custom_components folder?

NEver mind… found it :slight_smile:

I created the folder in custom_components\enphase_envoy
put these files in there: init.py manifest.json and sensor.py

add in configuration.yaml sensor enphase_envoy

- platform: enphase_envoy
  name: Enphase_new
  username: !secret enphase_user
  password: !secret enphase_pass
  ip_address: hidden_ip
  monitored_conditions:
    - production
    - daily_production
    - seven_days_production
    - lifetime_production
    - inverters

and I think it is working. I will need to wait until tomorrow to see numbers flowing :slight_smile: no sun now. gheheh

I will keep you posted.

1 Like

An update.

The integration is working.
But with my envoy does not produce more frequent new data than once per 30 minutes.
The REST sensor I use, gives a new value per 5 minutes.

image