Using Tesla Powerwall Data on the HA Energy Dashboard

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.

Newbie question:

I am new to Home Assistant - my first project is integration of my Tesla Powerwall Gateway.
1. I installed HA with .HA_VERSION 2022.3.5
2. Tried to add Tesla Powerwall Integration as offered by the interface

The script pulled in does request IP address and password - nothing else. Since late 2021 this is not sufficient to access the gateway. I know that my IP address works and I know that my account (email, password) works. Neither IP plus my password nor IP with the password from the gateway label works.

Reading through the blog I see that email and password authentication is discussed, so I am puzzled that I do not seem to get a recent version of the powerwall script that offers full authentication.

Any pointers? Thanks.

My apologies … I the docker directory that Home Assistant was using did not have write access. Problem solved, I was able to cvonnect to the powerwall with IP and customer password.

i’ve been using this since my powerwalls were installed last weekend, and it has worked great until today…but today it seems somehow my entire week’s worth of energy usage has been compressed into today’s numbers (and not even just one day, they are all compressed into one hour from noon-1pm):

any idea what would cause this and / or how to fix it?

edit: had to go into the mysql db and manually edit the statistics table to fix this. was a matter of editing the powerwall data, for which the sum somehow got screwed up on the noon update yesterday…

edit 2: nevermind, that didn’t work. as soon as it updated itself again at 1am last night, all of the data is screwed up again…can anyone assist?

i can keep making the changes manually in the database, but every hour the numbers just get screwed up again

Is it better to have no cycle for the tariff sensors created for the energy dashboard? Or will daily cycle sensors work?

I tried with the given sensor names, but it does not work with my (Tesla Powerwall) installation.
I receive negative values for sensor_powerwall_site_import as well as sensor_powerwall_site_export.
error message somehwat like “Entity has a negative state”

And sensor sensor_powerwall_load_export is not available at all. :frowning:

Anyone faced the same issues already?

Sorry for the necroposting but I’m having difficulty understanding the logic of the Solar Production selection and how Self Consumed Solar Energy is calculated. In my system (power walls plus PV), I have to choose Powerwall Solar Export to get the correct PV production for the day and this works fine. However, the Self Consumed Solar Energy percentage is always significantly lower than in the Tesla app. Why is there such a great difference between this Self Consumed value in the Energy Dashboard vs the Tesla app? I assume the way this is calculated is different between the two? Thanks!

Hi all.

Anyone else having issues with the Energy Dashboard recently and Tesla data?

I’m seeing the Energy Dashboard report a large amount of grid consumption but that’s not reflected in the Tesla app at all. Grid consumption overnight up until just after 7am, then Tesla app reports zero grid usage - all solar and battery.

Images of dashboards here: Home Assistant Powerwall Issue - Album on Imgur

Energy dashboard is showing matching site import and site export figures that are blowing out realistic numbers and making the net consumed, self consumed and self sufficiency charts useless.

Thanks,
Shane.

I have this all working with my new Pw2. Thankyou.

Curious how I get HA to report daily figures. Ie daily grid import, grid export, solar generation, house consumption, battery charge, battery discharge.

The HA integration currently shows instant power, and an accumulated total energy. I want daily energy.

This one shows the daily summary any one have ideas on live data ?

I have the same issue are you still getting these mismatch figures for grid usage

Could it be related to this github bug with no action?