[PROJECT] Driver for Connecting to Your Tesla Devices

Nope, no change. Your solar was in there before. So they think that is json. Oh well. A parsing I will go.

Thanks though! Hopefully I will have something new to try tomorrow. No matter what though, it is showing the data is there. Just need to get it formatted to be more useful.

2 Likes

I can't see straight anyway! :slight_smile: off to get some shut eye! Thanks for all your
effort!

S.

Version 0.1.6 is now posted and may parse the data properly. It did with the sample I got from @scottgu3 (it even made the 4 different child devices and put their values for each) but I want to see "real world use".

I also updated the child driver to 0.1.1. Very minor, I just realized the HTML Template example in the Preferences was still a copy from my other child driver... so I replaced it with the actual example I gave in the driver description.

Going to bed now. Since according to the time stamps on here I must have been working on this revision for ~4 hrs...

1 Like

0.1.6

  • Status : Local Connection Good

dev:6432020-05-19 09:33:19.974 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:33:18.887551201-07:00

dev:6432020-05-19 09:33:19.731 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:33:18.887551201-07:00

dev:6432020-05-19 09:33:19.473 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:33:18.890220512-07:00

dev:6432020-05-19 09:33:19.219 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:33:18.887677533-07:00

dev:6432020-05-19 09:33:16.848 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:33:15.673268721-07:00

dev:6432020-05-19 09:33:16.597 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:33:15.673268721-07:00

dev:6432020-05-19 09:33:16.346 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:33:15.690113914-07:00

dev:6432020-05-19 09:33:16.034 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:33:15.673391387-07:00

dev:6432020-05-19 09:33:13.280 pm debugTesla Powerwall - Driver version up to date

dev:6432020-05-19 09:33:12.725 pm infoTesla Powerwall - Updated

dev:6432020-05-19 09:33:12.710 pm debugTesla Powerwall - Refresh rate: 1 minute

dev:6432020-05-19 09:32:59.080 pm errorTesla Powerwall - Exception in addSensor: java.lang.IllegalArgumentException: A device with the same device network ID exists, Please use a different DNI

dev:6432020-05-19 09:32:59.062 pm errorTesla Powerwall - Exception in addSensor: java.lang.IllegalArgumentException: A device with the same device network ID exists, Please use a different DNI

dev:6432020-05-19 09:32:59.054 pm debugTesla Powerwall - addSensor(solar)

dev:6432020-05-19 09:32:59.043 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:56.990211143-07:00

dev:6432020-05-19 09:32:59.039 pm debugTesla Powerwall - addSensor(solar)

dev:6432020-05-19 09:32:59.035 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:57.286812665-07:00

dev:6432020-05-19 09:32:59.032 pm debugTesla Powerwall - addSensor(solar)

dev:6432020-05-19 09:32:59.024 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:56.990211143-07:00

dev:6432020-05-19 09:32:58.691 pm errorTesla Powerwall - Exception in addSensor: java.lang.IllegalArgumentException: A device with the same device network ID exists, Please use a different DNI

dev:6432020-05-19 09:32:58.687 pm errorTesla Powerwall - Exception in addSensor: java.lang.IllegalArgumentException: A device with the same device network ID exists, Please use a different DNI

dev:6432020-05-19 09:32:58.664 pm debugTesla Powerwall - addSensor(load)

dev:6432020-05-19 09:32:58.647 pm debugTesla Powerwall - addSensor(load)

dev:6432020-05-19 09:32:58.643 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:57.286812665-07:00

dev:6432020-05-19 09:32:58.640 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:56.990211143-07:00

dev:6432020-05-19 09:32:58.634 pm debugTesla Powerwall - addSensor(load)

dev:6432020-05-19 09:32:58.631 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:56.990211143-07:00

dev:6432020-05-19 09:32:58.319 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:56.990764805-07:00

dev:6432020-05-19 09:32:58.314 pm errorTesla Powerwall - Exception in addSensor: java.lang.IllegalArgumentException: A device with the same device network ID exists, Please use a different DNI

dev:6432020-05-19 09:32:58.285 pm debugTesla Powerwall - addSensor(battery)

dev:6432020-05-19 09:32:58.280 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:57.29019097-07:00

dev:6432020-05-19 09:32:58.256 pm debugTesla Powerwall - addSensor(battery)

dev:6432020-05-19 09:32:58.251 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:56.990764805-07:00

dev:6432020-05-19 09:32:57.712 pm errorTesla Powerwall - Exception in addSensor: java.lang.IllegalArgumentException: A device with the same device network ID exists, Please use a different DNI

