I've been a Tesla Solar panel owner for 4 years.  I've always wanted to have monitoring of my energy in an easier-to-consume format than having to log into the Tesla app and look at it.  Originally, my SolarEdge inverter provided me remote monitoring via their API, and there was a SolarEdge integration that I could leverage from Home Assistant (and did).  Unfortunately, about 2 years into my ownership, my inverter died and Tesla replaced it with a new one under warranty (that's not the unfortunate part).  The unfortunate part is that they also stopped allowing customers to have access to the SolarEdge API for monitoring, requiring you to do all of your energy monitoring through the Tesla app.  The Tesla app allows you to download your production data, down to hourly production values, but only by pulling a CSV file for every day.  It's not a great solution for someone who wants to automate it.

Tesla Custom Integration

I also have a Tesla EV and have been using the Tesla Custom Integration by alandtse through HACS for quite a while (the official Tesla integration is less complete).  Recently though, my Tesla Custom Integration started providing me a new sensor.tesla_solar_panel:

This new capability appears to have been added around October, 2021 in version 1.1.0, after the underlying teslajsonpy added support for "Energy Sites".  So, I've had this available for a while, but because it was just a production number, and in Watts, I didn't think much of it, until I realized that ...

Home Assistant Core 2021.8

Back in August, 2021, Home Assistant added an Energy Dashboard.  The purpose of this was to bring together all home energy management into a single unified interface within Home Assistant.  My only challenge was that, at the time, I didn't really have anything in my home being monitored within Home Assistant.  The Energy Dashboard is designed to expose Grid Power, Gas, Batteries, Solar, and EVs.  I didn't have anything actively monitored (because my SolarEdge was offline at this point), so I just ignored it...until I saw the above sensor show up.

Configuring the Energy Dashboard

I started out by enabling the Energy Dashboard in my configuration.yaml by adding the following stanza and then restarting HA:


This enabled the Energy Dashboard, but it wasn't configured.  There's a great wizard that walks you though configuring it, I skipped everything in order to get to the Solar section, but I noticed my sensor wasn't available.  The issue is that the Energy Dashboard expects kWh and I just had Watts coming from the Tesla Custom Integration, so I couldn't use it yet.

Riemann sum integral

Reading through the Community, I found that Home Assistant has a built-in integration for converting an integral by a finite sum, called Riemann sum integral.  This is what you need to convert WATT to kWh.  So, in my sensors.yaml I added the following stanza:

- platform: integration
  source: sensor.tesla_solar_panel
  name: tesla_solar_production
  unit_prefix: k
  round: 2
This is "old school" HA, a much easier way is to add a Helper through the UI. You want to use 'k' as your units and 'h' as your time so you end up with 'kWh' from a source that is providing WATTs. Leave the default integration method 'trapezoidal' for loads that are 'normal' (like Solar) and 'left' for loads that suddenly draw a lot of power over a short period (electric boilers, AC units, etc.). I'm using 'left' as the integration method for smart plugs that run fans, air cleaners, kettles, etc.

This created a new sensor.tesla_solar_production that I was able to use in my Solar configuration for the Energy Dashboard.  Once configured and allowed to run, I now have my Solar production from my Tesla Solar Panels available in HA:

Now to explore getting my actual grid power usage, natural gas, and other aspects of our home energy usage into HA.  I'm going to start with pulling individual energy monitoring (our EVs and energy monitoring smart plugs) into HA, can't wait!