-
Notifications
You must be signed in to change notification settings - Fork 0
/
goe_solar_pv_loadbalacer.yaml
189 lines (180 loc) · 5.97 KB
/
goe_solar_pv_loadbalacer.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
blueprint:
domain: automation
name: go-e MQTT & Solar Power PV/EV Loadbalancing
description: The integration of Solar Power and go-e MQTT enables dynamic balancing
of photovoltaic (PV) load into your EV.
source_url: https://github.com/woopstar/goe_solar_pv_loadbalacer/blob/main/goe_solar_pv_loadbalacer.yaml
input:
iTimeStart:
name: Automation Activation Time
description: 'Set the time you want the load balancing to activate. This is important to avoid low charging currents during nighttime.'
default: 08:00:00
selector:
time: {}
iTimeEnd:
name: Automation Deactivation Time
description: 'Set the time you want the load balancing to deactivate. This is important to avoid low charging currents during nighttime.'
default: '22:00:00'
selector:
time: {}
iMinimumCurrent:
name: Minimum current for charging
description: "By default: 6A"
selector:
number:
min: 0
max: 32
step: 1
unit_of_measurement: 'A'
mode: slider
default: 6
iMaximumCurrent:
name: Maximum current for charging
description: "By default: 16A"
selector:
number:
min: 0
max: 32
step: 1
unit_of_measurement: 'A'
mode: slider
default: 16
iThreePhaseSwitchLevel:
name: Phase switch level
description: 'Amount of power that needs to be free before we switch between one or three phase charging. By default: 4200W'
selector:
number:
min: 0
max: 7000
step: 1
unit_of_measurement: 'W'
mode: slider
default: 4200
iMeanPowerAvailableForCharging:
name: Solar Power Available For Charging
description: 'Sensor that indicates the amount of available free power to charge the EV/PV by. By default: sensor.mean_solar_power_available_for_charging_over_2_min'
selector:
entity:
domain: sensor
device_class: power
multiple: false
default: sensor.mean_solar_power_available_for_charging_over_2_min
iChargerCurrent:
name: go-E - Requested current
description: 'Requested current to be set from calculations on the charger. By default: number.go_echarger_222819_amp'
selector:
entity:
domain: number
device_class: number
multiple: false
default: number.go_echarger_222819_amp
iForceSinglePhase:
name: go-E - Force single phase
description: 'Switch to shift between one or three phase charging. By default: switch.go_echarger_222819_psm'
selector:
entity:
domain: switch
multiple: false
default: switch.go_echarger_222819_psm
iCarConnected:
name: go-E - Car Connected
description: 'Switch to determine if car is plugged in or not to charger. By default: binary_sensor.go_echarger_222819_car'
selector:
entity:
domain: binary_sensor
multiple: false
default: binary_sensor.go_echarger_222819_car
iAllowCharging:
name: go-E - Switch to allow charging
description: 'Switch to turn charging on and off. By default: switch.go_echarger_222819_allow_charging'
selector:
entity:
domain: switch
multiple: false
default: switch.go_echarger_222819_allow_charging
# Trigger automation when power available changes
trigger:
- platform: state
entity_id:
- !input iMeanPowerAvailableForCharging
condition:
- condition: time
after: !input iTimeStart
before: !input iTimeEnd
- condition: numeric_state
entity_id: sun.sun
above: 7
attribute: elevation
- condition: state
state: "on"
entity_id:
- !input iCarConnected
action:
# Switch between one or three phase
- if:
- condition: template
value_template: "{{ valPowerAvailable | float(0) < entThreePhaseSwitchLevel | int }}"
then:
- service: switch.turn_on
target:
entity_id:
- !input iForceSinglePhase
else:
- service: switch.turn_off
target:
entity_id:
- !input iForceSinglePhase
# Set charger current based on calculations.
- if:
- condition: template
value_template: "{{ valCurrentAvailableForCharging | int >= entMinimumCurrent | int }}"
then:
- service: number.set_value
data:
value: '{{ valCurrentAvailableForCharging | int }}'
target:
entity_id:
- !input iChargerCurrent
else:
- service: number.set_value
data:
value: '{{ entMinimumCurrent | int }}'
target:
entity_id:
- !input iChargerCurrent
# Turn charger on or off based on current
- if:
- condition: template
value_template: "{{ valCurrentAvailableForCharging | int >= entMinimumCurrent | int }}"
then:
- service: switch.turn_on
target:
entity_id:
- !input iAllowCharging
else:
- service: switch.turn_off
target:
entity_id:
- !input iAllowCharging
variables:
entMinimumCurrent: !input iMinimumCurrent
entMaximumCurrent: !input iMaximumCurrent
entThreePhaseSwitchLevel: !input iThreePhaseSwitchLevel
entMeanPowerAvailableForCharging: !input iMeanPowerAvailableForCharging
entChargerCurrent: !input iChargerCurrent
entAllowCharging: !input iAllowCharging
valPowerAvailable: '{{ states(entMeanPowerAvailableForCharging) }}'
valPhases: '{{ 3 if valPowerAvailable | float(1) > entThreePhaseSwitchLevel | int else 1 }}'
valChargerVoltage: "{{ 230 * valPhases | int }}"
valAvailableCurrent: '{{ ( valPowerAvailable | float(1) / valChargerVoltage | int ) | float }}'
valCurrentAvailableForCharging: '
{% set AvailableCurrent = valAvailableCurrent %}
{% if AvailableCurrent < entMinimumCurrent | int %}
{% set AvailableCurrent = 0 %}
{% elif AvailableCurrent > entMaximumCurrent | int %}
{% set AvailableCurrent = entMaximumCurrent | int %}
{% endif %}
{{ AvailableCurrent | default(0) | int }}
'
mode: restart
max_exceeded: silent