16
16
"total_power" ,
17
17
DEVICE_CLASS_POWER ,
18
18
],
19
- "total_reactive_power" : [
20
- "Total consumption - Reactive power" ,
21
- None ,
22
- POWER_WATT ,
23
- "total_reactive_power" ,
24
- DEVICE_CLASS_POWER ,
25
- ],
26
19
"alwayson" : [
27
20
"Always on - Active power" ,
28
21
None ,
59
52
None ,
60
53
],
61
54
}
55
+ REACTIVE_SENSORS = {
56
+ "total_reactive_power" : [
57
+ "Total consumption - Reactive power" ,
58
+ None ,
59
+ POWER_WATT ,
60
+ "total_reactive_power" ,
61
+ DEVICE_CLASS_POWER ,
62
+ ]
63
+ }
62
64
SOLAR_SENSORS = {
63
65
"solar_power" : [
64
66
"Total production - Active power" ,
88
90
"mdi:flash" ,
89
91
VOLT ,
90
92
"phase_voltage_a" ,
91
- ["ONE" , "TWO" , "THREE_STAR" , "THREE_DELTA" ],
92
93
None ,
94
+ ["ONE" , "TWO" , "THREE_STAR" , "THREE_DELTA" ],
93
95
],
94
96
"phase_voltages_b" : [
95
97
"Phase voltages - B" ,
96
98
"mdi:flash" ,
97
99
VOLT ,
98
100
"phase_voltage_b" ,
99
- ["TWO" , "THREE_STAR" , "THREE_DELTA" ],
100
101
None ,
102
+ ["TWO" , "THREE_STAR" , "THREE_DELTA" ],
101
103
],
102
104
"phase_voltages_c" : [
103
105
"Phase voltages - C" ,
104
106
"mdi:flash" ,
105
107
VOLT ,
106
108
"phase_voltage_c" ,
107
- ["THREE_STAR" ],
108
109
None ,
110
+ ["THREE_STAR" ],
109
111
],
110
112
"line_voltages_a" : [
111
113
"Line voltages - A" ,
112
114
"mdi:flash" ,
113
115
VOLT ,
114
116
"line_voltage_a" ,
115
- ["ONE" , "TWO" , "THREE_STAR" , "THREE_DELTA" ],
116
117
None ,
118
+ ["ONE" , "TWO" , "THREE_STAR" , "THREE_DELTA" ],
117
119
],
118
120
"line_voltages_b" : [
119
121
"Line voltages - B" ,
120
122
"mdi:flash" ,
121
123
VOLT ,
122
124
"line_voltage_b" ,
123
- ["TWO" , "THREE_STAR" , "THREE_DELTA" ],
124
125
None ,
126
+ ["TWO" , "THREE_STAR" , "THREE_DELTA" ],
125
127
],
126
128
"line_voltages_c" : [
127
129
"Line voltages - C" ,
128
130
"mdi:flash" ,
129
131
VOLT ,
130
132
"line_voltage_c" ,
131
- ["THREE_STAR" , "THREE_DELTA" ],
132
133
None ,
134
+ ["THREE_STAR" , "THREE_DELTA" ],
133
135
],
134
136
}
135
137
@@ -151,6 +153,17 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
151
153
)
152
154
)
153
155
156
+ if service_location .has_reactive_value :
157
+ for reactive_sensor in REACTIVE_SENSORS :
158
+ entities .append (
159
+ SmappeeSensor (
160
+ smappee_base = smappee_base ,
161
+ service_location = service_location ,
162
+ sensor = reactive_sensor ,
163
+ attributes = REACTIVE_SENSORS [reactive_sensor ],
164
+ )
165
+ )
166
+
154
167
# Add solar sensors
155
168
if service_location .has_solar_production :
156
169
for sensor in SOLAR_SENSORS :
@@ -180,17 +193,18 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
180
193
)
181
194
)
182
195
183
- # Add phase- and line voltages
184
- for sensor_name , sensor in VOLTAGE_SENSORS .items ():
185
- if service_location .phase_type in sensor [4 ]:
186
- entities .append (
187
- SmappeeSensor (
188
- smappee_base = smappee_base ,
189
- service_location = service_location ,
190
- sensor = sensor_name ,
191
- attributes = sensor ,
196
+ # Add phase- and line voltages if available
197
+ if service_location .has_voltage_values :
198
+ for sensor_name , sensor in VOLTAGE_SENSORS .items ():
199
+ if service_location .phase_type in sensor [5 ]:
200
+ entities .append (
201
+ SmappeeSensor (
202
+ smappee_base = smappee_base ,
203
+ service_location = service_location ,
204
+ sensor = sensor_name ,
205
+ attributes = sensor ,
206
+ )
192
207
)
193
- )
194
208
195
209
# Add Gas and Water sensors
196
210
for sensor_id , sensor in service_location .sensors .items ():
0 commit comments