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
######################################################################################################
2018-08-03 17:55:28 +00:00
#-------------------------------------------
group :
Power :
entities :
2018-11-14 18:17:28 +00:00
- sensor.grid_status
2018-08-03 17:55:28 +00:00
- sensor.powerwall_battery_capacity
- sensor.powerwall_battery_now
- sensor.grid_now
- sensor.house_now
- sensor.solar_now
- camera.grafana_solar_graph
#-------------------------------------------
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-11-26 16:45:25 +00:00
icon_template : >-
{%- if is_state('sensor.grid_status', 'True') %}
mdi:flash
{%- else %}
mdi:flash-off
{%- endif %}
2018-11-14 18:04:38 +00:00
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
- 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
- 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
- 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
2018-11-26 16:45:25 +00:00
icon_template : >-
{%- if states('sensor.powerwall_battery_now') | float > 0 %}
mdi:battery
{%- else %}
mdi:battery-charging
{%- endif %}
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
icon_template : >-
{%- set battery = states('sensor.powerwall_battery_capacity') | float %}
{%- if battery > 90 %}
mdi:battery
{%- elif battery > 80 %}
mdi:battery-90
{%- elif battery > 70 %}
mdi:battery-80
{%- elif battery > 60 %}
mdi:battery-70
{%- elif battery > 50 %}
mdi:battery-60
{%- elif battery > 40 %}
mdi:battery-50
{%- elif battery > 30 %}
mdi:battery-40
{%- elif battery > 20 %}
mdi:battery-30
{%- elif battery > 10 %}
mdi:battery-20
{%- else %}
mdi:battery-outline
{%- endif %}
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
hide_entity : True
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-12-07 00:56:36 +00:00
2018-11-14 18:17:28 +00:00
action :
- service : script.notify_engine
data_template :
2018-11-26 16:45:25 +00:00
value1 : "The electrical grid is reporting to be {{ (trigger.to_state.state)|replace('True', 'up')|replace('False', 'down') }}. Please verify with Tesla App."
2018-11-14 18:17:28 +00:00
who : 'parents'