Enphase Envoy Battery reporting

Are there any plans to incorporate the Enphase battery data into the sensor data.

{,“storage”:[{“type”:“acb”,“activeCount”:2,“readingTime”:1567424009,“wNow”:-474,“whNow”:1947,“state”:“charging”,“percentFull”:79}]}

2 Likes

I’m interested in this as well!

@wrightwells

I was able to get the battery information by creating a sensor through Nodered. If you use it, I can share what I did. I only have 1 battery though, but does not seem to be much difference

If anybod stumbles on this, I was able to do this with HA and REST Sensors.

I leave here the example of my configuration:

Secret envoy_json points to http://ip_of_envoy/production.json

rest:
  resource: !secret envoy_json
  scan_interval: 30
  sensor:
    - name: Envoy Battery State
      value_template: '{{ value_json.storage[0].state }}'
      device_class: battery
    - name: Envoy Battery Power Available
      value_template: '{% if value_json.storage[0].wNow > 0 %} {{ value_json.storage[0].wNow }}
      {% else %}
         0
      {% endif %}'
      unit_of_measurement: 'W'
      device_class: battery
    - name: Envoy Battery Power Draw
      value_template: '{{ value_json.storage[0].whNow }}'
      unit_of_measurement: 'Wh'
      device_class: battery
    - name: Envoy Battery Level
      value_template: '{{ value_json.storage[0].percentFull }}'
      unit_of_measurement: '%'
      device_class: battery

This implies you have 1 battery alone, and you can change it to match whatever need you have. Don’t hesitate to ping me if you want more info.

1 Like

I’m adding support to the envoy_reader API which would be exposed in Home Assistant but had a couple of questions at the end of this post:

I have a feeling this isnt right, but id love to work with you to fix it so it works with Homeassistant Energy.

This is mine when discharging.

|storage||

|0||
|type|acb|
|activeCount|2|
|readingTime|1633855938|
|wNow|537|
|whNow|620|
|state|discharging|
|percentFull|25|

When is charging, the state is set to charging, but the wNow value is negative.

Hello dear friend!

I’ve sold my house since my post, my HA is in a cardboard waiting for the new house to appear :smiley:

I’ll have some difficulty for now to help you out.

Regards
Chris

FWIW I’ve only just started playing with Home Assistant and am playing with getting this working. I also am using Amber Energy (in Australia) who have a dynamic wholesale price and decent Home Assistant integration giving a feed of the price.

In my case I’m so far just using the automatic HA Envoy integration which seems to include an inverter sensor sensor.envoy_<ENVOY_SERIAL>_inverter_<INVERTER_SERIAL> that goes to the battery. This sensor gives a negative value when the battery is charging, and a positive value when it is discharging.

I’m still fiddling with this but using the following posts I’m pretty sure I can setup sensors and integrations of that one sensor to give me everything needed for the battery;

When I get this working nicely I’ll post an update.

So I almost have this working.

I’ve added the following to my config.yaml;

template:
  - sensor:
        name: Battery Export Power
        state_class: measurement
        icon: mdi:battery-charging
        unit_of_measurement: W
        device_class: power
        state: >
            {{ [0, states('sensor.envoy_<ENVOY_SERIAL>_inverter_<INVERTER_SERIAL>') | int ] | max }}
  - sensor:
        name: Battery Import Power
        state_class: measurement
        icon: mdi:battery-charging
        unit_of_measurement: W
        device_class: power
        state: >
            {{ [0, 0 - states('sensor.envoy_<ENVOY_SERIAL>_inverter_<INVERTER_SERIAL>') | int ] | max }}
sensor:
  - platform: integration
    name: Battery Export Energy
    source: sensor.battery_export_power
    unit_prefix: k
    unit_time: h
    method: left
  - platform: integration
    name: Battery Import Energy
    source: sensor.battery_import_power
    unit_prefix: k
    unit_time: h
    method: left

This gives me Battery Import and Export power sensors that I can enter in the config for the “Energy Dashboard” (configured under Settings Dashboards). Note I use the default Envoy “Lifetime Energy (Production|Consumption)” sensors for the Electricity Grid settings so I don’t need to configure any custom sensors for that.

I say this is almost working because the data seems a bit choppy. The graphs of the Power sensors over time look mostly correct with a few questionable downward spikes when I know the battery was discharging, but they are a little disturbingly flat which suggests maybe gaps in the sampling. The Energy sensor integrations however look very steppy when they should look like pretty clean ramps for the constant change/discharge powers.

I suspect the envoy sampling is a bit unreliable, and the integration looks wrong… perhaps it’s the method: left that is the problem.

It would be really nice if the envoy exported lifetime battery charged and discharged energy counters, the same as it does for the energy produced/imported. I suspect it probably has that somewhere but its not in the standard envoy integration yet. I’ll have a dig around and see what I can find.

1 Like

Hey dbaarda (Donovan Baarda): Have you had any more success with this integration. I’m new to HA and am looking for ideas and guidance. What have you learned and what is working for you?

Hi! just got my Enphase IQ3T battery system installed. Now I’m trying to figure out which of the entities to use in the energy dashboard… From the Gateway entity I have the following entities:

Which one to use for “Energy going into the battery” and “Energy coming out of the battery”? The numbers when I check in the enlighten app does not makes sense with the figures in HA…

Did you ever figure this out? I am unable to select specific battery entities on the energy page and I think having two envoys due to the size of my system with battery is creating some bad math when I select the one that has the panels tied to the battery only.

Unfortunately not… I have kind of left it where it is at…