Skip to content

Commit 00d9df8

Browse files
committed
chore(custom): added additional logging to previous consumption sensors
1 parent ff32a09 commit 00d9df8

File tree

7 files changed

+13
-3
lines changed

7 files changed

+13
-3
lines changed

custom_components/octopus_energy/electricity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def calculate_electricity_consumption_and_cost(
7979

8080
return result
8181
else:
82-
_LOGGER.debug('Skipping electricity consumption and cost calculation as last reset has not changed')
82+
_LOGGER.debug(f'Skipping electricity consumption and cost calculation as last reset has not changed - last_reset: {last_reset}; consumption start: {sorted_consumption_data[0]["start"]}')
8383
else:
8484
_LOGGER.debug(f'Skipping electricity consumption and cost calculation due to lack of data; consumption: {len(consumption_data) if consumption_data is not None else 0}; rates: {len(rate_data) if rate_data is not None else 0}; standing_charge: {standing_charge}')
8585

custom_components/octopus_energy/electricity/previous_accumulative_consumption.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ async def async_update(self):
175175
"consumption": charge["consumption"]
176176
}, consumption_and_cost["charges"]))
177177
}
178+
else:
179+
_LOGGER.debug(f"Skipping calculation for '{self._mpan}/{self._serial_number}'")
178180

179181
self._attributes = dict_to_typed_dict(self._attributes)
180182

custom_components/octopus_energy/electricity/previous_accumulative_cost.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ async def async_update(self):
173173
if target_rate is None:
174174
self._attributes["standing_charge"] = consumption_and_cost["standing_charge"]
175175
self._attributes["total_without_standing_charge"] = consumption_and_cost["total_cost_without_standing_charge"]
176+
177+
else:
178+
_LOGGER.debug(f"Skipping calculation for '{self._mpan}/{self._serial_number}'")
176179

177180
self._attributes = dict_to_typed_dict(self._attributes)
178181

custom_components/octopus_energy/gas/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def calculate_gas_consumption_and_cost(
9595
"charges": charges
9696
}
9797
else:
98-
_LOGGER.debug('Skipping gas consumption and cost calculation as last reset has not changed')
98+
_LOGGER.debug(f'Skipping gas consumption and cost calculation as last reset has not changed - last_reset: {last_reset}; consumption start: {sorted_consumption_data[0]["start"]}')
9999
else:
100100
_LOGGER.debug(f'Skipping gas consumption and cost calculation due to lack of data; consumption: {len(consumption_data) if consumption_data is not None else 0}; rates: {len(rate_data) if rate_data is not None else 0}; standing_charge: {standing_charge}')
101101

custom_components/octopus_energy/gas/previous_accumulative_consumption_cubic_meters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,10 @@ async def async_update(self):
158158
}, consumption_and_cost["charges"])),
159159
"calorific_value": self._calorific_value
160160
}
161+
else:
162+
_LOGGER.debug(f"Skipping calculation for '{self._mprn}/{self._serial_number}'")
161163

162164
self._attributes = dict_to_typed_dict(self._attributes)
163-
super()._handle_coordinator_update()
164165

165166
async def async_added_to_hass(self):
166167
"""Call when entity about to be added to hass."""

custom_components/octopus_energy/gas/previous_accumulative_consumption_kwh.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ async def async_update(self):
151151
}, consumption_and_cost["charges"])),
152152
"calorific_value": self._calorific_value
153153
}
154+
else:
155+
_LOGGER.debug(f"Skipping calculation for '{self._mprn}/{self._serial_number}'")
154156

155157
self._attributes = dict_to_typed_dict(self._attributes)
156158

custom_components/octopus_energy/gas/previous_accumulative_cost.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ async def async_update(self):
156156
}, consumption_and_cost["charges"])),
157157
"calorific_value": self._calorific_value
158158
}
159+
else:
160+
_LOGGER.debug(f"Skipping calculation for '{self._mprn}/{self._serial_number}'")
159161

160162
self._attributes = dict_to_typed_dict(self._attributes)
161163

0 commit comments

Comments
 (0)