Tesla Powerwall 2 Integration

Hey Paul - I’m just looking at the local powerwall binding here - not the cloud one. When I place the jar file I can do a bundle:list and see TeslaPowerwall binding as active however if I go to add a new thing I don’t see teslaPowerwall as a binding option to click through. I suspect yours is in the same state- it just works because you’ve got your thing defined. for now I can just use the marketplace version as it seems to work. Something to look for in the newest code set :slight_smile:

(nonworking version is Working version from marketplace is

Confirmed I see this too. Will do some homework as to why this might be the case…

Edit: https://smedley.id.au/tmp/org.openhab.binding.teslapowerwall-4.0.0-SNAPSHOT.jar fixes this
& https://smedley.id.au/tmp/org.openhab.binding.teslapowerwallcloud-4.0.0-SNAPSHOT.jar

1 Like

Alright! Thanks for all your work @Paul_Smedley
This is great.
For anyone coming after me, the syntax for Hostname/IP Address is different than the Hostname/IP Address used for the influxDB persistence binding (this cost me 2-3 hours!)

don’t include ‘http(s)://’ with this addon, just use the raw ip-address.

(the InfluxDB requires the ‘http://’ to be included, which is just… yeah)

1 Like

Hi again Paul,

I’m on OH4.0.1 and everything seems to work great, except the ‘Battery SOE’ value, which I’m guessing is the Battery state of charge, correct?

What I get out of that channel is: “1.0 one” when my battery bank is fully charged.
I haven’t seen any other state of charge yet, so can’t report what happens when it may be less than 100%.

[update1] the reading is now “0.2 one” while the Tesla app shows battery still at 100%

Any ideas what this formatting means?
Thanks a lot

This is the powerwall binding? ie the local one? And a new install (vs an upgrade from an older version of the binding/OH). It’s probably due to some of the Unit of Measure changes in OH4. Try editing your item and adding a state description of:

%.1f %%

and see if that helps. Here, mine is showing 100.0 %

1 Like

Sorry, yes, this is the local powerwall binding you just gave a few posts back (https://smedley.id.au/tmp/org.openhab.binding.teslapowerwall-4.0.0-SNAPSHOT.jar)

Perhaps I’m doing something incorrect… I’ve tried modifying the item to add:

state: pattern="%.1f %%" 

yet, OH4 doesn’t let it stick.
Here’s the full item code for the Battery SOE:

label: Battery SOE
type: Number:Dimensionless
category: ""
  - gTeslaPowerwall
groupType: None
function: null
  - Point

I edit this in the OH4 gui, save and when I re-open (in the gui ‘code’ tab), my edit is gone.
I’m a complete newb at OH, so I’m open to having made any mistake.

From the GUI:

  • click the Item
  • under Metadata, ‘Add Metadata’ - select ‘State Description’ then paste in %.1f %%

Hope this works, I’ll try setup a new ‘Thing’ when I get some time to see if I can reproduce & fix.

1 Like

Nailed it!

Thanks, this is great! I’ve been searching for this exact field for ->insert an inordinately lengthy time here<- and couldn’t figure out the trick.
Two birds with one stone, thanks so much Paul!

1 Like

If it makes you feel any better, I struggled to work this out too. I’ll see if I can fix this in the thing definition so it’s easier for the next newbie :slight_smile:

1 Like

Thanks a lot, I really appreciate it.
I’m now trying to figure out how to hack a widget that others have made to reflect the same thing (SOC that isn’t a float with 12 sig figs :stuck_out_tongue_winking_eye: )

No problems - I’m just glad others are making use of the binding.Personally, I use the cloud binding, as it allowed me to force-charge the battery when I need to take advantage of cheap grid prices.

We don’t have intelligent grid pricing in the States (yet), so I’m not too worried about it just now.
I am carbon negative with solar anyway, so it wouldn’t make much of a difference for my facility.
If/when the time comes, It’s good to know that control is possible with the cloud api.

Curious, do you have a Tesla EV as well?
I dare not obtain a Tesla OAuth token via the online services… seems like a recipe for a stolen car to me.
It would be great to synchronize charging with solar patterns though. That’s a part of the reason I bothered with OH in the first place: automate my house so that it’s intelligent and uses power more efficiently (e.g. looking at weather patterns and ramping attic fans at the right time/temps for the right reasons and charging the vehicle when the forecast looks great - otherwise charging it during off-peak hours)

I’ll leave that here, so I don’t cause too much thread drift.
Thanks Paul, nice to meet you and much appreciate your work.

I have 2x EV’s (Tesla Model 3 and a Model Y). I’m using ChargeHQ to automate charging - in my case though - I typically charge overnight when power is cheaper. ChargeHQ can charge based purely on excess solar though - but you would need to use an OAuth token :slight_smile: Sounds like some time soon, Tesla will officially support 3rd party apps.

1 Like

Sorry, the files item rules and things file are correct also on the OH 4.0? I install the binding and i charge the files items things and rules, but i don’t see nothing in sitemaps, only a - W (i try to insert in sitempa only InstPower Site data.)
in log i see this:

 2023-08-16 00:17:24.089 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'teslapowerwall:teslapowerwall:731c4bea13' changed from INITIALIZING to ONLINE

Any reason to not add items using the GUI?

my problem now work all very well!!

GREAT BINDING Thanks Paul!!! Very great work!

1 Like

i have a problem with Grid Energy Imported, Battery Energy Imported, Solar Energy Imported

==> /var/log/openhab/openhab.log <==

2023-09-24 18:40:48.235 [WARN ] [penhab.core.library.items.NumberItem] - Failed to update item 'TeslaPowerwall_Grid_Energy_Imported' because '47265.34831596743 kWh' could not be converted to the item unit 'W'

i notice that number is not the calculation of the day… any reason?

Make sure the units of the Items match - looks like your Items are configured as W when the channels from the binding are in kWh.

Sorry - not sure what you mean by ‘i notice that number is not the calculation of the day’

47265.34831596743 kWh This is a total?i think this item tell me only energy imported of the day, but the number is too big…