Connecting Enphase to Home Assistant

In this tutorial, we will show you how to connect your Enphase Envoy to Home Assistant.

Home Assistant Enphase

Enphase is a brand of solar microinverters and batteries. While one of the pricier solar power solutions, they are known for being of high quality.

As part of a typical Enphase solar installation, you would have had an Enphase Envoy installed. This device tracks the power production of your system. Depending on how this system has been wired into your house, it can also track your house’s power consumption.

This data produced by Enphase can be fed into Home Assistant to give you a better overview of how your power is being utilized and give you a central place to track your usage.

While Enphase doesn’t officially support Home Assistant, there is a great integration built into the core that is relatively well maintained.

Adding your Enphase System to Home Assistant

Over the following sections, we will walk you through the process of connecting your Enphase power system to Home Assistant.

We will also show you how to add Enphase to the Home Assistant energy dashboard. This includes your battery system charge and discharge information.

Getting to the Devices Screen

1. Adding your Enphase system to Home Assistant is a relatively simple process as the integration is built into the Home Assistant core.

To begin the integration process, change to the “Settings” screen using the sidebar.

Open Settings Screen

2. Once you are on the settings page, click he “Devices & services” option.

Change to Devices and Services Menu

Adding your Enphase Envoy to Home Assistant

3. Home Assistant will automatically detect your Enphase Envoy system as long as it is on the same network. To begin adding your Envoy, click the “CONFIGURE” button

If ,for some reason, your Envoy is not showing up, click the “ADD INTEGRATION” button in the bottom-right corner and then search for “Enphase“. You will need to know the local IP address of your Envoy unit if you are going this route.

Enphase Automatically Detected by Home Assistant

4. You will now have a text box on your screen. In these text boxes, you will want to fill out the username and password (1.) for your Enphase account. It uses this to get the keys it needs to talk with your Enphase Envoy.

If your Envoy happens to be using a rather old firmware (Older than 7.0), you can use “installer” as the username and no password. However, most

Once you have filled out your information, click the “Submit” button (2.).

Fill out Enphase login details

5. Once your Enphase Envoy has been successfully added to your Home Assistant server, you will see a message similar to the one below.

You can click the “Finish” button to proceed with this guide.

Home Assistant Successfully Connected to Home Assistant

Adding Power Meters for the Enphase Batteries to Home Assistant

6. One of the main reasons you are adding your Enphase system to Home Assistant is to get energy statistics.

Depending on the Enphase Battery system version, you may need to set up some helpers.

If you aren’t using the Enphase batteries, or you have the “Envoy Lifetime battery energy charged” and “Envoy Lifetime battery energy discharged” entities you can safely skip this whole section.

Otherwise, proceed with this section by clicking the “Helpers” tab.

Change to Helpers Screen

7. Once on the helpers page, click the “CREATE DISPLAY” button in the bottom-right corner.

Create New helpers to connect Home Assistant to Enphase Batteries

Combining your Enphase Batteries Power Under one Sensor

8. The first helper we need to create combines the power output from each Enphase battery. If you only have one battery, you can skip this section.

On this pop-up screen, click the “Combine the state of several sensors” option.

Create new combine state helper

9. On this screen, you will want to start by giving this sensor an easily identifiable name. For this guide we will be using “Batteries Encharge Total Power” (1.). If you use a different name, you will need to adjust the sensor templates later on in this guide.

Next, use the “Input entities” option to add each of the “power” elements from your Enphase batteries (2.). This will typically use the naming “Encharge 012345678 Power“. Each battery will have its own power output, so we need to combine their values to track the whole system.

Your next step is to change the “Statistic characteristic” to “Sum” (3.). This setting tells Home Assistant that it should add the values of each of your battery entities together.

Next, ensure that the “Precision” has been set to “2” (4.).

Once you have finished filling out all of the details and have ensured each of your batteries has been added to the list, click the “Submit” button (5.).

Combine each Enphase battery output in Home Assistant

Separating Enphase Battery Charging and Discharge in Home Assistant

10. Now that we have the separate Enphase batteries’ power reporting all under a single Home Assistant sensor, we will want to have these values separated into your batteries’ charge or discharge rate.

Luckily, thanks to Home Assistant’s “Template” helper, separating these values can be pretty easy.

With the “Create Helper” menu open, click the “Template” option.

Create new Helper template

