Tesla Powerwall2 data to PVoutput?


#42

Working great! A bit of a pain to set up but once done, it all works as it should and the extended data is really just for powerwall use.
I was struggling to understand how the data was flowing until now, when I compared the raw log from the powerwall (which has all four fields) to the parsed one by the wrapper and realized that the power and energy fields are parsed for import and export accordingly to the value “in” or “out” in the config file.

Now a bit of tweaking on the extended data and should be all good.

Happy New Year everyone!


#43

Two quick questions for you guys, one is how you get temperature values in your feed?
As far as I can tell, there is no value in the raw data but the wrapper shows it in the third field with a constant value of -1000
Yet, on the MySolarcity portal the temperature is indeed reported…where is it coming from?
Bywong shows it also https://pvoutput.org/intraday.jsp?id=52676&sid=47904

Also, how do you show the little sun icons?


#44

Hi again, temperature can be obtained a couple of different ways. I’ve got a weather station at my place that feeds it to weather underground. You get an API Key from WU and use that feed by pvoutput to display. Alternately, if there is a weather station (government owned or private) near you can use that. Set your primary device (if you are using PW2 for all of your data like I am) to weather, then you can find a station close to your location.

The sun symbols show if the weather is good (read sunny) and the efficiency of your system is good or great. Cloudy days won’t show the sun symbol. Also, since it is winter where you are you won’t see that - I don’t see it the vast majority of winter days here.

From the help page: Efficiency - Efficiency is calculated by dividing the total energy output (kWh) by the system size (kW). The efficiency measure allows the outputs of system with different sizes to be compared.

Forgot most important point - under Extended Data you will need to select temperature (v5) and a separate axis (2).


#45

Thank you for the tips. I got the weather to show from an existing station although it is on my project list to get a personal one. I chose to display it on “Main” instead to extended data and it seems to be working well. Instead I wanted to use V9 (which I have not yet used) for Solar Radiation but that does not seem to poll from WU.

Thank you also for the explanation on the Sun icon, I look forward to seeing that in the future.

Lastly, thank you for reading my mind on the Efficiency question. I found out that the Tilt (1), Orientation and Azimuth (north) were incorrect . I used Google Compass to get the exact Azimut.

I appreciate all your help and will try helping other Powerwall users on the PW facebook group.


#46

I’ve updated my walk-through to include the setup of generation as a second service here:


#47

That’s pretty cool! I always thought the PW was a “black box.” I hate all that proprietary crap. You have really done an amazing thing here.


#48

Hi Spludge

Just to say a HUGE thank you to you and your blog and of course to Banksie for adding support for this, my Tesla arrived in March and now I have the stats (I had to find a nice low power PC for the monitoring) up and running very quickly,

Now for my last project, to record the thermosolar data / that is going to be a much bigger challange.

Powerwall2 rocks , you Rock, this site Rocks.

Best Wishes from Germany (near Heidelberg)


#49

If you’re familiar with python, another good option for uploading Tesla Powerwall2 data to PVoutput is here:
Powerwall2PVOutput

I’ve been using it for a couple months on a raspberry pi3, and it works great. Very easy to setup, and cheap too.


#50

OK, I’m stumped - as far as I can tell I’ve followed all the walkthroughs and configs to use the PVOutput uploader (v1.5.2), I’ve got the data being extracted from the PW2 with a browser, but there’s no data being uploaded into PVOutput, and there is no logfile created in the designated PW2 logs folder.
Account is ‘WillisAve’, donation made (and very happy to do so, this PVOutput site and service is clearly an awesome hands-on service for the community) , extended parameters are visible, but empty.

The script can reach the PVOutput site:
2018-05-26 12:14:56,830 INFO [Thread-1] (Controller.java:142) - Loaded Config: pvoutput.ini
2018-05-26 12:15:00,324 INFO [Thread-1] (WebClient.java:131) - >>> http://pvoutput.org:80/service/r2/getsystem.jsp?donations=1
2018-05-26 12:15:01,213 INFO [Thread-1] (Controller.java:2168) - <<< WillisAve,7370,2075,22,335,LG335,1,6000,Fronius Primo,NW,25.0,No,20180517,-33.728602,151.173571,5;;1
2018-05-26 12:15:03,226 INFO [Thread-1] (WebClient.java:131) - >>> http://pvoutput.org:80/service/r1/getstatus.jsp?d=20180526
2018-05-26 12:15:03,647 INFO [Thread-1] (Controller.java:2097) - <<< 20180526,13:15,NaN,NaN,9163,4313,NaN