dev:6432020-05-19 09:32:57.708 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:57.286926664-07:00

dev:6432020-05-19 09:32:57.536 pm debugTesla Powerwall - addSensor(site)

dev:6432020-05-19 09:32:57.533 pm debugTesla Powerwall - addSensor(site)

dev:6432020-05-19 09:32:57.478 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:56.990321808-07:00

dev:6432020-05-19 09:32:57.455 pm debugTesla Powerwall - Unhandled data:a=2020-05-19T21:32:56.990321808-07:00

--- Live Log Started, waiting for events ---

waiiiiiiitttttt

State Variables

  • instant_total_current : 0
  • energy_imported : 2785292.4436254012
  • i_c_current : 0
  • Driver : TeslaConnect
  • instant_average_voltage : 119.8499984741211
  • frequency : 60
  • instant_reactive_power : -983.5399780273438
  • i_a_current : 0
  • instant_power : 868.3900146484375
  • Version : 0.1.6
  • energy_exported : 1072084.1627920677
  • i_b_current : 0
  • instant_apparent_power : 1312.0411982552764

So there is data, but things don't seem to be matching up number-wise

hah I already wrote this driver for the powerwall 2 for a paying customer(they own the code now) It's very simple to make and took me about 1 hour to get a clean working code.

1 Like

@Evilborg This is an unhelpful comment, What's your goal? @snell has been nice enough to work on this (without pay) either help, or don't but coming in to say "I wrote it faster, and it was easy" isn't adding to the conversation. comment flagged.

Here some graphs for it for the customer I worked with...


image

@jared.zimmerman the goal is to encourage @snell to keep chugging at it and I hope he does better then me.

1 Like

I try to assume good faith but your comment did not read as though that was your goal or intent. He posted his code, if you see an obvious issue with it, I'm sure he'd appreciate if you pointed it out, I'm sure code review wouldn't violate the terms with your client.

2 Likes

I would but I find that most developers don't like other developers stepping on their toes. @snell can always ask me for anything he is stuck on.

I'm sorry you've had poor experience working with other engineers, at all the companies that I've worked out if someone wasn't open to feedback and critique they didn't work there very long, conversely if they weren't open to sharing their skill and experience without ego or assumption of "the right way" also out.

2 Likes

No worries folks. I am not a developer by trade and before my Hubitat my "coding" was primarily stuff for Particle Photon, so I do not even pretend to be a developer. Started making a driver to get data in the system that I had always wanted on previous HA systems but could never do. After that it has been a bit of a hobby.

As for all the rest of the data... once I got the aggregate proven in I figured I would start looking at other areas,

@jared.zimmerman: I am NOT sure why your log shows duplicates of pretty much everything in the log... Does your system have 2 sites in it? If so... I will have to change my child handling for it. Is there any way you could send me a sample of the json output?

Right now I am just posting things to state variables (which requires a device page refresh) rather than fill your Event logs. Once we figure out what is most relevant, then I can easily make them Events also.

UPDATED:
Version 0.1.7 is now posted. It attempts to connect to other parts of the API, but does not process them, just dumps the results to debug so that we can try to figure out how they are formatted and start getting them added in.

1 Like

Our power is off till ~3pm today due to some work in the neighborhood, so I might not be able to check out the update till this evening. We have 2 power wall units, but they’re part of one connected system

If you can give it a shot... One of the things I added was a call to check the "grid status". So if the system responds at all it might be good to capture the "off" state.

No worries if you cannot. Thanks for all the help/feedback!

Small caveat the driver I use for my tesla vehicle is ALSO called TeslaConnect not sure if that will pose and issue down the road.

Ok updated.