11. You will now be given a list of different template helpers that Home Assistant supports. Click the option labeled “Template a sensor” to continue.

Template a sensor
Creating a Template Sensor for Battery Charge Power

12. Name this first template sensor “Batteries Encharge Charge Power” (1.). We will use this Home Assistant sensor to track how much power flows to the Enphase batteries.

With the state template, you must fill in the following text (2.). This checks the state of the “batteries_encharge_total_power” sensor we created in the previous section.

If the sensor is less than 1, then it will be added to this value. A negative reported power from your Enphase batteries indicates that it is consuming power to charge.

{{(states('sensor.batteries_encharge_total_power') | float) if states('sensor.batteries_encharge_total_power') | int > 0 else 0 }}

Next, set the “Unit of measurement” to “W” (3.). This tells Home Assistant your Enphase battery usage will be reported in watts.

The “Device Class” will need to be set to “Power” (4.).

We next need to set the “State Class” to “Measurement” (5.).

Once you have configured all five options, click the “Submit” button (6.).

Create Enphase Encharge Charge Power template
Creating a Template Sensor for Battery Discharge Power

13. Open the create template sensor page again by following steps 10 and 11.

This time, name the sensor, “Batteries Encharge Discharge Power” (1.). We will use this Home Assistant sensor to track the discharge rate of our Enphase batteries.

Next, use the code below to fill out the “State template” (2.). This template only increases the sensor when your Enphase batteries are discharging. These batteries are discharging when their value is in the negative.

{{(states('sensor.batteries_encharge_total_power') | float | abs) if states('sensor.batteries_encharge_total_power') | int < 1 else 0 }}

You will next need to set the “Unit of measurement” to “W” (3.). This sets the power discharge rate to wattage.

After the measurement is set, you will need to set the “Device class” (4.) to “Power“.

Finally, set the “State class” to “Measurement” (5.).

Now that we have finished configuring this Home Assistant template, click the “SUBMIT” button (6.).

Create template for Battery Discharge

Converting Battery Power to Battery Energy

14. Our two helpers now give Home Assistant the Enphase battery charge and discharge power. However, to be usable within the Energy Dashboard, we must convert these values from power to energy.

Energy is essentially a way of expressing your power over a period of time.

Luckily, we can calculate this pretty easily through yet another Home Assistant helper. Bring up the “Create Helper” menu, and this time, select the “Integral sensor” option.

Create integral sensor

15. Start by giving your new sensor a name. For this case, we recommend you call this “Batteries Encharge Discharge Energy” (1.).

Next, set the “Input Sensor” (2.). This needs to be set to the “Batteries Encharge Discharge Power” entity we created in the previous section.

With the input sensor set, we next need to change the “Integration Method” to “Left Riemann sum” (3.).

Finally, set the “Precision” to “2” (4.). This tells Home Assistant to round this sensor to the closest two decimal places.

Once you have finished filling out this sensor’ds details, click the “SUBMIT” button (5.).

Create Energy sensor for Enphase battery discharge in Home Assistant

16. After creating a sensor that tracks the Enphase battery discharge energy, we need to do the same for the charging energy. Open up the Create Helper screen again and select “Integral sensor”.

On this page, name this new sensor “Batteries Encharge Charge Energy” (1.).

Once you have named this sensor, you must set the “Input Sensor” to the “Batteries Encharge Charge Power” sensor (2.).

Again, ensure that the “Integration method” has been set to “Left Reimann sum” (3.).

Finally, like the previous sensor, you will need to ensure that the “Precision” has been set to “2” (4.).

We can finally finish this whole process by clicking the “SUBMIT” button (5.)

Create Home Assistant integral sensor for Enphase Battery Charge

Finishing up Setting up Enphase Batteries with Home Assistant

17. We have finally finished configuring everything to get the charge and discharge energy of our Enphase batteries (1.). While it took a few steps, it is a simple process.

We can now add these two new energy sensors to the “Energy” dashboard (2.)

Verify Enphase Batteries and now reporting to Home Assistant

Configuring Home Assistant Energy Dashboard for Enphase

In this section, we will show you how to add your Enphase system to the Home Assistant energy dashboard. We assume you haven’t yet added any sources to this dashboard before, so these steps will differ slightly if you have added information previously.

Adding Grid Consumption and Grid Return Values from Enphase

18. The first thing you will be asked when going to the energy screen is to add your grid consumption. If your Enphase installation hasn’t been fitted with a consumption meter, you will want to skip this section.

