###################################################################################################### ### @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 # Read more about this on https://www.vcloudinfo.com ###################################################################################################### sensor: - 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' }}" - platform: rest name: House now resource: https://192.168.10.90/api/meters/aggregates method: GET verify_ssl: false value_template: '{{ value_json.load.instant_power / 1000 | round(2) }}' unit_of_measurement: kWh device_class: power - platform: rest name: Grid now resource: https://192.168.10.90/api/meters/aggregates method: GET verify_ssl: false value_template: '{{ value_json.site.instant_power / 1000 | round(2) }}' unit_of_measurement: kWh device_class: power - platform: rest name: Solar now resource: https://192.168.10.90/api/meters/aggregates method: GET verify_ssl: false value_template: '{{ value_json.solar.instant_power / 1000 | round(2) }}' unit_of_measurement: kWh device_class: power - platform: rest name: PowerWall Battery now resource: https://192.168.10.90/api/meters/aggregates method: GET verify_ssl: false value_template: '{{ value_json.battery.instant_power / 1000 | round(2) }}' unit_of_measurement: kWh device_class: power - platform: rest name: PowerWall Battery Capacity resource: https://192.168.10.90/api/system_status/soe method: GET verify_ssl: false value_template: '{{ (value_json.percentage | float | round(0)) }}' unit_of_measurement: '%' scan_interval: 300 device_class: battery #------------------------------------------- # Located in the Grafana package. Tweets out Solar Production Daily! # automation: - alias: Notify if Grid is down trigger: - platform: state entity_id: sensor.grid_status condition: condition: or conditions: - condition: template value_template: "{{ states('sensor.grid_status') == 'True' }}" - condition: template value_template: "{{ states('sensor.grid_status') == 'False' }}" action: - service: script.notify_engine data_template: title: "Electrical Grid Status {{ (trigger.to_state.state)|replace('True', 'up')|replace('False', 'down') }}." value1: "Please verify with the Tesla App." who: 'parents' apns_id: 'information' # https://github.com/CCOSTAN/Home-AssistantConfig/issues/779 - alias: Shut Things down if running on PowerWall trigger: - platform: state entity_id: sensor.grid_status from: 'True' to: 'False' for: minutes: 1 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' # https://github.com/CCOSTAN/Home-AssistantConfig/issues/547 - alias: Turn off the Nest Thermostats during a Power Outage trigger: - platform: state entity_id: sensor.grid_status from: 'True' to: 'False' for: minutes: 6 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 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: 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'