/
dombusevse_automations.yaml
190 lines (189 loc) · 5.09 KB
/
dombusevse_automations.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
# Set the EVMAXCURRENT parameter
- id: '1686869578501'
alias: EVMaxCurrentAutomation
trigger:
- platform: state
entity_id:
- input_number.evmaxcurrent
condition: []
action:
- service: modbus.write_register
data:
hub: dombus1
slave: 227
address: 9001
value: '{{ states(''input_number.evmaxcurrent'') | int }}'
mode: single
# Set the EVMAXPOWER parameter
- id: '1686869578502'
alias: EVMaxGridPowerAutomation
trigger:
- platform: state
entity_id: input_number.evmaxgridpower
action:
- service: modbus.write_register
data:
hub: dombus1
slave: 227
address: 9002
value: '{{ states(''input_number.evmaxgridpower'') | int }}'
mode: single
# Set the EVSTARTPOWER parameter
- id: '1686869578503'
alias: EVStartPowerAutomation
trigger:
- platform: state
entity_id: input_number.evstartpower
action:
- service: modbus.write_register
data:
hub: dombus1
slave: 227
address: 9003
value: '{{ states(''input_number.evstartpower'') | int }}'
mode: single
# Set the EVSTOPTIME parameter
- id: '1686869578504'
alias: EVStopTimeAutomation
trigger:
- platform: state
entity_id: input_number.evstoptime
action:
- service: modbus.write_register
data:
hub: dombus1
slave: 227
address: 9004
value: '{{ states(''input_number.evstoptime'') | int }}'
mode: single
# Set the EVAUTOSTART parameter
- id: '1686869578505'
alias: EVAutoStartAutomation
trigger:
- platform: state
entity_id: input_number.evautostart
action:
- service: modbus.write_register
data:
hub: dombus1
slave: 227
address: 9005
value: '{{ states(''input_number.evautostart'') | int }}'
mode: single
# Set the EVMAXPOWER2 parameter
- id: '1686869578506'
alias: EVMaxPower2
trigger:
- platform: state
entity_id: input_number.evmaxpower2
action:
- service: modbus.write_register
data:
hub: dombus1
slave: 227
address: 9006
value: '{{ states(''input_number.evmaxpower2'') | int }}'
mode: single
# Set the EVMAXPOWERTIME parameter
- id: '1686869578507'
alias: EVMaxPowerTimeAutomation
trigger:
- platform: state
entity_id: input_number.evmaxpowertime
action:
- service: modbus.write_register
data:
hub: dombus1
slave: 227
address: 9007
value: '{{ states(''input_number.evmaxpowertime'') | int }}'
mode: single
# Set the EVMAXPOWERTIME2 parameter
- id: '1686869578508'
alias: EVMaxPowerTime2Automation
trigger:
- platform: state
entity_id: input_number.evmaxpowertime2
action:
- service: modbus.write_register
data:
hub: dombus1
slave: 227
address: 9008
value: '{{ states(''input_number.evmaxpowertime2'') | int }}'
mode: single
# Set the EVWAITTIME parameter
- id: '1686869578509'
alias: EVWaitTimeAutomation
trigger:
- platform: state
entity_id: input_number.evwaittime
action:
- service: modbus.write_register
data:
hub: dombus1
slave: 227
address: 9009
value: '{{ states(''input_number.evwaittime'') | int }}'
mode: single
# Update the EVStateName entity with the name associated to EVState number (convert from numeric state to mnemonic)
- id: "evstatenameautomation"
trigger:
- platform: state
entity_id: sensor.evstate
action:
- service: input_select.select_option
data:
entity_id: input_select.evstatename
option: >
{% set slist = state_attr('input_select.evstatename','options') %}
{% set item = states.sensor.evstate.state|int %}
{{slist[item]}}
# Update the EVModeName entity with the name associated to the current EVMode value (convert from numeric state to mnemonic)
- id: "evmodenameautomation"
trigger:
- platform: state
entity_id: sensor.evmode
action:
- service: input_select.select_option
data:
entity_id: input_select.evmodename
option: >
{% set slist = state_attr('input_select.evmodename','options') %}
{% set item = states.sensor.evmode.state|int %}
{{slist[item]}}
# Update EVMode from EVModeName when button EVStateSet is pushed"
- id: "evmodenameautomationrev"
trigger:
- platform: state
entity_id: input_button.evmodeset
action:
- service: modbus.write_register
data:
hub: dombus1
slave: 227
address: 3
value: >
{% set slist = state_attr('input_select.evmodename','options') %}
{% set itemname = states.input_select.evmodename.state %}
{% set itemnum = 0 %}
{% for name in slist %}
{% if name == itemname %}
{{ loop.index0 }}
{% endif %}
{% endfor %}
# Set the GridPower EVSE entity with the current power sinked from the electrical grid
- id: 'evgridpowerautomation'
alias: EVGridPowerAutomation
trigger:
- platform: state
# Set below your grid power meter entity
entity_id: sensor.evpower
action:
- service: modbus.write_register
data:
hub: dombus1
slave: 227
address: 11
value: '{{ states(''sensor.evpower'') | int }}'
mode: single