Tesla Powerwall use cases and automation sharing

i tried and failed. will try create utility rate plan from scrath to see.

currently I can see Amber SmartShift works pretty well. and The most gain for the battery system with Amber is price spike period. Other tuning makes only very small difference that may not worth the effect if you are at home with a/c on.

Hi, I didn’t see this mentioned in the thread yet so thought I’d point out: The Telsa Fleet integration works great as another alternative to accessing powerwall (and vehicle) sensors and controls without need for separate token apps or paid fleet subscription etc. It is limited to the 200 API calls / day though.

I’m using Telsa Fleet + Telsa Powerwall integrations for the use cases in this thread.

2 Likes

FYI: From Tesla Support
About your issues with the API : that might be related to the Gateway firmware that was updated in July.

After version 24.4.0 it was no longer possible to have local access via the IP address.

This option has been discontinued as there is now an app for installers to commission the Powerwall. The access was not actually intended for customers, but primarily for installers.

Unfortunately we currently don“t support API inquiries, but what I can share with you is this link which might help:

https://developer.tesla.com/docs/fleet-api/getting-started/what-is-fleet-api

Hi, I have recently had a PW3 with GW2 installed.

Do any fo know which of the above HA integrations will work with that? I am looking to control the PW (not just monitor it). For example an integration that switches the export eveything Vs export solar only option in response to a SoC < x, or perhaps on a timed schedule? Does the feet API allow for that?

Any screnn shots of that please?

Any halp much appreciated.

(I should perhaps say that as yet I have not got HA - I am considering going down that route, but it all hinges on a useable PW3 integrtation. The overall goal is integrate my powerwall, heatpump, myenergi car charger & water heater and my energy suppliers smart tarrifs (Octopus UK).

I just got my powerwall and amber. I would love to know what you have done since this post. I have added the amber addon in

I’ve since scaled my automations back quite a bit: I wasn’t saving all that much and was finding some particularly sensitive electronics on one circuit were effected negatively when I took the house off grid (including taking the computer running HA offline :unamused:)

I’ve still got all the sensors hooked up, but automations are all off except one that (attempts to) take the house off grid once the solar export price is well below -10 cents. I figure price protection should cover me for anything down that low, and I’m just covering any possible losses.

Note: for now, the ability to take the house off grid hinges on the HACS-based Tesla cloud integration. The native Powerwall integration used to perform off-grid islanding mode (disclaimer: I helped write that bit), but has since broken because of Tesla pushing a firmware update that removes local control over your own battery :angry:

  binary_sensor:
    - name: Amber Energy Negative Feed In
      platform: threshold
      entity_id: sensor.amber_energy_feed_in_price
      lower: -0.10

    - name: Powerwall Almost Full
      platform: threshold
      entity_id: sensor.powerwall_charge
      upper: 95
    
  automation:
    - id: power_automatically_go_off_grid
      alias: "Power: Go off-grid"
      description: "Takes the house off-grid if the battery is almost full, and feed in is suitably negative.  Comes back online when this is no longer the case"
      mode: single
      trigger:
        - platform: homeassistant
          event: start
        - platform: state
          entity_id:
            - binary_sensor.amber_energy_negative_feed_in
            - binary_sensor.powerwall_almost_full
      action:
        - choose:
            - conditions:
                - alias: "Negative feed in && powerwall almost full"
                  and:
                    - condition: state
                      entity_id: binary_sensor.amber_energy_negative_feed_in
                      state: "on"
                    - condition: state
                      entity_id: binary_sensor.powerwall_almost_full
                      state: "on"
              sequence:
                - action: input_boolean.turn_on
                  target:
                    entity_id: input_boolean.automatically_off_grid
                - if:
                    - condition: state
                      entity_id: switch.home_energy_gateway_off_grid_operation
                      state: "off"
                  then:
                    - service: switch.turn_on
                      target:
                        entity_id: switch.home_energy_gateway_off_grid_operation
                      alias: Go off-grid
                  alias: Go off grid if we aren't already
            - conditions:
                - alias: "otherwise, on grid"
                  or:
                    - condition: state
                      entity_id: binary_sensor.amber_energy_negative_feed_in
                      state: "off"
                    - condition: state
                      entity_id: binary_sensor.powerwall_almost_full
                      state: "off"
              sequence:
                - action: input_boolean.turn_off
                  target:
                    entity_id: input_boolean.automatically_off_grid
                - if:
                    - and:
                        - condition: state
                          entity_id: switch.home_energy_gateway_off_grid_operation
                          state: "on"
                  then:
                    - service: switch.turn_off
                      target:
                        entity_id: switch.home_energy_gateway_off_grid_operation

Apologies all for my absence - I’m glad to see this matter is still in people’s minds and further work is happening to allow us to better use our powerwalls.

I’m not using tesla fleet integration. As far as I know the powerwall is upgrading automatically but I am still able to reach its api locally using pypowerwall as a proxy. I need to check more closely.

I’m a bit worried as I feel I’m a bit in too deep with the local/custom integrations to swap again now, but as well if that will become a requirement, it will have to happen anyway.

My system has been working well as I want and need it and I’ve reached a point where it requires virtually no maintenance.

I notice no one replied to the question as to whether the Powerwall 3 is supported. For the PW 3 is it possible to:

  • Turn on and off discharging to the house
  • Turn on and off recharging from the grid

I wouldn’t see why not, Tesla are fairly consistent with their use of a single API to manage all devices.

However only someone with a PW3 will be able to confirm.

I’ve created three scripts to attempt to control the PW2. They aren’t effective. Has anybody got something similar working?

sequence:
  - action: number.set_value
    metadata: {}
    data:
      value: "20"
    target:
      entity_id: number.powerwall_2_tesla_backup_gateway_2_backup_reserve
  - action: select.select_option
    metadata: {}
    data:
      option: self_consumption
    target:
      entity_id: select.powerwall_2_tesla_backup_gateway_2_operation_mode
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.powerwall_2_tesla_backup_gateway_2_allow_charging_from_grid
  - action: select.select_option
    metadata: {}
    data:
      option: battery_ok
    target:
      entity_id: select.powerwall_2_tesla_backup_gateway_2_allow_export
alias: Powerwall → Self-Consumption Mode
description: ""
sequence:
  - action: number.set_value
    metadata: {}
    data:
      value: "95"
    target:
      entity_id: number.powerwall_2_tesla_backup_gateway_2_backup_reserve
  - action: select.select_option
    metadata: {}
    data:
      option: autonomous
    target:
      entity_id: select.powerwall_2_tesla_backup_gateway_2_operation_mode
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.powerwall_2_tesla_backup_gateway_2_allow_charging_from_grid
  - action: select.select_option
    metadata: {}
    data:
      option: never
    target:
      entity_id: select.powerwall_2_tesla_backup_gateway_2_allow_export
alias: Powerwall → Force Charge
description: ""
sequence:
  - action: number.set_value
    metadata: {}
    data:
      value: "5"
    target:
      entity_id: number.powerwall_2_tesla_backup_gateway_2_backup_reserve
  - action: select.select_option
    metadata: {}
    data:
      option: autonomous
    target:
      entity_id: select.powerwall_2_tesla_backup_gateway_2_operation_mode
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.powerwall_2_tesla_backup_gateway_2_allow_charging_from_grid
  - action: select.select_option
    metadata: {}
    data:
      option: battery_ok
    target:
      entity_id: select.powerwall_2_tesla_backup_gateway_2_allow_export
alias: Powerwall → Force Export
description: ""

Looks like not many people are using a PW3 as I can’t get a definitive answer…