@@ -317,7 +317,7 @@ async def _verify_daily_readings_exist(
317
317
)
318
318
if not daily_reading :
319
319
_LOGGER .debug (
320
- f' Daily reading for date: { desired_date .strftime (" %Y-%m-%d" )} is missing, calculating manually'
320
+ f" Daily reading for date: { desired_date .strftime (' %Y-%m-%d' )} is missing, calculating manually"
321
321
)
322
322
readings = prefetched_reading
323
323
if not readings :
@@ -330,7 +330,7 @@ async def _verify_daily_readings_exist(
330
330
)
331
331
else :
332
332
_LOGGER .debug (
333
- f' Daily reading for date: { desired_date .strftime (" %Y-%m-%d" )} - using existing prefetched readings'
333
+ f" Daily reading for date: { desired_date .strftime (' %Y-%m-%d' )} - using existing prefetched readings"
334
334
)
335
335
336
336
if readings and readings .data :
@@ -353,16 +353,16 @@ async def _verify_daily_readings_exist(
353
353
)
354
354
if desired_date_reading is None or desired_date_reading .value <= 0 :
355
355
_LOGGER .debug (
356
- f' Couldn\ ' t find daily reading for: { desired_date .strftime (" %Y-%m-%d" ) } '
356
+ f" Couldn't find daily reading for: { desired_date .strftime (' %Y-%m-%d' ) } "
357
357
)
358
358
else :
359
359
daily_readings [device .device_number ].append (
360
360
RemoteReading (0 , desired_date , desired_date_reading .value )
361
361
)
362
362
else :
363
363
_LOGGER .debug (
364
- f' Daily reading for date: { daily_reading .date .strftime (" %Y-%m-%d" ) } '
365
- f' is present: { daily_reading .value } '
364
+ f" Daily reading for date: { daily_reading .date .strftime (' %Y-%m-%d' ) } "
365
+ f" is present: { daily_reading .value } "
366
366
)
367
367
368
368
async def _update_data (
@@ -454,7 +454,9 @@ async def _update_data(
454
454
455
455
devices = await self ._get_devices_by_contract_id (contract_id )
456
456
if not devices :
457
- _LOGGER .debug (f"No devices for contract { contract_id } . Skipping creating devices." )
457
+ _LOGGER .debug (
458
+ f"No devices for contract { contract_id } . Skipping creating devices."
459
+ )
458
460
continue
459
461
460
462
for device in devices or []:
@@ -705,7 +707,14 @@ async def _insert_statistics(self, contract_id: int, is_smart_meter: bool) -> No
705
707
706
708
if readings and readings .meter_start_date :
707
709
# Fetching the last reading from either the installation date or a month ago
708
- month_ago_time = max (month_ago_time , TIMEZONE .localize (datetime .combine (readings .meter_start_date , datetime .min .time ())))
710
+ month_ago_time = max (
711
+ month_ago_time ,
712
+ TIMEZONE .localize (
713
+ datetime .combine (
714
+ readings .meter_start_date , datetime .min .time ()
715
+ )
716
+ ),
717
+ )
709
718
else :
710
719
_LOGGER .debug (
711
720
"[IEC Statistics] Failed to extract field `meterStartDate`, falling back to a month ago"
@@ -1016,8 +1025,10 @@ def _calculate_estimated_bill(
1016
1025
future_consumption_info .total_import - last_meter_read
1017
1026
)
1018
1027
else :
1019
- _LOGGER .warn (f"Failed to calculate Future Consumption, Assuming last meter read \
1020
- ({ last_meter_read } ) as full consumption" )
1028
+ _LOGGER .warn (
1029
+ f"Failed to calculate Future Consumption, Assuming last meter read \
1030
+ ({ last_meter_read } ) as full consumption"
1031
+ )
1021
1032
future_consumption = last_meter_read
1022
1033
1023
1034
kva_price = power_size * kva_tariff / 365
0 commit comments