Tesla Powerwall 2 Sensors

Got it connected. Thanks for the help. I connected to the TEG AP and ran the wizard to set it up with my WiFi credentials (instead of the cellular connection it was set up with originally), then restarted it and it started transmitting through my network. Set a permanent URL and now Hassio happily reads the sensors as you listed them at the top of this post.

I was about to try building a component and found that I can’t do that with Hass.io, so I’ll change over to Hasspian. Tinkering is more my thing so Hassio wasn’t really for me anyway, but I’ve a lot to work through before I get there. The custom sensors you wrote above are presumably used when customising Hasspian? Hass.io has just listed the sensor data on my homepage and I can presumably run automations off that. My plan is to turn on the heating if it is mildly cold in the morning, if I have battery left (and turn it on regardless if it is really cold). I can probably do that in either system but I have a few weeks to learn Hasspian before my AC is installed anyway.

Thanks for the help.
Matthew

Matt
glad you got it going, I used the Hassio builds for the components under the config directory - this was a migration from a standalone pi Hass implementation (all in one build)

I am looking at getting the hot water from solar rather than gas when the battery is topped up and I start exporting to the grid - I am using Node Red for those routines

/DB

Hi Dave,
Glad to see that a start has been made on this!
I had a PV array and PW2 installed last month and really want to optimise how we’re using the power.
I’ve installed a couple of storage heaters and networked them on Smartlife plugs, and have a wifi switch on order for the immersion heater.
Now what I want to do is automate the control of these components, based on the PW parameters.
I just set up a Raspberry Pi with Hass.io, and am right at the very beginning with all this. In other words, I’m not sure if I can be much help to you, but I am very willing to do what I can.

I found a couple of repos on Github with potentially useful info:


Cheers,
Jim

1 Like

Well, I see I have some way to go here!

I believe I can use IFTTT to operate the switches for the heaters in response to webhooks. I don’t yet understand how I can implement the sensors Dave has described here in order to trigger the webhooks, based on what’s happening with the Powerwall.

Here’s the sort of thing I have in mind:

When the PW is >80% charged and >1kW is going into the battery, then switch on Heater1.
If >0.3kW is going out of the battery and the PW is <90% charged, switch off Heater1.
When the PW is >90% charged and >1kW is going into the battery, then switch on Heater2.
If >0.3kW is going out of the battery and the PW is <95% charged, switch off Heater2.

Can anyone give me a shove in the right direction?

I tried IFTT but it was too slow, so I now use Node Red for logic flows - this is an example where the PW is putting power back into the grid (typically at 100%) so I switch on the electric hot water to use the excess power - it uses zwave to switch on my electric hot water heater and switches it off after 20 minutes

It works great - lots of solar generated hot water on sunny days, no need to revert to mains gas or sell back energy to the grid at a low return

Endpoints are:

http://Powerwall/api/meters/aggregates

The logic is:

Check every 30 seconds, if Site.instant_power < -1000w and load.instant_power < 1000w and Solar.instant_power > 1000w then turn on electric water heater (and tweet a summary of the power state) then start 20 minute timer, then turn it off

Hope this helps

This is a more exotic flow, this checks at pre-determine morning/evening times whether the PW2 has enough battery (set at 50%) for 20 minutes electric hot water, otherwise switches on the gas hot water (using another Zwave unit to controller gas heating/hot water)

Also monitors HA to check whether either gas or electric hot water is switched on and kicks of a 20 minutes timer - this means I can use something external like Alexa to switch on the hot water and always be sure it is switched off after a fixed time

Thanks Dave. That does help.
Where are you running Node Red?

And the code you have described above, is that written in Node Red as well, or into the HA configuration?

I am running Node Red on my Hass.io implementation - the flows are in node red, they read from the PW2 directly and use HASS to control Z-wave devices

1 Like

So my PW just was installed, but it doesn’t appear to be on my network. The installer’s never asked for my wifi password and its not hardwired with ethernet. Am I out of luck?

probably not; does to device appear in the Tesla app? in which case it is talking to Tesla somehow, maybe via GSM.

Have a word with the installer and see what he has done; there is an ethernet port inside the gateway which you could use a powerline adapter to connected to your network. I wouldn’t recommend Wifi as the Gateway has a tendency to drop out once in a while.

FYI: I created a new network for IOT devices as I wasn’t keen on sharing access to my home/office with devices that are centrally connected, not only the PW but also my inverter talks to chinese servers.

Has anyone figured out how to create a SUM for solar production? I can’t seem to replicate that even though I have all the data in influx. :frowning:

I have used the statistical sensor, however a reboot loses the data - so perhaps persist in MQTT might be an answer https://www.home-assistant.io/components/sensor.statistics/

1 Like

Has anyone’s Powerwall sensor started failing? I’m getting SSL errors now and no longer collecting data. :frowning:

Error fetching data: <PreparedRequest [GET]> from http://192.168.10.90/api/system_status/soe failed with HTTPSConnectionPool(host='192.168.10.90', port=443): Max retries exceeded with url: /api/system_status/soe (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),))

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)

Update: Easily fixed by switching sensors to SSL

Hi there and sorry if I reopen the thread.
I just want to set a binary sensor for my Tesla PowerWall 2 and I copy one sensor from your github:

  - platform: rest
    name: House now
    resource: https://192.168.1.53/api/meters/aggregates
    method: GET
    verify_ssl: false
    value_template: '{{ value_json.load.instant_power / 1000 | round(2) }}'
    device_class: power

At first give me an error because of unit_of_measurement
Anyway I take out the unit_of_measurement, but now it give me an error:
2019-09-08 18:00:08 ERROR (SyncWorker_18) [homeassistant.components.rest.sensor] Error fetching data: <PreparedRequest [GET]> from https://192.168.1.53/api/meters/aggregates failed with HTTPSConnectionPool(host='192.168.1.53', port=443): Max retries exceeded with url: /api/meters/aggregates (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f03156bb550>: Failed to establish a new connection: [Errno 113] Host is unreachable'))

Can you help me please ?
Thanks in advance
Denis

Tesla introduced self signed certificates a while back causing errors, I ended up writing a python script that ignored the errors and pushed the data to an MQTT server to be read as MQTT sensors.

Strange. I don’t have any issues at all with my current set up.

HI Everyone,

I’m new to HA! I setup the integration for tesla powerwall.

I want to make some automation on actions what action do I do to make my powerwall 2 go in to backup only?

My energy supplier is sometimes FREE or in the minus (ie i get paid to use electric) I have my energy rate price sensors in HA and i want to create rules so when energy price is 0.00 or lower then set tesla powerwall 2 to backup only so it starts charging.

I then need a rule to change powerwall 2 to “Self powered” mode which i’ll set when energy rates are above 0.01.

Look at the tesla_gateway custom component.

which is where?