dev:6432020-05-20 11:18:19.683 amdebugTesla Powerwall - Device data = {"enumerating":false,"updating":false,"checking_if_offgrid":false,"running_phase_detection":false,"phase_detection_last_error":"phase detection not run","bubble_shedding":false,"on_grid_check_error":"on grid check not run","grid_qualifying":false,"grid_code_validating":false,"phase_detection_not_available":true,"powerwalls":[{"Type":"","PackagePartNumber":"1092170-53-J","PackageSerialNumber":"TG119177001SJ6","type":"acpw","grid_state":"Grid_Uncompliant","grid_reconnection_time_seconds":0,"under_phase_detection":false,"updating":false,"commissioning_diagnostic":{"name":"Commissioning","category":"InternalComms","disruptive":false,"inputs":null,"checks":[{"name":"CAN connectivity","status":"fail","start_time":"2020-05-20T11:18:20.736063992-07:00","end_time":"2020-05-20T11:18:20.736067658-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Enable switch","status":"fail","start_time":"2020-05-20T11:18:20.736069992-07:00","end_time":"2020-05-20T11:18:20.736072325-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Internal communications","status":"fail","start_time":"2020-05-20T11:18:20.736074325-07:00","end_time":"2020-05-20T11:18:20.736076658-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Firmware up-to-date","status":"fail","start_time":"2020-05-20T11:18:20.736078658-07:00","end_time":"2020-05-20T11:18:20.736080658-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}}]},"update_diagnostic":{"name":"Firmware Update","category":"InternalComms","disruptive":true,"inputs":null,"checks":[{"name":"Powerwall firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Battery firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Inverter firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Grid code","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null}]},"bc_type":""},{"Type":"","PackagePartNumber":"1092170-53-J","PackageSerialNumber":"TG1191780004MS","type":"acpw","grid_state":"Grid_Uncompliant","grid_reconnection_time_seconds":0,"under_phase_detection":false,"updating":false,"commissioning_diagnostic":{"name":"Commissioning","category":"InternalComms","disruptive":false,"inputs":null,"checks":[{"name":"CAN connectivity","status":"fail","start_time":"2020-05-20T11:18:20.736440656-07:00","end_time":"2020-05-20T11:18:20.736443989-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Enable switch","status":"fail","start_time":"2020-05-20T11:18:20.736446656-07:00","end_time":"2020-05-20T11:18:20.736448656-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Internal communications","status":"fail","start_time":"2020-05-20T11:18:20.736450989-07:00","end_time":"2020-05-20T11:18:20.736452989-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Firmware up-to-date","status":"fail","start_time":"2020-05-20T11:18:20.736455322-07:00","end_time":"2020-05-20T11:18:20.736457322-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}}]},"update_diagnostic":{"name":"Firmware Update","category":"InternalComms","disruptive":true,"inputs":null,"checks":[{"name":"Powerwall firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Battery firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Inverter firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Grid code","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null}]},"bc_type":""}],"has_sync":true,"sync":{"updating":false,"commissioning_diagnostic":{"name":"Commissioning","category":"InternalComms","disruptive":false,"inputs":null,"checks":[{"name":"CAN connectivity","status":"fail","start_time":"2020-05-20T11:18:20.736638654-07:00","end_time":"2020-05-20T11:18:20.736641988-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Firmware up-to-date","status":"fail","start_time":"2020-05-20T11:18:20.736644321-07:00","end_time":"2020-05-20T11:18:20.736646321-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}}]},"update_diagnostic":{"name":"Firmware Update","category":"InternalComms","disruptive":true,"inputs":null,"checks":[{"name":"Synchronizer firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Grid code","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null}]}},"states":[]}

dev:6432020-05-20 11:18:19.427 amdebugTesla Powerwall - Device data = {"status":"StatusUp","running":true,"connected_to_tesla":true}

dev:6432020-05-20 11:18:19.423 amdebugTesla Powerwall - Device data = {"grid_status":"SystemIslandedActive","grid_services_active":false}

dev:6432020-05-20 11:18:19.396 amdebugTesla Powerwall - Device data = {"privacy_notice":true,"limited_warranty":true,"grid_services":true,"marketing":true,"registered":true,"timed_out_registration":false}

dev:6432020-05-20 11:18:19.389 amdebugTesla Powerwall - Device data = {"percentage":66.63141773628938}

--- Live Log Started, waiting for events ---

Awesome thanks! You just dumped a bunch of the data for me and I should be able to build that all in.

As for the name... I must change it then. At least not many people are using it yet, but I do not want anyone making any claims or confusion. Any ideas?

I will try to work on getting the additional data in tonight... but it may be tomorrow also.

More data:

