2018-06-19 15:21:32 +00: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 18:28:05 +00:00
|
|
|
# Read more about this on https://www.vcloudinfo.com
|
2018-06-19 15:21:32 +00:00
|
|
|
######################################################################################################
|
|
|
|
|
2018-03-16 06:17:38 +00:00
|
|
|
sensor:
|
2018-11-14 18:04:38 +00:00
|
|
|
- platform: rest
|
|
|
|
resource: https://192.168.10.90/api/system_status/grid_status
|
|
|
|
verify_ssl: false
|
|
|
|
method: GET
|
|
|
|
name: Grid Status
|
|
|
|
scan_interval: 60
|
|
|
|
value_template: "{{ value_json.grid_status == 'SystemGridConnected' }}"
|
|
|
|
|
2018-03-16 06:17:38 +00:00
|
|
|
- platform: rest
|
2018-03-16 17:27:11 +00:00
|
|
|
name: House now
|
2018-06-25 20:12:51 +00:00
|
|
|
resource: https://192.168.10.90/api/meters/aggregates
|
2018-03-16 06:17:38 +00:00
|
|
|
method: GET
|
2018-06-25 20:12:51 +00:00
|
|
|
verify_ssl: false
|
2018-11-26 16:45:25 +00:00
|
|
|
value_template: '{{ value_json.load.instant_power / 1000 | round(2) }}'
|
2018-03-16 06:17:38 +00:00
|
|
|
unit_of_measurement: kWh
|
2019-07-16 22:24:03 +00:00
|
|
|
device_class: power
|
2018-03-16 06:17:38 +00:00
|
|
|
|
|
|
|
- platform: rest
|
2018-03-16 17:27:11 +00:00
|
|
|
name: Grid now
|
2018-06-25 20:12:51 +00:00
|
|
|
resource: https://192.168.10.90/api/meters/aggregates
|
2018-03-16 06:17:38 +00:00
|
|
|
method: GET
|
2018-06-25 20:12:51 +00:00
|
|
|
verify_ssl: false
|
2018-11-26 18:47:27 +00:00
|
|
|
value_template: '{{ value_json.site.instant_power / 1000 | round(2) }}'
|
2018-03-16 06:17:38 +00:00
|
|
|
unit_of_measurement: kWh
|
2019-07-16 22:24:03 +00:00
|
|
|
device_class: power
|
2018-03-16 06:17:38 +00:00
|
|
|
|
|
|
|
- platform: rest
|
2018-03-16 17:27:11 +00:00
|
|
|
name: Solar now
|
2018-06-25 20:12:51 +00:00
|
|
|
resource: https://192.168.10.90/api/meters/aggregates
|
2018-03-16 06:17:38 +00:00
|
|
|
method: GET
|
2018-06-25 20:12:51 +00:00
|
|
|
verify_ssl: false
|
2018-11-26 18:47:27 +00:00
|
|
|
value_template: '{{ value_json.solar.instant_power / 1000 | round(2) }}'
|
2018-03-16 06:17:38 +00:00
|
|
|
unit_of_measurement: kWh
|
2019-07-16 22:24:03 +00:00
|
|
|
device_class: power
|
2018-03-16 06:17:38 +00:00
|
|
|
|
|
|
|
- platform: rest
|
|
|
|
name: PowerWall Battery now
|
2018-06-25 20:12:51 +00:00
|
|
|
resource: https://192.168.10.90/api/meters/aggregates
|
2018-03-16 06:17:38 +00:00
|
|
|
method: GET
|
2018-06-25 20:12:51 +00:00
|
|
|
verify_ssl: false
|
2018-11-26 18:47:27 +00:00
|
|
|
value_template: '{{ value_json.battery.instant_power / 1000 | round(2) }}'
|
2018-03-16 06:17:38 +00:00
|
|
|
unit_of_measurement: kWh
|
2019-07-16 22:24:03 +00:00
|
|
|
device_class: power
|
2018-03-16 06:17:38 +00:00
|
|
|
|
|
|
|
- platform: rest
|
|
|
|
name: PowerWall Battery Capacity
|
2018-06-25 20:12:51 +00:00
|
|
|
resource: https://192.168.10.90/api/system_status/soe
|
2018-03-16 06:17:38 +00:00
|
|
|
method: GET
|
2018-06-25 20:12:51 +00:00
|
|
|
verify_ssl: false
|
2018-11-26 16:45:25 +00:00
|
|
|
value_template: '{{ (value_json.percentage | float | round(0)) }}'
|
|
|
|
unit_of_measurement: '%'
|
|
|
|
scan_interval: 300
|
2019-07-16 21:52:41 +00:00
|
|
|
device_class: battery
|
2018-03-16 06:17:38 +00:00
|
|
|
|
|
|
|
#-------------------------------------------
|
2018-06-19 15:21:32 +00:00
|
|
|
# Located in the Grafana package. Tweets out Solar Production Daily!
|
2018-11-14 18:17:28 +00:00
|
|
|
#
|
|
|
|
automation:
|
|
|
|
- alias: Notify if Grid is down
|
2020-07-20 18:33:03 +00:00
|
|
|
id: 56a32121-5725-4510-a1fa-10f69a5c82ef
|
2018-11-14 18:17:28 +00:00
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id: sensor.grid_status
|
2018-12-07 00:56:36 +00:00
|
|
|
condition:
|
|
|
|
condition: or
|
|
|
|
conditions:
|
|
|
|
- condition: template
|
2019-01-13 01:16:44 +00:00
|
|
|
value_template: "{{ states('sensor.grid_status') == 'True' }}"
|
2018-12-07 00:56:36 +00:00
|
|
|
- condition: template
|
2019-01-13 01:16:44 +00:00
|
|
|
value_template: "{{ states('sensor.grid_status') == 'False' }}"
|
2018-11-14 18:17:28 +00:00
|
|
|
action:
|
|
|
|
- service: script.notify_engine
|
|
|
|
data_template:
|
2020-06-27 14:32:29 +00:00
|
|
|
title: "Electrical Grid Status {{ (trigger.to_state.state)|replace('True', 'up')|replace('False', 'down') }}."
|
|
|
|
value1: "Please verify with the Tesla App."
|
2018-11-14 18:17:28 +00:00
|
|
|
who: 'parents'
|
2020-06-07 20:23:56 +00:00
|
|
|
apns_id: 'information'
|
2020-06-27 14:32:29 +00:00
|
|
|
|
|
|
|
# https://github.com/CCOSTAN/Home-AssistantConfig/issues/779
|
|
|
|
- alias: Shut Things down if running on PowerWall
|
2020-07-20 18:33:03 +00:00
|
|
|
id: 37288a96-5f49-46c2-85c8-7e8794d23612
|
2020-06-27 14:32:29 +00:00
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id: sensor.grid_status
|
|
|
|
from: 'True'
|
|
|
|
to: 'False'
|
2020-06-30 18:28:05 +00:00
|
|
|
for:
|
|
|
|
minutes: 1
|
2020-06-27 14:32:29 +00:00
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('sensor.grid_status') == 'False' }}"
|
|
|
|
action:
|
|
|
|
- service: homeassistant.turn_off
|
|
|
|
entity_id:
|
|
|
|
- group.interior_lights
|
|
|
|
- group.exterior_lights
|
|
|
|
- service: script.notify_engine
|
|
|
|
data_template:
|
|
|
|
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'
|
|
|
|
apns_id: 'information'
|
2020-06-30 18:28:05 +00:00
|
|
|
|
|
|
|
# https://github.com/CCOSTAN/Home-AssistantConfig/issues/547
|
|
|
|
- alias: Turn off the Nest Thermostats during a Power Outage
|
2020-07-20 18:33:03 +00:00
|
|
|
id: 022bd9da-ab7c-4c1b-9e95-2ff4ffe5f9cc
|
2020-06-30 18:28:05 +00:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id: sensor.grid_status
|
|
|
|
from: 'True'
|
|
|
|
to: 'False'
|
|
|
|
for:
|
2020-07-08 16:10:57 +00:00
|
|
|
minutes: 6
|
2020-06-30 18:28:05 +00:00
|
|
|
|
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('sensor.grid_status') == 'False' }}"
|
|
|
|
|
|
|
|
action:
|
|
|
|
- service: climate.turn_off
|
|
|
|
data:
|
|
|
|
entity_id:
|
|
|
|
- climate.downstairs
|
|
|
|
- climate.upstairs
|
|
|
|
|
|
|
|
- service: script.notify_engine
|
|
|
|
data_template:
|
|
|
|
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'
|
|
|
|
apns_id: 'information'
|
|
|
|
|
|
|
|
- alias: Turn back on the Nest Thermostats after a Power Outage
|
2020-07-20 18:33:03 +00:00
|
|
|
id: 14faf84b-cb24-4391-a97f-b83479a67fc7
|
2020-06-30 18:28:05 +00:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id: sensor.grid_status
|
|
|
|
from: 'False'
|
|
|
|
to: 'True'
|
|
|
|
for:
|
|
|
|
minutes: 5
|
|
|
|
|
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('sensor.grid_status') == 'True' }}"
|
|
|
|
- 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 16:10:57 +00:00
|
|
|
entity_id: climate.downstairs
|
|
|
|
hvac_mode: auto
|
|
|
|
- service: climate.set_hvac_mode
|
|
|
|
data:
|
|
|
|
entity_id: climate.upstairs
|
|
|
|
hvac_mode: cool
|
|
|
|
- service: climate.set_preset_mode
|
|
|
|
data:
|
|
|
|
entity_id: climate.upstairs
|
|
|
|
preset_mode: eco
|
|
|
|
|
|
|
|
- service: script.notify_engine
|
|
|
|
data_template:
|
|
|
|
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'
|
|
|
|
apns_id: 'information'
|