@@ -285,6 +285,7 @@ async def _async_update_data(
285
285
daily_readings : dict [str , list [RemoteReading ] | None ] | None = {}
286
286
287
287
is_smart_meter = contracts .get (contract_id ).smart_meter
288
+ is_private_producer = contracts .get (contract_id ).from_private_producer
288
289
attributes_to_add = {CONTRACT_ID_ATTR_NAME : str (contract_id ),
289
290
IS_SMART_METER_ATTR_NAME : is_smart_meter ,
290
291
METER_ID_ATTR_NAME : None }
@@ -373,33 +374,34 @@ async def _async_update_data(
373
374
else :
374
375
_LOGGER .debug ("Failed fetching FutureConsumption, data in IEC API is corrupted" )
375
376
376
- devices_by_id : Devices = await self ._get_devices_by_device_id (device .device_number )
377
- last_meter_read = int (devices_by_id .counter_devices [0 ].last_mr )
378
- last_meter_read_date = devices_by_id .counter_devices [0 ].last_mr_date
379
- phase_count = devices_by_id .counter_devices [0 ].connection_size .phase
380
- connection_size = (devices_by_id .counter_devices [0 ].
381
- connection_size .representative_connection_size )
382
-
383
- distribution_tariff = await self ._get_distribution_tariff (phase_count )
384
- delivery_tariff = await self ._get_delivery_tariff (phase_count )
385
- power_size = await self ._get_power_size (connection_size )
386
-
387
- estimated_bill , fixed_price , consumption_price , total_days , delivery_price , distribution_price , \
388
- total_kva_price , estimated_kwh_consumption = (
389
- self ._calculate_estimated_bill (device .device_number , future_consumption ,
390
- last_meter_read , last_meter_read_date ,
391
- kwh_tariff , kva_tariff , distribution_tariff ,
392
- delivery_tariff , power_size , last_invoice ))
393
-
394
- estimated_bill_dict = {
395
- TOTAL_EST_BILL_ATTR_NAME : estimated_bill ,
396
- EST_BILL_DAYS_ATTR_NAME : total_days ,
397
- EST_BILL_CONSUMPTION_PRICE_ATTR_NAME : consumption_price ,
398
- EST_BILL_DELIVERY_PRICE_ATTR_NAME : delivery_price ,
399
- EST_BILL_DISTRIBUTION_PRICE_ATTR_NAME : distribution_price ,
400
- EST_BILL_TOTAL_KVA_PRICE_ATTR_NAME : total_kva_price ,
401
- EST_BILL_KWH_CONSUMPTION_ATTR_NAME : estimated_kwh_consumption
402
- }
377
+ if not is_private_producer :
378
+ devices_by_id : Devices = await self ._get_devices_by_device_id (device .device_number )
379
+ last_meter_read = int (devices_by_id .counter_devices [0 ].last_mr )
380
+ last_meter_read_date = devices_by_id .counter_devices [0 ].last_mr_date
381
+ phase_count = devices_by_id .counter_devices [0 ].connection_size .phase
382
+ connection_size = (devices_by_id .counter_devices [0 ].
383
+ connection_size .representative_connection_size )
384
+
385
+ distribution_tariff = await self ._get_distribution_tariff (phase_count )
386
+ delivery_tariff = await self ._get_delivery_tariff (phase_count )
387
+ power_size = await self ._get_power_size (connection_size )
388
+
389
+ estimated_bill , fixed_price , consumption_price , total_days , delivery_price , distribution_price , \
390
+ total_kva_price , estimated_kwh_consumption = (
391
+ self ._calculate_estimated_bill (device .device_number , future_consumption ,
392
+ last_meter_read , last_meter_read_date ,
393
+ kwh_tariff , kva_tariff , distribution_tariff ,
394
+ delivery_tariff , power_size , last_invoice ))
395
+
396
+ estimated_bill_dict = {
397
+ TOTAL_EST_BILL_ATTR_NAME : estimated_bill ,
398
+ EST_BILL_DAYS_ATTR_NAME : total_days ,
399
+ EST_BILL_CONSUMPTION_PRICE_ATTR_NAME : consumption_price ,
400
+ EST_BILL_DELIVERY_PRICE_ATTR_NAME : delivery_price ,
401
+ EST_BILL_DISTRIBUTION_PRICE_ATTR_NAME : distribution_price ,
402
+ EST_BILL_TOTAL_KVA_PRICE_ATTR_NAME : total_kva_price ,
403
+ EST_BILL_KWH_CONSUMPTION_ATTR_NAME : estimated_kwh_consumption
404
+ }
403
405
404
406
data [str (contract_id )] = {CONTRACT_DICT_NAME : contracts .get (contract_id ),
405
407
INVOICE_DICT_NAME : last_invoice ,
0 commit comments