dev:17932020-05-20 04:12:33.970 pm debugPowerWall - Device data = {"enumerating":false,"updating":false,"checking_if_offgrid":false,"running_phase_detection":false,"phase_detection_last_error":"phase detection not run","bubble_shedding":false,"on_grid_check_error":"on grid check not run","grid_qualifying":false,"grid_code_validating":false,"phase_detection_not_available":true,"powerwalls":[{"Type":"","PackagePartNumber":"2012170-00-A","PackageSerialNumber":"-","type":"acpw","grid_state":"Grid_Uncompliant","grid_reconnection_time_seconds":0,"under_phase_detection":false,"updating":false,"commissioning_diagnostic":{"name":"Commissioning","category":"InternalComms","disruptive":false,"inputs":null,"checks":[{"name":"CAN connectivity","status":"fail","start_time":"2020-05-20T13:12:37.16132169-07:00","end_time":"2020-05-20T13:12:37.161325356-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Enable switch","status":"fail","start_time":"2020-05-20T13:12:37.16132769-07:00","end_time":"2020-05-20T13:12:37.161330023-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Internal communications","status":"fail","start_time":"2020-05-20T13:12:37.161332356-07:00","end_time":"2020-05-20T13:12:37.16133469-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Firmware up-to-date","status":"fail","start_time":"2020-05-20T13:12:37.16133669-07:00","end_time":"2020-05-20T13:12:37.161339023-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}}]},"update_diagnostic":{"name":"Firmware Update","category":"InternalComms","disruptive":true,"inputs":null,"checks":[{"name":"Powerwall firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Battery firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Inverter firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Grid code","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null}]},"bc_type":""},{"Type":"","PackagePartNumber":"2012170-00-A","PackageSerialNumber":"-","type":"acpw","grid_state":"Grid_Uncompliant","grid_reconnection_time_seconds":0,"under_phase_detection":false,"updating":false,"commissioning_diagnostic":{"name":"Commissioning","category":"InternalComms","disruptive":false,"inputs":null,"checks":[{"name":"CAN connectivity","status":"fail","start_time":"2020-05-20T13:12:37.161501022-07:00","end_time":"2020-05-20T13:12:37.161504022-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Enable switch","status":"fail","start_time":"2020-05-20T13:12:37.161506355-07:00","end_time":"2020-05-20T13:12:37.161508689-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Internal communications","status":"fail","start_time":"2020-05-20T13:12:37.161511022-07:00","end_time":"2020-05-20T13:12:37.161522355-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Firmware up-to-date","status":"fail","start_time":"2020-05-20T13:12:37.161525022-07:00","end_time":"2020-05-20T13:12:37.161527355-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}}]},"update_diagnostic":{"name":"Firmware Update","category":"InternalComms","disruptive":true,"inputs":null,"checks":[{"name":"Powerwall firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Battery firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Inverter firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Grid code","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null}]},"bc_type":""}],"has_sync":true,"sync":{"updating":false,"commissioning_diagnostic":{"name":"Commissioning","category":"InternalComms","disruptive":false,"inputs":null,"checks":[{"name":"CAN connectivity","status":"fail","start_time":"2020-05-20T13:12:37.161617021-07:00","end_time":"2020-05-20T13:12:37.161620021-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}},{"name":"Firmware up-to-date","status":"fail","start_time":"2020-05-20T13:12:37.161622688-07:00","end_time":"2020-05-20T13:12:37.161624688-07:00","message":"Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.","results":{},"debug":{}}]},"update_diagnostic":{"name":"Firmware Update","category":"InternalComms","disruptive":true,"inputs":null,"checks":[{"name":"Synchronizer firmware","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null},{"name":"Grid code","status":"not_run","start_time":null,"end_time":null,"progress":0,"results":null,"debug":null}]}},"states":[]}

dev:17932020-05-20 04:12:37.888 pm tracePowerWall - Number Devices = 0

dev:17932020-05-20 04:12:34.127 pm debugPowerWall - Device data = {"grid_status":"SystemGridConnected","grid_services_active":false}

dev:17932020-05-20 04:12:34.002 pm debugPowerWall - Device data = {"percentage":98.5104149846601}

dev:17932020-05-20 04:12:33.999 pm debugPowerWall - Device data = {"privacy_notice":true,"limited_warranty":true,"grid_services":true,"marketing":false,"registered":true,"timed_out_registration":false}

dev:17932020-05-20 04:12:33.959 pm debugPowerWall - Device data = {"status":"StatusUp","running":true,"connected_to_tesla":true}

This will probably be possible with something as simple as the remaining battery percentage:

Since we have a planned utilities outage today from 9:30-3:30 we're on battery, we have solar, and its charging at almost full capacity, so even while we use energy we're generating more than we're using even without the grid.

However our water heater is electric and it is a BEAST, when we shower in the morning or fill a tub at night the batteries just switch over and let me pull from the grid since its uses so much power.

In the case of a power outage like right now, their are a few appliances I might just turn off or power cycle hourly (like our small bar beverage fridge) or garage freezer, and I might want to generate a notification if something high power is turned on (induction stove, oven, water heater) to remind people in the house that its fine, but be mindful of the increased draw while on battery power

Have you considered a gas tankless water heater?

I've had a Propane powered Rinnai for a decade or so, and LOVE it. Uses a tiny bit of power to hit the spark and run the electronics, and that's about it.

Awesome device.

Just out of curiosity, what's your base current load when the house is "idle"?

Scott

1 Like