If you have a power consumption meter, click the “Add Consumption” button.

Open Add consumption option

19. On this next screen, you will want to set the “Consumed Energy” meter to the sensor titled “Envoy 01234568 Lifetime net energy consumption” (1.). The numbers will differ as these are unique to your system.

You can also use this screen to use Home Assistant to track the cost of the power you are importing. However, we won’t be covering that in this guide.

Once you have set the grid consumption meter, click the “SAVE” button (2.)

Select lifetime net energy consumption for Enphase

20. With the consumption now set, let us set Home Assistant to track how much power your Enphase system is sending back to the grid.

To have Home Assistant track this, click the “ADD RETURN” button (2.).

Open return to grid settings

21. With this screen, you will want to set the “Energy returned to the grid” option to the sensor that has the name “Envoy 012345678 Lifetime net energy production” (1.).

This sensor tracks how much power your system has returned to the grid since the Envoy system was started.

On an additional note, Home Assistant lets you use this to track how much your provider pays you for your power.

Once you are done, click the “SAVE” button (2.).

Add Enphase lifetime net energy prouction

22. We have now finished filling in the information required for Home Assistant to track the grid power usage.

You can proceed onwards by clicking the “NEXT” button.

Continue to solar panel screen

Adding Enphase Solar Production to Home Assistant

23. We are now up to the point where we can add your Enphase solar production into the Home Assistant interface.

You can add this information by clicking the “ADD SOLAR PRODUCTION” button.

Add Enphase solar production meter to HOme Assistant

24. Using this dialog, ensure that you set the “Solar production energy” option to “Envoy 012345678 Lifetime energy production” (1.). Ensure this sensor is missing the word “net“, as that produces a different value.

After selecting the correct sensor, click the “Save” button (2.).

Select Lifetime Energy Production meter

25. That is all we need to do to get Home Assistant to read in and track your Enphase solar power generation.

To proceed with setting up your Enphase system, click the “NEXT” button.

Continue to battery screen

Adding your Enphase Battery System to Home Assistant

26. If you don’t have an Enphase battery system, you will want to skip this section and click the “NEXT” button.

Alternatively, if you have a battery system, click the “ADD BATTERY SYSTEM” button.

Begin adding Enphase Battery Statistics to Home Assistant

27. On this screen, we can finally make use of the sensors that we set up earlier to keep track of your Enphase battery charge and discharge energy.

First, set the “Energy going to the battery” option to the “Batteries Encharge Charge Energy” sensor that we created (1.).

Next, set the “Energy coming out of the battery” option to the “Batteries Encharge Discharge Energy” sensor (2.).

Adding these sensors will allow Home Assistant to track the amount of energy you are storing and using from your Enphase batteries.

After verifying both sensors have been set, click the “SAVE” button (3.)

Configure battery system to use helper values

28. You should now have your Enphase batteries being tracked by Home Assistant. Proceed through the next few screens by clicking the “Next” button.

Finish with configuring battery system

Finishing Up

29. Home Assistant allows you to track a few other things. The first of these is gas consumption. As we are focusing purely on Enphase for this guide, click the “Next” button to proceed.

Skip gas consumption

30. You can even use Home Assistant to track your water consumption. If you are like us and live on tank water, this can actually be incredibly useful.

Once you are happy with everything you have set, click the “SHOW ME MY ENERGY DASHBOARD!” button.

Skip Water consumption

Enphase showing on the Home Assistant Energy Dashboard

31. With all your Enphase data now being piped into the Home Assistant Energy dashboard, you will have to wait two hours before anything is displayed.

Below, you can see what this data might start to look like as Home Assistant aggregates all of the data. It can be a great way to see where you consume the most power and where you can try to shift power usage to make the most out of your solar power.

Home Assistant connected to Enphase energy data

Conclusion

If you have reached this point in the tutorial, we hope you have connected Enphase to Home Assistant.

Seeing your solar and power usage through Home Assistant can be incredibly useful. This is especially true if you also track individual circuits’ power usage. You can easily see what’s consuming the most power in your house and how it could be shifted to consume power during the best solar periods.

Please feel free to post a comment below if you have had any issues with integrating your Enphase system with Home Assistant.

If you liked this tutorial, we highly recommend exploring our many other Home Assistant tutorials.

Leave a Reply

Your email address will not be published. Required fields are marked *