Skip to content

Commit

Permalink
chore: Merged main into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Nov 8, 2023
2 parents 7ed2441 + 51caf24 commit 0959223
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [8.5.2](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/compare/v8.5.1...v8.5.2) (2023-11-08)


### Bug Fixes

* Fixed previous consumption peak/off peak sensors ([b3d4f6f](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/b3d4f6f876f0d3630bedec350e20c7c7c9f541f5))

## [8.5.1](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/compare/v8.5.0...v8.5.1) (2023-11-02)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ async def async_update(self):
if not self.enabled:
return

current = now()
consumption_data = self.coordinator.data["consumption"] if self.coordinator is not None and self.coordinator.data is not None and "consumption" in self.coordinator.data else None
rate_data = self.coordinator.data["rates"] if self.coordinator is not None and self.coordinator.data is not None and "rates" in self.coordinator.data else None
standing_charge = self.coordinator.data["standing_charge"] if self.coordinator is not None and self.coordinator.data is not None and "standing_charge" in self.coordinator.data else None
current = consumption_data[0]["interval_start"] if consumption_data is not None and len(consumption_data) > 0 else None

consumption_and_cost = calculate_electricity_consumption_and_cost(
current,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def last_reset(self):
@property
def state(self):
"""Retrieve the previous days accumulative consumption"""
current = now()
consumption_data = self.coordinator.data["consumption"] if self.coordinator is not None and self.coordinator.data is not None and "consumption" in self.coordinator.data else None
rate_data = self.coordinator.data["rates"] if self.coordinator is not None and self.coordinator.data is not None and "rates" in self.coordinator.data else None
standing_charge = self.coordinator.data["standing_charge"] if self.coordinator is not None and self.coordinator.data is not None and "standing_charge" in self.coordinator.data else None
current = consumption_data[0]["interval_start"] if consumption_data is not None and len(consumption_data) > 0 else None

consumption_and_cost = calculate_electricity_consumption_and_cost(
current,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def last_reset(self):
@property
def state(self):
"""Retrieve the previous days accumulative consumption"""
current = now()
consumption_data = self.coordinator.data["consumption"] if self.coordinator is not None and self.coordinator.data is not None and "consumption" in self.coordinator.data else None
rate_data = self.coordinator.data["rates"] if self.coordinator is not None and self.coordinator.data is not None and "rates" in self.coordinator.data else None
standing_charge = self.coordinator.data["standing_charge"] if self.coordinator is not None and self.coordinator.data is not None and "standing_charge" in self.coordinator.data else None
current = consumption_data[0]["interval_start"] if consumption_data is not None and len(consumption_data) > 0 else None

consumption_and_cost = calculate_electricity_consumption_and_cost(
current,
Expand All @@ -109,7 +109,7 @@ def state(self):
self._state = consumption_and_cost["total_consumption_peak"] if "total_consumption_peak" in consumption_and_cost else 0
self._last_reset = consumption_and_cost["last_reset"]

self._attributes["last_calculated_timestamp"] = consumption_and_cost["last_calculated_timestamp"]
self._attributes["last_evaluated"] = consumption_and_cost["last_calculated_timestamp"]

return self._state

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,10 @@ async def async_update(self):
if not self.enabled:
return

current = now()
consumption_data = self.coordinator.data["consumption"] if self.coordinator is not None and self.coordinator.data is not None and "consumption" in self.coordinator.data else None
rate_data = self.coordinator.data["rates"] if self.coordinator is not None and self.coordinator.data is not None and "rates" in self.coordinator.data else None
standing_charge = self.coordinator.data["standing_charge"] if self.coordinator is not None and self.coordinator.data is not None and "standing_charge" in self.coordinator.data else None
current = now()
current = consumption_data[0]["interval_start"] if consumption_data is not None and len(consumption_data) > 0 else None

consumption_and_cost = calculate_electricity_consumption_and_cost(
current,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ def last_reset(self):
@property
def state(self):
"""Retrieve the previously calculated state"""
current = now()
consumption_data = self.coordinator.data["consumption"] if self.coordinator is not None and self.coordinator.data is not None and "consumption" in self.coordinator.data else None
rate_data = self.coordinator.data["rates"] if self.coordinator is not None and self.coordinator.data is not None and "rates" in self.coordinator.data else None
standing_charge = self.coordinator.data["standing_charge"] if self.coordinator is not None and self.coordinator.data is not None and "standing_charge" in self.coordinator.data else None
current = consumption_data[0]["interval_start"] if consumption_data is not None and len(consumption_data) > 0 else None

consumption_and_cost = calculate_electricity_consumption_and_cost(
current,
Expand All @@ -107,7 +107,7 @@ def state(self):
self._last_reset = consumption_and_cost["last_reset"]
self._state = consumption_and_cost["total_cost_off_peak"] if "total_cost_off_peak" in consumption_and_cost else 0

self._attributes["last_calculated_timestamp"] = consumption_and_cost["last_calculated_timestamp"]
self._attributes["last_evaluated"] = consumption_and_cost["last_calculated_timestamp"]

return self._state

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ def last_reset(self):
@property
def state(self):
"""Retrieve the previously calculated state"""
current = now()
consumption_data = self.coordinator.data["consumption"] if self.coordinator is not None and self.coordinator.data is not None and "consumption" in self.coordinator.data else None
rate_data = self.coordinator.data["rates"] if self.coordinator is not None and self.coordinator.data is not None and "rates" in self.coordinator.data else None
standing_charge = self.coordinator.data["standing_charge"] if self.coordinator is not None and self.coordinator.data is not None and "standing_charge" in self.coordinator.data else None
current = consumption_data[0]["interval_start"] if consumption_data is not None and len(consumption_data) > 0 else None

consumption_and_cost = calculate_electricity_consumption_and_cost(
current,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues",
"ssdp": [],
"version": "8.5.1",
"version": "8.5.2",
"zeroconf": []
}

0 comments on commit 0959223

Please sign in to comment.