Using Tesla Powerwall Data on the HA Energy Dashboard

Today the new 2021.9 version was released and a bunch of new sensors are available out of the box:

However, I don’t really know the difference between all these “Import” and “export” sensors. Also I don’t know where to properly configure each sensor:

  • Battery (import/export)
  • Load (Import / Export)
  • Site (Import / Export)

Hope to find some ideas here :slight_smile:

Thank you guys!

I believe load import and export are relative to battery discharging and charging respectively.
Site import / export is grid in/out.
Solar export is solar.

No idea on ‘battery.’ At the moment, nothing is showing up for me on the energy dashboard, but apparently it can take an hour or two, so we’ll see.

Is there anything in particular I need to do to “enable” these new sensors for lack of a better word? I’ve upgraded to 2021.9 and rebooted a couple times, as well as deleting and re-adding the Tesla Powerwall integration, however the energy_exported_(in_kW) and energy_imported_(in_kW) attributes are still attributes and haven’t been moved into their own sensors, so they’re still not showing up in the energy dashboard.

Actually never mind, apparently it didn’t actually update to 2021.9, and now the update apparently isn’t even available anymore.

I use docker, and that installed just fine.

It would be good to get some setup documentation for this. If I use my Fronius feed for solar it just assumes my house is consuming it rather than a mix of battery and house, so I’m trying the Powerwall feeds.

Edit: Changed my initial setting of “Powerwall Solar Import” to “Powerwall Solar Export”

Currently I am trying:

Home Battery Storage
Energy going into the battery: Powerwall Battery Import
Energy coming out of the battery: Powerwall Battery Export

Solar Panels
Solar production energy: Powerwall Solar Export

Electricity grid
Grid Consumption: Powerwall Site Import
Return to Grid: Powerwall Site Export

Individual devices
Powerwall Load Import

Not sure if this right or wrong… won’t know for 2 hours or so…

I do have these concerning messages down the side of the energy dashboard:
Grid neutrality could not be calculated
Self consumed solar energy couldn’t be calculated
Consumed non-fossil energy couldn’t be calculated

3 Likes

For anybody seeing the same issue as me, issuing a ha core update --version 2021.9.0 command succeeded, even though the update utility showed the latest version as being 2021.8.8

Just wanted to mention that I just used @shanelord’s config and it works great - the Powerwall load export is not an individual device, but I have other individual devices (via Kasa plugs) that I’m tracking that way.

1 Like

Yep - this works well. Took me a bit to realise the animation of power flows represent total values for the day so far, not instantaneous data like the Tesla app.

Absolutely. The animations really do not make sense. The graphs values are for total energy over a period of time, whereas the animation would be helpful to convey real time flow (as done in the Tesla app).

For my setup, I had to use Solar Export, not Solar Import. Are you still using Import?

Next stop is getting the instantaneous charging values that hit my mqtt server via teslamate to be energy consumption sensors so they appear as distinct loads. (Anyone else done this yet?)

That might be it. I had issues with it and went back to my direct feed from my Fronius Inverter : “Energy total Fronius Inverter”

Upgrading my solar array soon to Enphase so will have to work it out again at the point :slight_smile:

Yeah, sorry, I used the solar export, not import. Works great!

Even ended up setting up my tariffs correctly :slight_smile:

Ahha. I have two separate inverters (Enphase and a legacy system with a poor API), both clamped with the Powerwall setup, so I rely on the solar reading on the Powerwall for the sum of the two.

Related (not strictly Powerwall, but I suspect many will have both Powerwall and Tesla vehicles), I have Teslamate reporting vehicles to HA via MQTT, so I added:

 - platform: integration
     name: "Tesla 1 Charge Supplied"
     source: sensor.tesla_1_charge_energy_added
     round: 2
     method: left

with state attributed modified to have the right classes for this to be added as an individually monitored device in the energy dashboard:

 last_reset: '1970-01-01T00:00:00+00:00'
 state_class: 'total_increasing'
 device_class: energy

I need to test on a longer charging session, as I see this sensor report 0.25kWh whereas total energy supplied via Teslamate was 0.63kWh (via reading of the sensor value. I don’t see anything graphed yet in the dashboard)

