Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tesla Powerwall Integration Shows Different Charge % When Powerwall Has Less Than 100% Charge #82297

Closed
ziptbm opened this issue Nov 18, 2022 · 8 comments

Comments

@ziptbm
Copy link

ziptbm commented Nov 18, 2022

The problem

The sensor.powerwall_charge from the Tesla Powerwall integration reports a different charge percentage than the Tesla Mobile App when Powerwall has less than 100% Charge.

e.g. my Powerwall has a 20% backup reserve active. When my Powerwall discharges to 20% and reverts to grid power, there are different data points across endpoints. 1. Tesla Mobile App shows 20%, 2. Tesla Web UI via direct IP shows 24%, and 3. Home Assistant sensor.powerwall_charge shows 24%. Note at 100%, all three locations show 100%.

What version of Home Assistant Core has the issue?

2022.11.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tesla Powerwall

Link to integration documentation on our website

https://www.home-assistant.io/integrations/powerwall

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

I assumed this issue is on the Tesla side since the mobile app is "correct" but the Web UI and HA sensor are "incorrect." I previously raised this as an issue to Tesla, which went up through their various levels of support, but the highest tier indicated that this is by design and what's reported in the mobile app is correct.

I've also heard from others across the forums that they see this same discrepancy on their side.

Is there another sensor the integration should pull from to report the "correct" value for Powerwall charge to HA? Or is there a workaround to correct this?

@home-assistant
Copy link

Hey there @bdraco, @jrester, mind taking a look at this issue as it has been labeled with an integration (powerwall) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of powerwall can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign powerwall Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


powerwall documentation
powerwall source
(message by IssueLinks)

@jrester
Copy link
Contributor

jrester commented Nov 18, 2022

Hi @ziptbm, the HomeAssistant Powerwall integration reads the charge percentage directly from the Web UI of the Powerwall. Thats why those two show the 24% instead of the 20% in the Mobile App. Not sure why those values differ, but it might have something to do with the backup mode: https://github.com/vloschiavo/powerwall2#apioperation. There you can also see the Mapping from 20% (APP) <-> 24% (API), but I am not sure how to interpret this.

@ziptbm
Copy link
Author

ziptbm commented Nov 18, 2022 via email

@ziptbm
Copy link
Author

ziptbm commented Nov 19, 2022

@jrester - I just found this post on Reddit, which claims to provide the formula to account for the 5% that's reserved by Tesla for when the device drains complete.

To convert from the API value to the app value, use (x - .05) / .95

From the chart you shared in the other github readme, this formula works for all of those values except for 33%, which returns 29%, but that could just be due to rounding since the numbers noted were not exactly at "x.0".

If this is correct, is this something that could be added to the Tesla integration? Or create it as a separate sensor?

In the meantime, I've created a template sensor to convert the value, which is appearing to work so far. It'd be great if this were part of the official integration.

`

  • sensor:
    • name: "powerwall_charge_actual"
      unique_id: "powerwall_charge_actual"
      state_class: "measurement"
      unit_of_measurement: "%"
      device_class: "battery"
      state: >-
      {% set percent = ((states('sensor.powerwall_charge') | float(0) / 100.0) - (0.05)) / (0.95) %}
      {{ percent * 100 }}`

@jrester
Copy link
Contributor

jrester commented Nov 19, 2022

Very interesting. I will add this formula to the underlying library so that it can be used in HomeAssistant. Thereafter it could be added to the powerwall Integration. I am not sure if this should be a a separate sensor or just an extra attribute or something different. What do you think @bdraco?

@bdraco
Copy link
Member

bdraco commented Nov 19, 2022

These tend to flux a lot if you have solar so I'd say separate entity:

https://developers.home-assistant.io/docs/core/entity?_highlight=entit#generic-properties

DANGER
Entities that generate a significant amount of state changes can quickly increase the size of the database when the extra_state_attributes also change frequently. Minimize the number of extra_state_attributes for these entities by removing non-critical attributes or creating additional sensor entities.

@ziptbm
Copy link
Author

ziptbm commented Nov 19, 2022

The custom Tesla integration presents two entities for this.

@BadgerLoaf
Copy link

I see this is closed, but could we please get this opened back up and looked into, so that it reflects the charge level shown in the app?

Thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants