Enphase Envoy with Energy Dashboard

Hello! Unfortunately, the server occasionally stops, mine does this randomly too. It restarts on its own after 1-2 hours. It might be happening only with wireless communication. I’ll soon connect it with a LAN cable, I’m curious if it still happens then.

Hmm been like this for 16 hours now. Never had the issue before…

Update: Looks like its working now

@del13r

I have a question, not sure if I can do this. I am getting a new tuya based heat pump with boosting element installed soon and was thinking if I can get real time export info from enphase then I could automate the boosting element to turn on off based on how much energy is being exported. Am I able to get this info or am I dreaming?

Thanks

Hello @Mrsash,
You have come to the right place.
I am doing the same thing for my pool pump.
Here is a basic example of my pool pump automation based on power export being more than how much power my pool pump uses.

alias: Pool Pump On grid export
description: ""
trigger:
  - platform: numeric_state
    above: "1050"
    for:
      hours: 0
      minutes: 2
      seconds: 0
    entity_id: sensor.power_export
condition:
  - condition: state
    entity_id: switch.sonoff_MACADDRESS
    state: "off"
  - condition: sun
    before: sunset
    after: sunrise
action:
  - service: switch.turn_on
    target:
      entity_id: switch.sonoff_MACADDRESS
    data: {}
  - service: notify.notify
    data_template:
      message: >-
        Pool Pump On
mode: single
max: 10

And if it gets cloudy, I have another automation to turn the pool pump off to reduce energy costs

alias: Pool Pump Off grid import
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.power_import
    for:
      hours: 0
      minutes: 4
      seconds: 0
    above: 200
  - platform: state
    entity_id:
      - sun.sun
    attribute: next_setting
condition:
  - condition: state
    state: "on"
    entity_id: switch.sonoff_MACADDRESS
action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.sonoff_MACADDRESS
  - service: notify.notify
    data_template:
      message: >-
        Pool Pump Off
mode: single

Awesome. You might have to explain to me please. Ok maybe I understand a little. The entity
sensor.power_import and sensor.power_export are missing in mine.

Guess I need to test for few things

Turn On:
Water temp under 55C
Time between sunrise + 3 hours and sunset - 2 hours
Power exported above 1800w(for 1.8kw element) for more than a minute etc.

Turn Off:
Temp reaches 60C(heat pump limit)
Export below Zero(cloudy)
Time after sunset - 2 hours and before sunrise + 3 hours

I have 7 people in the house so if I even turn it the element on manually I would need to add an automation to disable the Turn Off: automation on manual mode. Maybe wont complicate it for myself ans just add a button for automation on/off etc

Oh one more question if I may. I tried to make a solar.yaml to split the solar in its own file but failed miserably. I added solar: !include solar.yaml and proceeded to move all sensors I am using for the enphase stuff. Would you by any chance have done this already? For me check config in Dev tools gave an error…

Hi, I have just made an updated guide for Enphase Envoy and Energy Dashboard.
Here is the guide Enphase Envoy on 2024.4
I’ve tried to make it easier for new users by using the GUI rather than editing the configuration.yaml.

I have not attempted moving sensors out of configuration.yaml yet.

Oh you set that up today, wow.

So is this in addition to the minute by minute graph I have setup can all be replicated there etc?
I might need to remind myself how to reverse everything and move it. Or is there an easier route?

I am excited. Thanks for the awesome work again.

Hi @Mrsash

The default Enphase production and consumption sensors are minute by minute, so I’m not sure specifically which sensors/graphs you are referring to.

The guide is focussed on 2 steps.

Step 1 - Getting home assistant to calculate both:
Grid import power
Grid export power
using template sensors to perform calculations using data from the enphase sensors.

Step 2 - Setting up Riemann Sum sensors which convert:
grid import power (W) to grid import energy (kWh)
grid export power (W) to grid export energy (kWh)

Given you are asking about power import and power export sensors being absent, I have to assume you have not set these up yet.

Sorry I meant I have this currently which is working well.

I guess what I was trying to figure out is if the updated guide for Enphase Envoy and Energy Dashboard is a total replacement including the above minute by minute graph?

Ah ok,
This graph is in W, so you have done step 1 which gives you power export and power import (shown in grey in the graph). The names may not be identical but you can adjust them to suit your setup.
If you want to use energy dashboard, you can do step 2 and convert the power sensors you have in the graph into energy sensors.

ok sounds promising. Pretty much have the following in my config.yaml

rest:
  - headers:
      Authorization: !secret enphase_api
    verify_ssl: False
    scan_interval: 15
    resource: https://envoy.local/ivp/meters/readings
    sensor:
      - name: "Power Production"
        value_template: >
          {% set value = value_json[0].activePower | int(0) %}
          {% if value  <= 5 -%}
              0
          {% elif is_state('sun.sun','below_horizon') %}
              0
          {%- else -%}
              {{ value }}
          {%- endif %}
        device_class: power
        unit_of_measurement: W
        state_class: measurement
        icon: mdi:solar-panel
      - name: "Power Net"
        value_template: "{{ value_json[1].activePower | int(0) }}"
        state_class: measurement
        device_class: power
        unit_of_measurement: W
        icon: mdi:transmission-tower

