|
50 | 50 | native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
51 | 51 | state_class=SensorStateClass.TOTAL_INCREASING, |
52 | 52 | device_class=SensorDeviceClass.ENERGY, |
| 53 | + suggested_display_precision=0, |
53 | 54 | ), |
54 | 55 | SensorEntityDescription( |
55 | 56 | key="lifetime_production", |
56 | 57 | name="Lifetime Energy Production", |
57 | 58 | native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
58 | 59 | state_class=SensorStateClass.TOTAL_INCREASING, |
59 | 60 | device_class=SensorDeviceClass.ENERGY, |
| 61 | + suggested_display_precision=0, |
60 | 62 | ), |
61 | 63 | SensorEntityDescription( |
62 | 64 | key="consumption", |
63 | 65 | name="Current Power Consumption", |
64 | 66 | native_unit_of_measurement=UnitOfPower.WATT, |
65 | 67 | state_class=SensorStateClass.MEASUREMENT, |
66 | 68 | device_class=SensorDeviceClass.POWER, |
| 69 | + suggested_display_precision=0, |
67 | 70 | ), |
68 | 71 | SensorEntityDescription( |
69 | 72 | key="daily_consumption", |
70 | 73 | name="Today's Energy Consumption", |
71 | 74 | native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
72 | 75 | state_class=SensorStateClass.TOTAL_INCREASING, |
73 | 76 | device_class=SensorDeviceClass.ENERGY, |
| 77 | + suggested_display_precision=0, |
74 | 78 | ), |
75 | 79 | SensorEntityDescription( |
76 | 80 | key="lifetime_consumption", |
77 | 81 | name="Lifetime Energy Consumption", |
78 | 82 | native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
79 | 83 | state_class=SensorStateClass.TOTAL_INCREASING, |
80 | 84 | device_class=SensorDeviceClass.ENERGY, |
| 85 | + suggested_display_precision=0, |
81 | 86 | ), |
82 | 87 | SensorEntityDescription( |
83 | 88 | key="inverters", |
|
146 | 151 | ), |
147 | 152 | ) |
148 | 153 |
|
149 | | -PHASE_SENSORS = ( |
150 | | - SensorEntityDescription( |
151 | | - key="production_l1", |
152 | | - name="Current Power Production L1", |
153 | | - native_unit_of_measurement=UnitOfPower.WATT, |
154 | | - state_class=SensorStateClass.MEASUREMENT, |
155 | | - device_class=SensorDeviceClass.POWER, |
156 | | - ), |
157 | | - SensorEntityDescription( |
158 | | - key="daily_production_l1", |
159 | | - name="Today's Energy Production L1", |
160 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
161 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
162 | | - device_class=SensorDeviceClass.ENERGY, |
163 | | - ), |
164 | | - SensorEntityDescription( |
165 | | - key="lifetime_production_l1", |
166 | | - name="Lifetime Energy Production L1", |
167 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
168 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
169 | | - device_class=SensorDeviceClass.ENERGY, |
170 | | - ), |
171 | | - SensorEntityDescription( |
172 | | - key="voltage_l1", |
173 | | - name="Current Voltage L1", |
174 | | - native_unit_of_measurement=UnitOfElectricPotential.VOLT, |
175 | | - state_class=SensorStateClass.MEASUREMENT, |
176 | | - device_class=SensorDeviceClass.VOLTAGE, |
177 | | - ), |
178 | | - SensorEntityDescription( |
179 | | - key="production_l2", |
180 | | - name="Current Power Production L2", |
181 | | - native_unit_of_measurement=UnitOfPower.WATT, |
182 | | - state_class=SensorStateClass.MEASUREMENT, |
183 | | - device_class=SensorDeviceClass.POWER, |
184 | | - ), |
185 | | - SensorEntityDescription( |
186 | | - key="daily_production_l2", |
187 | | - name="Today's Energy Production L2", |
188 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
189 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
190 | | - device_class=SensorDeviceClass.ENERGY, |
191 | | - ), |
192 | | - SensorEntityDescription( |
193 | | - key="lifetime_production_l2", |
194 | | - name="Lifetime Energy Production L2", |
195 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
196 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
197 | | - device_class=SensorDeviceClass.ENERGY, |
198 | | - ), |
199 | | - SensorEntityDescription( |
200 | | - key="voltage_l2", |
201 | | - name="Current Voltage L2", |
202 | | - native_unit_of_measurement=UnitOfElectricPotential.VOLT, |
203 | | - state_class=SensorStateClass.MEASUREMENT, |
204 | | - device_class=SensorDeviceClass.VOLTAGE, |
205 | | - ), |
206 | | - SensorEntityDescription( |
207 | | - key="production_l3", |
208 | | - name="Current Power Production L3", |
209 | | - native_unit_of_measurement=UnitOfPower.WATT, |
210 | | - state_class=SensorStateClass.MEASUREMENT, |
211 | | - device_class=SensorDeviceClass.POWER, |
212 | | - ), |
213 | | - SensorEntityDescription( |
214 | | - key="daily_production_l3", |
215 | | - name="Today's Energy Production L3", |
216 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
217 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
218 | | - device_class=SensorDeviceClass.ENERGY, |
219 | | - ), |
220 | | - SensorEntityDescription( |
221 | | - key="lifetime_production_l3", |
222 | | - name="Lifetime Energy Production L3", |
223 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
224 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
225 | | - device_class=SensorDeviceClass.ENERGY, |
226 | | - ), |
227 | | - SensorEntityDescription( |
228 | | - key="voltage_l3", |
229 | | - name="Current Voltage L3", |
230 | | - native_unit_of_measurement=UnitOfElectricPotential.VOLT, |
231 | | - state_class=SensorStateClass.MEASUREMENT, |
232 | | - device_class=SensorDeviceClass.VOLTAGE, |
233 | | - ), |
234 | | - SensorEntityDescription( |
235 | | - key="consumption_l1", |
236 | | - name="Current Power Consumption L1", |
237 | | - native_unit_of_measurement=UnitOfPower.WATT, |
238 | | - state_class=SensorStateClass.MEASUREMENT, |
239 | | - device_class=SensorDeviceClass.POWER, |
240 | | - ), |
241 | | - SensorEntityDescription( |
242 | | - key="daily_consumption_l1", |
243 | | - name="Today's Energy Consumption L1", |
244 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
245 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
246 | | - device_class=SensorDeviceClass.ENERGY, |
247 | | - ), |
248 | | - SensorEntityDescription( |
249 | | - key="lifetime_consumption_l1", |
250 | | - name="Lifetime Energy Consumption L1", |
251 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
252 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
253 | | - device_class=SensorDeviceClass.ENERGY, |
254 | | - ), |
255 | | - SensorEntityDescription( |
256 | | - key="consumption_l2", |
257 | | - name="Current Power Consumption L2", |
258 | | - native_unit_of_measurement=UnitOfPower.WATT, |
259 | | - state_class=SensorStateClass.MEASUREMENT, |
260 | | - device_class=SensorDeviceClass.POWER, |
261 | | - ), |
262 | | - SensorEntityDescription( |
263 | | - key="daily_consumption_l2", |
264 | | - name="Today's Energy Consumption L2", |
265 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
266 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
267 | | - device_class=SensorDeviceClass.ENERGY, |
268 | | - ), |
269 | | - SensorEntityDescription( |
270 | | - key="lifetime_consumption_l2", |
271 | | - name="Lifetime Energy Consumption L2", |
272 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
273 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
274 | | - device_class=SensorDeviceClass.ENERGY, |
275 | | - ), |
276 | | - SensorEntityDescription( |
277 | | - key="consumption_l3", |
278 | | - name="Current Power Consumption L3", |
279 | | - native_unit_of_measurement=UnitOfPower.WATT, |
280 | | - state_class=SensorStateClass.MEASUREMENT, |
281 | | - device_class=SensorDeviceClass.POWER, |
282 | | - ), |
283 | | - SensorEntityDescription( |
284 | | - key="daily_consumption_l3", |
285 | | - name="Today's Energy Consumption L3", |
286 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
287 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
288 | | - device_class=SensorDeviceClass.ENERGY, |
289 | | - ), |
290 | | - SensorEntityDescription( |
291 | | - key="lifetime_consumption_l3", |
292 | | - name="Lifetime Energy Consumption L3", |
293 | | - native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
294 | | - state_class=SensorStateClass.TOTAL_INCREASING, |
295 | | - device_class=SensorDeviceClass.ENERGY, |
296 | | - ), |
297 | | -) |
| 154 | +PHASE_SENSORS = [] |
| 155 | +for phase in ["l1", "l2", "l3"]: |
| 156 | + PHASE_SENSORS.extend( |
| 157 | + [ |
| 158 | + SensorEntityDescription( |
| 159 | + key=f"production_{phase}", |
| 160 | + name=f"Current Power Production {phase.upper()}", |
| 161 | + native_unit_of_measurement=UnitOfPower.WATT, |
| 162 | + state_class=SensorStateClass.MEASUREMENT, |
| 163 | + device_class=SensorDeviceClass.POWER, |
| 164 | + suggested_display_precision=0, |
| 165 | + ), |
| 166 | + SensorEntityDescription( |
| 167 | + key=f"daily_production_{phase}", |
| 168 | + name=f"Today's Energy Production {phase.upper()}", |
| 169 | + native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
| 170 | + state_class=SensorStateClass.TOTAL_INCREASING, |
| 171 | + device_class=SensorDeviceClass.ENERGY, |
| 172 | + suggested_display_precision=0, |
| 173 | + ), |
| 174 | + SensorEntityDescription( |
| 175 | + key=f"lifetime_production_{phase}", |
| 176 | + name=f"Lifetime Energy Production {phase.upper()}", |
| 177 | + native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
| 178 | + state_class=SensorStateClass.TOTAL_INCREASING, |
| 179 | + device_class=SensorDeviceClass.ENERGY, |
| 180 | + suggested_display_precision=0, |
| 181 | + ), |
| 182 | + SensorEntityDescription( |
| 183 | + key=f"voltage_{phase}", |
| 184 | + name=f"Current Voltage {phase.upper()}", |
| 185 | + native_unit_of_measurement=UnitOfElectricPotential.VOLT, |
| 186 | + state_class=SensorStateClass.MEASUREMENT, |
| 187 | + device_class=SensorDeviceClass.VOLTAGE, |
| 188 | + ), |
| 189 | + # |
| 190 | + # Consumption entities |
| 191 | + # |
| 192 | + SensorEntityDescription( |
| 193 | + key=f"consumption_{phase}", |
| 194 | + name=f"Current Power Consumption {phase.upper()}", |
| 195 | + native_unit_of_measurement=UnitOfPower.WATT, |
| 196 | + state_class=SensorStateClass.MEASUREMENT, |
| 197 | + device_class=SensorDeviceClass.POWER, |
| 198 | + suggested_display_precision=0, |
| 199 | + ), |
| 200 | + SensorEntityDescription( |
| 201 | + key=f"daily_consumption_{phase}", |
| 202 | + name=f"Today's Energy Consumption {phase.upper()}", |
| 203 | + native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
| 204 | + state_class=SensorStateClass.TOTAL_INCREASING, |
| 205 | + device_class=SensorDeviceClass.ENERGY, |
| 206 | + suggested_display_precision=0, |
| 207 | + ), |
| 208 | + SensorEntityDescription( |
| 209 | + key=f"lifetime_consumption_{phase}", |
| 210 | + name=f"Lifetime Energy Consumption {phase.upper()}", |
| 211 | + native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, |
| 212 | + state_class=SensorStateClass.TOTAL_INCREASING, |
| 213 | + device_class=SensorDeviceClass.ENERGY, |
| 214 | + suggested_display_precision=0, |
| 215 | + ), |
| 216 | + ] |
| 217 | + ) |
298 | 218 |
|
299 | 219 | BINARY_SENSORS = ( |
300 | 220 | BinarySensorEntityDescription( |
|
0 commit comments