Although valuable this integration was really tricky to understand which sensors to use (not “Now”) and how Import/Export works since not every sensor will have actual values. This thread helped me tremendously (especially knowing that the readings in the distribution graphic are NOT instantaneous. The one edit to note is that if you do want to use the “Useage” / Load capability then you need to use Import and not Export as shown here:

I dont have a Tesla Powerwall but i do have something similar - Pylontech.

It seems im getting the same results as you were, with the whole Grid Neutrality error over to the right hand side…

So just to clarify…
Home Battery Storage
Energy going into the battery: kWh continuous count of energy that has charged the battery?
Energy coming out of the battery: kWh continuous count of energy that has discharged the battery?

Solar Panels
Solar production energy: kWh continuous count of solar energy made?

Electricity grid
Grid Consumption: kWh count of energy you have taken from the grid?
Return to Grid: kWh count of energy you have given back to the grid?

Individual devices
kWh continuous count of the total loads that you have consumed?

@Michael_Borohovski mind sharing your setup with tariffs? I’m trying to set mine up for peak/off peak. All the sensors exist and seem be collecting data at the times I want them too, but I can’t seem to get them to all show in the energy configuration. Right now for example I can see export/import peak but not export/import offpeak. I’m very perplexed.

Sure - the configuration is below, and all I did was set the import/export from grid to use sensor.tariff_price in the UI.

utility_meter:
  daily_energy:
    source: sensor.powerwall_site_import
    name: Daily Import Meter
    cycle: daily
    tariffs:
      - offpeak
      - peak

template:
  - sensor:
    - name: Tariff Price
      unit_of_measurement: 'USD/kWh'
      state: >
        {% if is_state('utility_meter.daily_energy', 'peak') and (now().month in (6,7,8,9)) %}
          {{ 0.34 }}
        {% elif is_state('utility_meter.daily_energy', 'offpeak') and (now().month in (6,7,8,9)) %}
          {{ 0.28 }}
        {% elif is_state('utility_meter.daily_energy', 'peak') %}
          {{ 0.25 }}
        {% elif is_state('utility_meter.daily_energy', 'offpeak') %}
          {{ 0.23 }}
        {% endif %}

Then I also have an automation:

- id: '1630663101732'
  alias: Tariff Peak
  description: Set energy cost to peak
  trigger:
  - platform: time
    at: '16:00:00'
  condition: []
  action:
  - service: utility_meter.select_tariff
    target:
      entity_id: utility_meter.daily_energy
    data:
      tariff: peak
  mode: single
- id: '1630663156975'
  alias: Tariff Offpeak
  description: Set offpeak energy costs
  trigger:
  - platform: time
    at: '21:00:00'
  condition: []
  action:
  - service: utility_meter.select_tariff
    data:
      tariff: offpeak
  mode: single
1 Like

Thanks for sharing @Michael_Borohovski . My basic setup is similar except I did not include a cycle in my utility meters. I’ve tried adding that, we’ll see how it goes.

Love what you have done here, I’d like to extend it to incorporate my utility’s rather complex time-of-use pricing algorithm. Briefly, it is as follows:

  • Off-peak: Every day 2200-0600, plus every Sunday, plus certain holidays (Memorial day, Christmas, etc.)
  • Mid-Peak: May-Oct 0600-1500 & 2000-2200 M-F; Nov-April 1000-1700 & 2000-2200 M-F. Saturday all day all year, except for holidays (see above)
  • Peak: May-Oct 1500-2000 M-F; Nov-April 0600-1000 & 1700-2000 M-F, except for weekends & holidays (see above).

I’m trying to figure out the best way to integrate this with what you’ve done. I’m thinking extending the above as follows:

  1. Create a template binary sensor for off-peak that returns true on holidays | any time between 2200-0600 | Sundays
  2. Create an automation for off-peak that just uses the binary sensor from #1 and sets tariff to off-peak
  3. Create an automation for mid-peak for each of the two seasons, triggering at the appropriate start times, with a condition that the off peak binary sensor is false.
  4. Create an automation for peak for each of the two seasons, triggering at the appropriate start times, with conditions that the off-peak binary sensor is false and that it isn’t Saturday

My questions:

  • Does this factoring make sense? Is there a better way in HA to mate this up to the energy system?

  • Does anyone have good examples of how to create a binary sensor that does what is mentioned in #1 above? I haven’t been able to find one.