template:
  - sensor:
      - name: Solar Power Corrected
        state_class: measurement
        icon: mdi:solar-panel
        unit_of_measurement: W
        device_class: power
        state: >
          {% set value = states('sensor.envoy_XXXXXXXXXX_current_power_production') | int(0) %}
          {% if value  <= 5 -%}
            0
          {% elif is_state('sun.sun','below_horizon') %}
            0
          {%- else -%}
            {{ value }}
          {%- endif %}

  - sensor:
      - name: Grid Import Power
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state: >
          {{ [0, states('sensor.envoy_XXXXXXXXXX_current_power_consumption') | int(0) - states('sensor.solar_power_corrected') | int(0) ] | max }}

  - sensor:
      - name: Grid Export Power
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state: >
          {{ [0, states('sensor.solar_power_corrected') | int(0) - states('sensor.envoy_XXXXXXXXXX_current_power_consumption') | int(0) ] | max }}

  - sensor:
      - name: Net Power
        state_class: measurement
        unit_of_measurement: W
        device_class: power
        icon: mdi:transmission-tower
        state: >
          {% set production = states('sensor.solar_power_corrected') | int %}
          {% set consumption = states('sensor.envoy_XXXXXXXXXX_current_power_consumption') | int %}
          {{ (production - consumption) }}

sensor:
  - platform: integration
    name: Solar Energy Corrected
    source: sensor.solar_power_corrected
    method: left
    unit_prefix: k
    unit_time: h

  - platform: integration
    name: Grid Import Energy
    source: sensor.grid_import_power
    method: left
    unit_prefix: k
    unit_time: h

  - platform: integration
    name: Grid Export Energy
    source: sensor.grid_export_power
    method: left
    unit_prefix: k
    unit_time: h

utility_meter:
  daily_energy:
    source: sensor.grid_import_energy
    name: Daily Import Meter
    cycle: daily
    tariffs:
      - offpeak
      - shoulder
      - peak
  daily_energy_export:
    source: sensor.grid_export_energy
    name: Daily Export Meter
    cycle: daily
    tariffs:
      - buyback

Your sensor names are:

These sensors are the ones you use in your automations.

My sensor names are:
sensor.power_import
sensor.power_export

Just update the sensor names from mine to yours.

For your Energy Dashboard, you can use these

Import = Grid Consumption
Export = Return to Grid

Oh right so just the names are different

Grid Import Power to your sensor.power_import
Grid Export Power to sensor.power_export

So I just need to substitute with my sensor names, got it

The energy Dash you are referring to is the HA one right? Already have the Dash configured
image

thanks for the help

Once the new heat pump is in I will have it setup with automatons. Cant wait…

1 Like

Hey guys! I found an issue with my data reporting here
image
When the day ticks over, the production doesn’t start at zero, instead it starts at 3.54kWh. Is there anything I can do to fix this? Here’s my energy dashboard


Any help would be appreciated to balance this out. Dunno why it’s doing this, it happened after my Envoy firmware got updated to the latest version.

Just checked mine, and the “Energy production today” value is reset to 0 at midnight.

not resetting to 0 can be worked around by setting up an integration sensor to record power over time into an energy figure.

hmmm, how would i do that? could you give any pointers? Thank you!

Sure, I just wrote about how this works in another topic.

As for how you would do it, you would find the name of your solar power production sensor and use that in the “Input Sensor:” field.
My only warning would be to make sure your power sensor is in W (Watts) as Riemann sum integral seems to only work when I use a sensor expressed in W (Watts) in my experience.

I was wondering if someone could help me. I believe I have everything right, but my import energy doesn’t seem to be working.

Here is code from my configuration.yaml


template:
  - sensor:
        name: Grid Import Power
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state: >
            {{ [0, states('sensor.envoy_121804003802_current_power_consumption') | int(0) - states('sensor.envoy_121804003802_current_power_production') | int(0) ] | max }}
  - sensor:
        name: Grid Export Power
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state: >
            {{ [0, states('sensor.envoy_121804003802_current_power_production') | int(0) - states('sensor.envoy_121804003802_current_power_consumption') | int(0) ] | max }}


sensor:
  - platform: integration
    name: Grid Import Energy
    source: sensor.grid_import_power
    unit_prefix: k
    unit_time: h
    method: left
    
  - platform: integration
    name: Grid Export Energy
    source: sensor.grid_export_power
    unit_prefix: k
    unit_time: h
    method: left

This is the entities added to the energy dashboard

Perhaps it’s just taking time? as I haven’t imported any energy yet