2018-06-19 11:21:32 -04:00
|
|
|
|
######################################################################################################
|
|
|
|
|
|
### @Tesla Powerwall - https://www.vcloudinfo.com/2018/01/going-green-to-save-some-green-in-2018.html
|
|
|
|
|
|
# # @CCOSTAN
|
|
|
|
|
|
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
2020-06-30 14:28:05 -04:00
|
|
|
|
# Read more about this on https://www.vcloudinfo.com
|
2020-09-20 15:20:32 -04:00
|
|
|
|
# Tesla Powerwall added via UI Integration
|
|
|
|
|
|
# Tesla Powerwall Monitoring #272
|
2025-11-26 15:16:21 -05:00
|
|
|
|
######################################################################
|
|
|
|
|
|
# --------------------------------------------------------------
|
|
|
|
|
|
# Binary Sensors:
|
|
|
|
|
|
# - binary_sensor.powerwall_charging ............. battery_charging (on=charging)
|
|
|
|
|
|
# - binary_sensor.powerwall_connected_to_tesla ... connectivity (on=connected)
|
|
|
|
|
|
# - binary_sensor.powerwall_grid_services_active .. power (on=active)
|
|
|
|
|
|
# - binary_sensor.powerwall_grid_status .......... power (on=grid up)
|
|
|
|
|
|
# - binary_sensor.powerwall_status ............... power (on=system ok)
|
|
|
|
|
|
#
|
|
|
|
|
|
# Power & Energy Sensors:
|
|
|
|
|
|
# - sensor.powerwall_charge ...................... battery %, 0–100
|
|
|
|
|
|
# - sensor.powerwall_backup_reserve .............. reserve %, 0–100
|
|
|
|
|
|
# - sensor.powerwall_battery_power ............... kW (+discharge / -charge)
|
|
|
|
|
|
# - sensor.powerwall_load_power .................. kW house load
|
|
|
|
|
|
# - sensor.powerwall_site_power .................. kW (+export / -import)
|
|
|
|
|
|
# - sensor.powerwall_solar_power ................. kW solar production
|
|
|
|
|
|
#
|
|
|
|
|
|
# Lifetime kWh Meters:
|
|
|
|
|
|
# - sensor.powerwall_battery_export .............. kWh → grid/load
|
|
|
|
|
|
# - sensor.powerwall_battery_import .............. kWh ← battery charged
|
|
|
|
|
|
# - sensor.powerwall_load_export ................. kWh exported from loads
|
|
|
|
|
|
# - sensor.powerwall_load_import ................. kWh imported to loads
|
|
|
|
|
|
# - sensor.powerwall_site_export ................. kWh site → grid
|
|
|
|
|
|
# - sensor.powerwall_site_import ................. kWh site ← grid
|
|
|
|
|
|
# - sensor.powerwall_solar_export ................ kWh solar → site/battery/grid
|
|
|
|
|
|
# - sensor.powerwall_solar_import ................ kWh solar ← grid (rare)
|
|
|
|
|
|
#
|
|
|
|
|
|
# Switches:
|
|
|
|
|
|
# - switch.powerwall_off_grid_operation .......... island mode toggle
|
|
|
|
|
|
######################################################################
|
2018-03-16 02:17:38 -04:00
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------
|
2018-11-14 13:17:28 -05:00
|
|
|
|
automation:
|
|
|
|
|
|
- alias: Notify if Grid is down
|
2020-07-20 19:33:03 +01:00
|
|
|
|
id: 56a32121-5725-4510-a1fa-10f69a5c82ef
|
2018-11-14 13:17:28 -05:00
|
|
|
|
trigger:
|
|
|
|
|
|
- platform: state
|
2024-10-18 22:08:06 +00:00
|
|
|
|
entity_id: binary_sensor.powerwall_grid_status
|
2023-12-16 19:27:00 +00:00
|
|
|
|
|
2018-12-06 19:56:36 -05:00
|
|
|
|
condition:
|
2023-12-16 19:27:00 +00:00
|
|
|
|
- condition: template
|
|
|
|
|
|
# Check that both current and previous states are not 'unavailable', 'unknown', or 'null'.
|
|
|
|
|
|
value_template: >-
|
2024-10-18 22:08:06 +00:00
|
|
|
|
{{ states('binary_sensor.powerwall_grid_status') not in ['unavailable', 'unknown', 'null'] and
|
2023-12-16 19:27:00 +00:00
|
|
|
|
trigger.from_state.state not in ['unavailable', 'unknown', 'null'] }}
|
|
|
|
|
|
|
2018-11-14 13:17:28 -05:00
|
|
|
|
action:
|
|
|
|
|
|
- service: script.notify_engine
|
2020-09-26 10:52:45 -04:00
|
|
|
|
data:
|
2020-09-20 15:20:32 -04:00
|
|
|
|
title: "Electrical Grid Status {{ (trigger.to_state.state)|replace('on', 'up')|replace('off', 'down') }}."
|
2020-06-27 10:32:29 -04:00
|
|
|
|
value1: "Please verify with the Tesla App."
|
2018-11-14 13:17:28 -05:00
|
|
|
|
who: 'parents'
|
2023-11-17 22:16:41 +00:00
|
|
|
|
group: 'information'
|
2020-06-27 10:32:29 -04:00
|
|
|
|
|
|
|
|
|
|
# https://github.com/CCOSTAN/Home-AssistantConfig/issues/779
|
|
|
|
|
|
- alias: Shut Things down if running on PowerWall
|
2020-07-21 17:20:00 -04:00
|
|
|
|
mode: restart
|
2020-07-20 19:33:03 +01:00
|
|
|
|
id: 37288a96-5f49-46c2-85c8-7e8794d23612
|
2020-06-27 10:32:29 -04:00
|
|
|
|
trigger:
|
|
|
|
|
|
- platform: state
|
2024-10-18 22:08:06 +00:00
|
|
|
|
entity_id: binary_sensor.powerwall_grid_status
|
2025-08-18 09:23:20 -04:00
|
|
|
|
to: 'off'
|
2020-07-21 17:20:00 -04:00
|
|
|
|
|
2020-06-27 10:32:29 -04:00
|
|
|
|
action:
|
|
|
|
|
|
- service: homeassistant.turn_off
|
|
|
|
|
|
entity_id:
|
|
|
|
|
|
- group.interior_lights
|
|
|
|
|
|
- group.exterior_lights
|
2025-11-21 17:11:17 -05:00
|
|
|
|
- switch.kitchen_accent_2
|
|
|
|
|
|
- switch.master_bathroom_accent_2
|
2020-06-27 10:32:29 -04:00
|
|
|
|
- service: script.notify_engine
|
2020-09-26 10:52:45 -04:00
|
|
|
|
data:
|
2020-06-27 10:32:29 -04:00
|
|
|
|
title: "Electrical Grid Status {{ (trigger.to_state.state)|replace('True', 'up')|replace('False', 'down') }}."
|
|
|
|
|
|
value1: "Taking actions to turning off the House Lights to preserve Battery Power."
|
|
|
|
|
|
who: 'family'
|
2023-11-17 22:16:41 +00:00
|
|
|
|
group: 'information'
|
2020-06-30 14:28:05 -04:00
|
|
|
|
|
2020-07-21 17:20:00 -04:00
|
|
|
|
- delay:
|
|
|
|
|
|
minutes: 1
|
|
|
|
|
|
- service: homeassistant.turn_off
|
|
|
|
|
|
entity_id:
|
|
|
|
|
|
- group.interior_lights
|
|
|
|
|
|
- group.exterior_lights
|
2025-11-21 17:11:17 -05:00
|
|
|
|
- switch.kitchen_accent_2
|
|
|
|
|
|
- switch.master_bathroom_accent_2
|
2020-07-21 17:20:00 -04:00
|
|
|
|
|
|
|
|
|
|
- service: script.speech_engine
|
2020-09-26 10:52:45 -04:00
|
|
|
|
data:
|
2020-07-21 17:20:00 -04:00
|
|
|
|
value1: "Because of the Power Outage, the Lights will be recycled for 3 minutes. Lights may turn on and off during this time."
|
|
|
|
|
|
|
|
|
|
|
|
- delay:
|
|
|
|
|
|
minutes: 3
|
|
|
|
|
|
- service: homeassistant.turn_off
|
|
|
|
|
|
entity_id:
|
|
|
|
|
|
- group.interior_lights
|
|
|
|
|
|
- group.exterior_lights
|
2025-11-21 17:11:17 -05:00
|
|
|
|
- switch.kitchen_accent_2
|
|
|
|
|
|
- switch.master_bathroom_accent_2
|
2020-07-21 17:20:00 -04:00
|
|
|
|
|
|
|
|
|
|
- service: script.speech_engine
|
2020-09-26 10:52:45 -04:00
|
|
|
|
data:
|
2020-07-21 17:20:00 -04:00
|
|
|
|
value1: "Automatic light recycling has been completed. Any abnormalities will have to be addressed in the Hue App most likely. "
|
|
|
|
|
|
|
2024-10-18 22:08:06 +00:00
|
|
|
|
- alias: Powerwall Low Charge Monitoring with Grid Status
|
|
|
|
|
|
id: fda6116b-b2a5-4198-a1ce-4cf4bb3254b2
|
|
|
|
|
|
mode: single
|
|
|
|
|
|
trigger:
|
|
|
|
|
|
- platform: numeric_state
|
|
|
|
|
|
entity_id: sensor.powerwall_charge
|
|
|
|
|
|
below: 60
|
|
|
|
|
|
for:
|
|
|
|
|
|
hours: 24
|
|
|
|
|
|
condition:
|
|
|
|
|
|
- condition: state
|
|
|
|
|
|
entity_id: binary_sensor.powerwall_grid_status
|
|
|
|
|
|
state: 'on'
|
|
|
|
|
|
action:
|
|
|
|
|
|
- service: script.notify_engine
|
|
|
|
|
|
data:
|
|
|
|
|
|
title: "Powerwall Low Charge Alert - Current Charge: {{ states('sensor.powerwall_charge') }}"
|
|
|
|
|
|
value1: "The Powerwall has been below 50% charge for more than 24 hours while the grid is online. This may indicate an issue."
|
|
|
|
|
|
who: 'parents'
|
|
|
|
|
|
group: 'information'
|
|
|
|
|
|
|
2025-11-21 17:11:17 -05:00
|
|
|
|
- alias: "Shut down Docker hosts and camera PoE at 75% Powerwall"
|
|
|
|
|
|
id: 25b3d3d8-92fa-454a-9f1c-6d3fd0f3af58
|
|
|
|
|
|
description: "Protect battery by shutting down non-essentials when Powerwall drops below 75%"
|
|
|
|
|
|
mode: single
|
|
|
|
|
|
trigger:
|
|
|
|
|
|
- platform: numeric_state
|
|
|
|
|
|
entity_id: sensor.powerwall_charge
|
|
|
|
|
|
below: 75
|
|
|
|
|
|
for:
|
|
|
|
|
|
minutes: 3
|
|
|
|
|
|
action:
|
|
|
|
|
|
- service: button.press
|
|
|
|
|
|
target:
|
|
|
|
|
|
entity_id:
|
|
|
|
|
|
- button.qemu_docker2_101_shutdown
|
|
|
|
|
|
- button.qemu_docker69_169_shutdown
|
|
|
|
|
|
- service: switch.turn_off
|
|
|
|
|
|
target:
|
|
|
|
|
|
entity_id:
|
|
|
|
|
|
- switch.poe_garage_port_3_poe
|
|
|
|
|
|
- switch.poe_garage_port_4_poe
|
|
|
|
|
|
- switch.poe_garage_port_5_poe
|
|
|
|
|
|
- switch.poe_garage_port_6_poe
|
|
|
|
|
|
|
2025-11-21 17:23:45 -05:00
|
|
|
|
- alias: "Powerwall outage - Rheem WH off at night"
|
|
|
|
|
|
id: d686f650-65ad-4cc6-8e27-8b5ee76b5338
|
|
|
|
|
|
description: "During outages, turn off the water heater after sunset to protect battery"
|
|
|
|
|
|
mode: single
|
|
|
|
|
|
trigger:
|
|
|
|
|
|
- platform: sun
|
|
|
|
|
|
event: sunset
|
|
|
|
|
|
- platform: state
|
|
|
|
|
|
entity_id: binary_sensor.powerwall_grid_status
|
|
|
|
|
|
to: 'off'
|
|
|
|
|
|
for:
|
|
|
|
|
|
minutes: 1
|
|
|
|
|
|
condition:
|
|
|
|
|
|
- condition: state
|
|
|
|
|
|
entity_id: binary_sensor.powerwall_grid_status
|
|
|
|
|
|
state: 'off'
|
|
|
|
|
|
- condition: or
|
|
|
|
|
|
conditions:
|
|
|
|
|
|
- condition: sun
|
|
|
|
|
|
after: sunset
|
|
|
|
|
|
- condition: sun
|
|
|
|
|
|
before: sunrise
|
|
|
|
|
|
action:
|
|
|
|
|
|
- service: water_heater.set_operation_mode
|
|
|
|
|
|
target:
|
|
|
|
|
|
entity_id: water_heater.rheem_wh
|
|
|
|
|
|
data:
|
|
|
|
|
|
state: off
|
|
|
|
|
|
|
|
|
|
|
|
- alias: "Powerwall outage - Rheem WH heat pump after sunrise and 50%"
|
|
|
|
|
|
id: 7b6e8bb0-7d0c-4e63-89cf-ff6e7811b579
|
|
|
|
|
|
description: "During outages, restore water heater to heat pump once battery is healthy during daytime"
|
|
|
|
|
|
mode: single
|
|
|
|
|
|
trigger:
|
|
|
|
|
|
- platform: sun
|
|
|
|
|
|
event: sunrise
|
|
|
|
|
|
- platform: numeric_state
|
|
|
|
|
|
entity_id: sensor.powerwall_charge
|
|
|
|
|
|
above: 50
|
|
|
|
|
|
for:
|
|
|
|
|
|
minutes: 5
|
|
|
|
|
|
- platform: state
|
|
|
|
|
|
entity_id: binary_sensor.powerwall_grid_status
|
|
|
|
|
|
to: 'off'
|
|
|
|
|
|
for:
|
|
|
|
|
|
minutes: 1
|
|
|
|
|
|
condition:
|
|
|
|
|
|
- condition: state
|
|
|
|
|
|
entity_id: binary_sensor.powerwall_grid_status
|
|
|
|
|
|
state: 'off'
|
|
|
|
|
|
- condition: numeric_state
|
|
|
|
|
|
entity_id: sensor.powerwall_charge
|
|
|
|
|
|
above: 50
|
|
|
|
|
|
- condition: sun
|
|
|
|
|
|
after: sunrise
|
|
|
|
|
|
before: sunset
|
|
|
|
|
|
action:
|
|
|
|
|
|
- service: water_heater.set_operation_mode
|
|
|
|
|
|
target:
|
|
|
|
|
|
entity_id: water_heater.rheem_wh
|
|
|
|
|
|
data:
|
|
|
|
|
|
state: heat_pump
|
|
|
|
|
|
|
2025-11-21 17:29:50 -05:00
|
|
|
|
- alias: "Notify to restore PoE ports when grid returns"
|
|
|
|
|
|
id: 1ae8b5c5-8627-4a44-8c8a-5bf8ca5e1bf5
|
|
|
|
|
|
description: "Prompt to turn PoE ports back on after outage shutdown steps"
|
|
|
|
|
|
mode: single
|
|
|
|
|
|
trigger:
|
|
|
|
|
|
- platform: state
|
|
|
|
|
|
entity_id: binary_sensor.powerwall_grid_status
|
|
|
|
|
|
from: 'off'
|
|
|
|
|
|
to: 'on'
|
|
|
|
|
|
for:
|
|
|
|
|
|
minutes: 10
|
|
|
|
|
|
condition:
|
|
|
|
|
|
- condition: or
|
|
|
|
|
|
conditions:
|
|
|
|
|
|
- condition: state
|
|
|
|
|
|
entity_id: switch.poe_garage_port_3_poe
|
|
|
|
|
|
state: 'off'
|
|
|
|
|
|
- condition: state
|
|
|
|
|
|
entity_id: switch.poe_garage_port_4_poe
|
|
|
|
|
|
state: 'off'
|
|
|
|
|
|
- condition: state
|
|
|
|
|
|
entity_id: switch.poe_garage_port_5_poe
|
|
|
|
|
|
state: 'off'
|
|
|
|
|
|
- condition: state
|
|
|
|
|
|
entity_id: switch.poe_garage_port_6_poe
|
|
|
|
|
|
state: 'off'
|
|
|
|
|
|
action:
|
|
|
|
|
|
- service: script.notify_engine
|
|
|
|
|
|
data:
|
|
|
|
|
|
title: "Grid restored - turn PoE ports back on"
|
|
|
|
|
|
value1: "Power is back. Remember to re-enable PoE ports 3-6 if cameras stayed offline."
|
|
|
|
|
|
who: 'family'
|
|
|
|
|
|
group: 'information'
|
|
|
|
|
|
|
2020-06-30 14:28:05 -04:00
|
|
|
|
# https://github.com/CCOSTAN/Home-AssistantConfig/issues/547
|
|
|
|
|
|
- alias: Turn off the Nest Thermostats during a Power Outage
|
2020-07-20 19:33:03 +01:00
|
|
|
|
id: 022bd9da-ab7c-4c1b-9e95-2ff4ffe5f9cc
|
2020-06-30 14:28:05 -04:00
|
|
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
|
|
- platform: state
|
2024-10-18 22:08:06 +00:00
|
|
|
|
entity_id: binary_sensor.powerwall_grid_status
|
2025-08-18 09:23:20 -04:00
|
|
|
|
to: 'off'
|
2020-06-30 14:28:05 -04:00
|
|
|
|
for:
|
2020-07-08 12:10:57 -04:00
|
|
|
|
minutes: 6
|
2020-06-30 14:28:05 -04:00
|
|
|
|
|
|
|
|
|
|
condition:
|
|
|
|
|
|
- condition: template
|
2024-10-18 22:08:06 +00:00
|
|
|
|
value_template: "{{ states('binary_sensor.powerwall_grid_status') == 'off' }}"
|
2020-06-30 14:28:05 -04:00
|
|
|
|
|
|
|
|
|
|
action:
|
|
|
|
|
|
- service: climate.turn_off
|
|
|
|
|
|
data:
|
|
|
|
|
|
entity_id:
|
|
|
|
|
|
- climate.downstairs
|
|
|
|
|
|
- climate.upstairs
|
|
|
|
|
|
|
|
|
|
|
|
- service: script.notify_engine
|
2020-09-26 10:52:45 -04:00
|
|
|
|
data:
|
2020-06-30 14:28:05 -04:00
|
|
|
|
title: "Electrical Grid Status {{ (trigger.to_state.state)|replace('True', 'up')|replace('False', 'down') }}."
|
|
|
|
|
|
value1: "Taking actions to turning off the AC units to preserve Battery Power."
|
|
|
|
|
|
who: 'family'
|
2023-11-17 22:16:41 +00:00
|
|
|
|
group: 'information'
|
2020-06-30 14:28:05 -04:00
|
|
|
|
|
|
|
|
|
|
- alias: Turn back on the Nest Thermostats after a Power Outage
|
2020-07-20 19:33:03 +01:00
|
|
|
|
id: 14faf84b-cb24-4391-a97f-b83479a67fc7
|
2020-06-30 14:28:05 -04:00
|
|
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
|
|
- platform: state
|
2024-10-18 22:08:06 +00:00
|
|
|
|
entity_id: binary_sensor.powerwall_grid_status
|
2025-08-18 09:23:20 -04:00
|
|
|
|
from: 'off'
|
|
|
|
|
|
to: 'on'
|
2020-06-30 14:28:05 -04:00
|
|
|
|
for:
|
2025-08-18 09:23:20 -04:00
|
|
|
|
minutes: 10
|
2020-06-30 14:28:05 -04:00
|
|
|
|
|
|
|
|
|
|
condition:
|
|
|
|
|
|
- condition: template
|
2024-10-18 22:08:06 +00:00
|
|
|
|
value_template: "{{ states('binary_sensor.powerwall_grid_status') == 'on' }}"
|
2020-06-30 14:28:05 -04:00
|
|
|
|
- condition: or
|
|
|
|
|
|
conditions:
|
|
|
|
|
|
- condition: state
|
|
|
|
|
|
entity_id: climate.downstairs
|
|
|
|
|
|
state: 'off'
|
|
|
|
|
|
- condition: state
|
|
|
|
|
|
entity_id: climate.upstairs
|
|
|
|
|
|
state: 'off'
|
|
|
|
|
|
|
|
|
|
|
|
action:
|
|
|
|
|
|
- service: climate.set_hvac_mode
|
|
|
|
|
|
data:
|
2020-07-08 12:10:57 -04:00
|
|
|
|
entity_id: climate.downstairs
|
2025-08-18 09:23:20 -04:00
|
|
|
|
hvac_mode: cool
|
2020-07-08 12:10:57 -04:00
|
|
|
|
- service: climate.set_hvac_mode
|
|
|
|
|
|
data:
|
|
|
|
|
|
entity_id: climate.upstairs
|
|
|
|
|
|
hvac_mode: cool
|
2025-11-03 12:35:24 -05:00
|
|
|
|
- service: climate.set_temperature
|
2020-07-08 12:10:57 -04:00
|
|
|
|
data:
|
|
|
|
|
|
entity_id: climate.upstairs
|
2025-11-03 12:35:24 -05:00
|
|
|
|
temperature: 80
|
2020-07-08 12:10:57 -04:00
|
|
|
|
|
|
|
|
|
|
- service: script.notify_engine
|
2020-09-26 10:52:45 -04:00
|
|
|
|
data:
|
2020-07-08 12:10:57 -04:00
|
|
|
|
title: "Electrical Grid Status {{ (trigger.to_state.state)|replace('True', 'up')|replace('False', 'down') }}."
|
|
|
|
|
|
value1: "All AC systems are set back to normal operations."
|
|
|
|
|
|
who: 'family'
|
2023-11-17 22:16:41 +00:00
|
|
|
|
group: 'information'
|