forked from lowprize/homeassistant-solax-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
solaxapi.yaml
198 lines (172 loc) · 6.63 KB
/
solaxapi.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
190
191
192
193
194
195
196
197
- resource: https://global.solaxcloud.com/api/v2/dataAccess/realtimeInfo/get
method: POST
headers:
Content-Type: application/json
tokenId: !secret SolaxTokenId
payload: !secret SolaxWifiSnPayload
scan_interval: 300 #Cloud updates once per 5 minutes.
timeout: 60
sensor:
#Status
- name: "Solax cloud connection status"
value_template: "{{ value_json['exception'] }}"
icon: >-
{% if value_json['success'] == true %}mdi:cloud-check-outline
{% else %}mdi:cloud-mdi-cancel-outline
{% endif %}
- name: "Solax cloud last update"
value_template: "{{ strptime(value_json['result']['uploadTime'], '%Y-%m-%d %H:%M:%S').replace(tzinfo=now().tzinfo) }}"
device_class: timestamp
icon: mdi:calendar-range
#Inverter status
- name: "Solax inverter status"
value_template: >-
{% set inverterStatusMap = {
100: 'Waiting for operation',
101: 'Self-test',
102: 'Normal',
103: 'Recoverable Fault',
104: 'Permanent fault',
105: 'Firmware upgrade',
106: 'EPS detection',
107: 'Off-frid',
108: 'Self-test (Italian safety regulations)',
109: 'Sleep mode',
110: 'Standby mode',
111: 'Photovoltaic wake-up battery mode',
112: 'Generator detection mode',
113: 'Generator mode',
114: 'Fast shutdown standby mode',
130: 'VPP mode',
131: 'TOU-Self use',
132: 'TOU-Charging',
133: 'TOU-Discharging'
} %}
{{ inverterStatusMap.get(value_json['result']['inverterStatus'] | int, 'Unknown status') }}
# Solar panel output to inverter (DC)
- name: "Solax PV1 input power"
value_template: "{{ value_json['result']['powerdc1'] | float(0) }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:solar-power
- name: "Solax PV2 input power"
value_template: "{{ value_json['result']['powerdc2'] | float(0) }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:solar-power
- name: "Solax PV3 input power"
value_template: "{{ value_json['result']['powerdc3'] | float(0) }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:solar-power
- name: "Solax PV4 input power"
value_template: "{{ value_json['result']['powerdc4'] | float(0) }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:solar-power
# Solax doesn't supply a total of all PV arrays
- name: "Solax PV total input power"
value_template: "{{ value_json['result']['powerdc1'] | float(0) + value_json['result']['powerdc2'] | float(0) + value_json['result']['powerdc3'] | float(0) + value_json['result']['powerdc4'] | float(0) }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:solar-power
#Inverter output
- name: "Solax inverter output power"
value_template: "{{ value_json['result']['acpower'] | float }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:solar-panel-large
#Grid data
- name: "Solax grid export power"
value_template: "{{ value_json['result']['feedinpower'] | float }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:transmission-tower-export
#Consume power is not provided by Solax and calculated
- name: "Solax consume power"
value_template: "{{ value_json['result']['acpower'] | float(0) - value_json['result']['feedinpower'] | float(0) }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:home-lightning-bolt-outline
#Meter 2
- name: "Solax meter 2 power"
value_template: "{{ value_json['result']['feedinpowerM2'] | float }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:transmission-tower-export
#Battery
- name: "Solax battery status"
value_template: >-
{% set batStatusMap = {
0: 'Normal',
1: 'Fault',
2: 'Disconnected'
} %}
{{ batStatusMap.get(value_json['result']['batStatus'] | int, 'Unknown status') }}
icon: >-
{% set batStatus = value_json['result']['batStatus'] | int %}
{% if batStatus == 0 %}mdi:battery-check
{% elif batStatus == 1 %}mdi:battery-alert
{% elif batStatus == 2 %}mdi:battery-remove
{% else %}mdi:battery-unknown
{% endif %}
- name: "Solax battery capacity"
value_template: "{{ value_json['result']['soc'] | float }}"
unit_of_measurement: "%"
state_class: measurement
device_class: battery
- name: "Solax battery power"
value_template: "{{ value_json['result']['batPower'] | float }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: mdi:power-plug-battery-outline
- name: "Solax EPS A phase active power"
value_template: "{{ value_json['result']['peps1'] | float }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
- name: "Solax EPS B phase active power"
value_template: "{{ value_json['result']['peps2'] | float }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
- name: "Solax EPS C phase active power"
value_template: "{{ value_json['result']['peps3'] | float }}"
unit_of_measurement: "W"
device_class: power
state_class: measurement
#Inverter statistics
- name: "Solax yield energy today"
value_template: "{{ value_json['result']['yieldtoday'] | float }}"
unit_of_measurement: "kWh"
device_class: energy
state_class: total
icon: mdi:solar-power-variant-outline
- name: "Solax yield energy total"
value_template: "{{ value_json['result']['yieldtotal'] | float }}"
unit_of_measurement: "kWh"
device_class: energy
state_class: total
icon: mdi:solar-power-variant-outline
- name: "Solax grid energy import total"
value_template: "{{ value_json['result']['consumeenergy'] | float }}"
unit_of_measurement: "kWh"
device_class: energy
state_class: total
icon: mdi:transmission-tower-import
- name: "Solax grid energy export total"
value_template: "{{ value_json['result']['feedinenergy'] | float }}"
unit_of_measurement: "kWh"
device_class: energy
state_class: total
icon: mdi:transmission-tower-export