I can get data from the PW2 when I paste the URLs into a browser:
http://192.168.0.63/api/system_status/soe yields {“percentage”:87.62548949804201}

The pvoutput.log mentions a logfile, but no such logfile is created in my C:#TeslaPW2Logs folder:

2018-05-26 13:08:29,837 INFO [Thread-1] (Controller.java:375) - Loaded Reader 1: powerwall
2018-05-26 13:08:29,837 INFO [Thread-1] (Controller.java:376) - Log Directory 1: [c:\TeslaPW2Logs]
2018-05-26 13:08:29,837 INFO [Thread-1] (Controller.java:387) - Loading Config 1: powerwall.ini

2018-05-26 13:08:29,868 INFO [Thread-1] (Controller.java:438) - Found 1 Sensors
2018-05-26 13:08:29,868 INFO [Thread-1] (Controller.java:539) - Added Reader: powerwall0
2018-05-26 13:08:29,868 INFO [Thread-1] (Controller.java:563) - Log File: powerwall0 [PW0-2018-05-26.log]

What I’ve noticed is that my pvoutput.log file after the usual initialisation has:

2018-05-26 13:08:29,899 INFO [Thread-1] (Controller.java:583) - Service: [http://pvoutput.org:80/service/r2/addbatchstatus.jsp] Test: false, End: 18:00
2018-05-26 13:08:29,899 INFO [Thread-1] (Controller.java:591) - Loaded 1 Readers (Import: 1, Export: 0)
2018-05-26 13:08:29,946 INFO [Thread-2] (PowerwallLogReader.java:361) - >>> http://192.168.0.63/api/system_status/soe
2018-05-26 13:08:31,912 INFO [Thread-1] (Controller.java:786) - Startup Complete: Waiting for data…
2018-05-26 13:09:00,039 INFO [Thread-2] (WebClient.java:162) - >>> http://192.168.0.63:80/api/meters/aggregates
2018-05-26 13:09:00,054 INFO [Thread-2] (PowerwallLogReader.java:361) - >>> http://192.168.0.63/api/system_status/soe
2018-05-26 13:09:30,116 INFO [Thread-2] (WebClient.java:162) - >>> http://192.168.0.63:80/api/meters/aggregates
2018-05-26 13:09:30,147 INFO [Thread-2] (PowerwallLogReader.java:361) - >>> http://192.168.0.63/api/system_status/soe

Whereas the example pvoutput.log several posts above I see:
2017-09-13 20:38:47,921 INFO Thread-1 - Startup Complete: Waiting for data…
2017-09-13 20:38:47,925 INFO Thread-1 - >>> 20170913,10:40,-1,-1,-1.0,0,-1000.0,243.9
2017-09-13 20:38:47,931 INFO Thread-1 - >>> http://pvoutput.org:80/service/r2/addbatchstatus.jsp?data=20170913,10:40,-1,-1,-1.0,0,-1000.0,243.9
2017-09-13 20:38:48,417 INFO Thread-1 - <<< 20170913,10:40,1

So I’m not seeing any data come back in Thread 1 from the PW, and so no calls to addbatchstatus.jsp, even though I can get the info out of the PW2 using the same URLs in a webbrowser running on the same machine.

Is there some additional logging level I can set somewhere to provide deeper visibility on where the scripts are falling down?

TIA for any insights - I’ve spent many hours in checking this forwards, backwards and sideways looking for something I’ve mucked up, but I’ve missed it.


#51

Most likely the service is unable to match or find the power readings from the PW gateway data. The voltage data is being picked up, so it is not an access issue.

Please provide -

  1. The contents of the PVOutput powerwall.ini

  2. A sample output of http://192.168.0.63:80/api/meters/aggregates

The log line below shows voltage=243.9, consumption power=0W and the rest is not found.

>>> http://pvoutput.org:80/service/r2/addbatchstatus.jsp?data=20170913,10:40,-1,-1,-1.0,0,-1000.0,243.9


#52

Sorry for the confusion, but no - that snippet with the voltage data was from the logfile in post#6 above, I put in for comparison to what I was NOT seeing in my logfiles.
In my logfiles, I don’t see ANY data that would have been read from the PW - so perhaps it is an access issue, but I can get the data using the same URLs in a webbrowser on the same machine.

FWIW, this is on a fresh installation of Windows 8.1.

powerwall.ini:


#
# The Powerwall gateway API url
# 
# Replace 127.0.0.1 with the gateway IP address
#

url=http://192.168.0.63/api/meters/aggregates

#
# Poll the URL every n seconds
#

poll=30

# Define the power direction
# 
# 'in'  - Consumption (load)
# 'out' - Solar Generation (solar)

direction=in

# uncomment to read an alternative power value
#
# default is 'instant_power'
#
# power=instant_power
# uncomment to read voltage data
#

voltage=instant_average_voltage

# uncomment to upload state of charge percentage to extended parameter
#

soc-url=http://192.168.0.63/api/system_status/soe
soc-parameter=v11

# extended data v7-v12
#
# valid values [site|battery|load|solar|busway|frequency].[instant_power|instant_reactive_power|instant_apparent_power|frequency|energy_exported|energy_imported|instant_average_voltage|instant_total_current|i_a_current|i_b_current|i_c_current]
#
# e.g. battery.instant_power
# 
# uncomment to upload data to v7
#

v7=battery.instant_power

# uncomment to upload data to v8
#

v8=load.instant_power

# uncomment to upload data to v10
#

v10=site.instant_power
 
# uncomment to upload data to v11
#

# v11=load.frequency

# uncomment to upload data to v12
#

v12=solar.instant_power

output of http://192.168.0.63:80/api/meters/aggregates


> {"site":{"last_communication_time":"2018-05-26T20:34:19.187556399+10:00","instant_power":3.4200000762939453,"instant_reactive_power":24.469999238848686,"instant_apparent_power":24.707838093833825,"frequency":49.95000076293945,"energy_exported":22020.84000015187,"energy_imported":79682.14000015186,"instant_average_voltage":728.0899963378906,"instant_total_current":0,"i_a_current":0,"i_b_current":0,"i_c_current":0},"battery":{"last_communication_time":"2018-05-26T20:34:19.190209041+10:00","instant_power":970,"instant_reactive_power":-10,"instant_apparent_power":970.0515450222221,"frequency":49.963,"energy_exported":92140,"energy_imported":104380,"instant_average_voltage":238.8,"instant_total_current":-22.900000000000002,"i_a_current":0,"i_b_current":0,"i_c_current":0},"load":{"last_communication_time":"2018-05-26T20:34:19.187385067+10:00","instant_power":979.0476892891847,"instant_reactive_power":-25.523438422695016,"instant_apparent_power":979.3803264367776,"frequency":49.95000076293945,"energy_exported":0,"energy_imported":210092.96472222224,"instant_average_voltage":728.0899963378906,"instant_total_current":1.3446794959600437,"i_a_current":0,"i_b_current":0,"i_c_current":0},"solar":{"last_communication_time":"2018-05-26T20:34:19.187385067+10:00","instant_power":-0.47999998927116394,"instant_reactive_power":2.200000047683716,"instant_apparent_power":2.2517549155067185,"frequency":49.95000076293945,"energy_exported":164833.10833333628,"energy_imported":161.44361111405405,"instant_average_voltage":238.3300018310547,"instant_total_current":0,"i_a_current":0,"i_b_current":0,"i_c_current":0},"busway":{"last_communication_time":"0001-01-01T00:00:00Z","instant_power":0,"instant_reactive_power":0,"instant_apparent_power":0,"frequency":0,"energy_exported":0,"energy_imported":0,"instant_average_voltage":0,"instant_total_current":0,"i_a_current":0,"i_b_current":0,"i_c_current":0},"frequency":{"last_communication_time":"0001-01-01T00:00:00Z","instant_power":0,"instant_reactive_power":0,"instant_apparent_power":0,"frequency":0,"energy_exported":0,"energy_imported":0,"instant_average_voltage":0,"instant_total_current":0,"i_a_current":0,"i_b_current":0,"i_c_current":0},"generator":{"last_communication_time":"0001-01-01T00:00:00Z","instant_power":0,"instant_reactive_power":0,"instant_apparent_power":0,"frequency":0,"energy_exported":0,"energy_imported":0,"instant_average_voltage":0,"instant_total_current":0,"i_a_current":0,"i_b_current":0,"i_c_current":0}}


#53

Both the config and data look okay, so it should work if the service is receiving data from the gateway.

To enable additional logging including data returned from the gateway -

  1. Open the file log.properties file under the conf folder.

  2. Replace the line log4j.rootLogger=info, file
    with log4j.rootLogger=debug, file

  3. Restart the PVOutput service

The pvoutput.log should now contain the response from the PW gateway, look for the lines with PowerwallLogReader


#54

OK - that extra debugging revealed the problem! its sorted now.
It showed the data was being retrieved from the battery correctly - but the result was being ignored.

Then when I moved the logfile across to a different PC, I realised the date/timestamp on the logfile was all wrong
Then I realised the timestamps at the start of the log entries didn’t match the current time, or the time in the first field retrieved from the battery:
2018-05-27 12:21:37,895 DEBUG [Thread-2] (Wire.java:77) - << "{“site”:{“last_communication_time”:“2018-05-26T22:21:37.769271583+10:00”,“instant_power”:4991.390116453171,“instant_reactive_power”:-760.4399871826172,“instant_apparent_power”:5048.984478955416,“frequency”:49.900001525878906,“energy_exported”:22068.08250015324,"energy_imported

Turns out I had set the time on the new virtual PC, but neglected the timezone, and had set the timezone field in pvoutput.ini incorrectly as well, so the PC time was effectively 14 hours into the future when converted back to GMT. Presumably it was checking the time field in the response from the battery or something, and discarding it because it was too far in the past. Or the future. Or somesuch.

Anyway, fixed the timezone, reset the clock, commented out the timezone field in pvoutput.ini, restarted, and voila I has extended data!

Thanks so much for the prompt assist, and late on a Saturday night at that! Really appreciate the help.


#55

Glad it is working now, enjoy the graphs :smile:


#56

Hi Guys,
I am wondering if its possible to get my powerwall 2 integrated with pvoutput with my macbookpro ?
I have the tesla app on my Iphone and pvoutbootpro aswell and pvoutput on my macbookpro.


#57

Its possible to run the service under a mac, the steps would be the same as Linux.


#58

Oke thanks, have to keep trying :wink:


#59

A minor niggle - it appears the Tesla PW2 PVO service isn’t uploading Voltage or Temperature data retrieved from the battery, but the v7-v12 extended fields are working fine.
My powerwall.ini says (with most of the comments removed)

url=http://192.168.0.63/api/meters/aggregates
poll=60
direction=out

voltage=solar.instant_average_voltage
temperature=battery.instant_average_voltage

'#
'# extended data v7-v12
'#

v7=battery.instant_power
v8=load.instant_power
v9=solar.energy_exported
v11=solar.instant_apparent_power
v10=site.instant_power
v12=solar.instant_power

The pvoutput.ini file includes ‘true’ for temperature and voltage:
'#
'# Enable or disable temperature data upload
'# Default is ‘true’
'#

upload-temperature=true

'#
'# Enable or disable voltage data upload
'# Default is ‘false’
'#

upload-voltage=true


The JSON file retrieved from the battery had correct values for the ‘instant_average_voltage’ fields:
solar “instant_average_voltage”:237.24000549316406, and
battery “instant_average_voltage”:236.9,

and I’m getting the v7-v12 fields filled correctly.


The string uploaded to PVOutput was (with header line from the log file):
DATE;TIME;TEMPERATURE;VOLTAGE;POWER;ENERGY;TOTAL;V7;V8;V9;V10;V11;V12
20180612;14:13:14;-1000.0;-1.0;2694;-1.000;-1.000;-1520.000;1232.262;392448.404;2695.677;2701.559;2694.010


every line logged the values ‘-1000.0’ for Temperature and ‘-1.0’ for Voltage, and somehow the ‘Power’ field has been filled with the integer of the value assigned to v12, despite no line in the powerwall.ini file assigning anything to a field called ‘Power’


Is anyone successfully retrieving and uploading any of the “instant_average_voltage” fields, or does this script only do v7-v12 and not temperature or voltage yet? (I know the PW2 doesn’t have a real temperature field, I just used it to see if temp was being uploaded)


#60

Don’t know if this is a problem with syntax in your .ini file but all your variable use underbars but your two upload statements are using dashes.


#61

Well, Tesla has now screwed up our ability to monitor our PW2 with the latest firmware update. They will now change via their code between wi-fi, ethernet and 3g networks. Looks like we will have to let Tesla know this isn’t acceptable.

https://www.tesla.com/support/energy/own/powerwall/software-updates

Version 1.17

Added dynamic network management to use best internet connection type (Ethernet, Wi-Fi or Cellular)