Skip to content

Commit

Permalink
fix: fixed tariff override data having rate value in pounds and pence…
Browse files Browse the repository at this point in the history
… for consistency

BREAKING CHANGE:
If you were using tariff override rate information, you may need to adjust your use due to changes
in how value is reported
  • Loading branch information
BottlecapDave committed Apr 17, 2024
1 parent 95ac448 commit 48f832a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from ..utils.attributes import dict_to_typed_dict
from ..utils.requests import calculate_next_refresh
from ..coordinators.previous_consumption_and_rates import PreviousConsumptionCoordinatorResult
from ..utils import private_rates_to_public_rates

from ..api_client import (ApiException, OctopusEnergyApiClient)

Expand Down Expand Up @@ -178,7 +179,7 @@ async def async_update(self):
}, consumption_and_cost["charges"]))
}

self._hass.bus.async_fire(EVENT_ELECTRICITY_PREVIOUS_CONSUMPTION_OVERRIDE_RATES, { "mpan": self._mpan, "serial_number": self._serial_number, "tariff_code": self._tariff_code, "rates": rate_data })
self._hass.bus.async_fire(EVENT_ELECTRICITY_PREVIOUS_CONSUMPTION_OVERRIDE_RATES, { "mpan": self._mpan, "serial_number": self._serial_number, "tariff_code": self._tariff_code, "rates": private_rates_to_public_rates(rate_data) })

self._attributes["last_evaluated"] = current
self._request_attempts = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from ..utils.attributes import dict_to_typed_dict
from ..utils.requests import calculate_next_refresh
from ..coordinators.previous_consumption_and_rates import PreviousConsumptionCoordinatorResult
from ..utils import private_rates_to_public_rates

from ..const import DOMAIN, EVENT_GAS_PREVIOUS_CONSUMPTION_OVERRIDE_RATES, MINIMUM_CONSUMPTION_DATA_LENGTH, REFRESH_RATE_IN_MINUTES_PREVIOUS_CONSUMPTION

Expand Down Expand Up @@ -177,7 +178,7 @@ async def async_update(self):
"calorific_value": self._calorific_value
}

self._hass.bus.async_fire(EVENT_GAS_PREVIOUS_CONSUMPTION_OVERRIDE_RATES, { "mprn": self._mprn, "serial_number": self._serial_number, "tariff_code": self._tariff_code, "rates": rate_data })
self._hass.bus.async_fire(EVENT_GAS_PREVIOUS_CONSUMPTION_OVERRIDE_RATES, { "mprn": self._mprn, "serial_number": self._serial_number, "tariff_code": self._tariff_code, "rates": private_rates_to_public_rates(rate_data) })

self._attributes["last_evaluated"] = current
self._attempts_to_retrieve = 1
Expand Down

0 comments on commit 48f832a

Please sign in to comment.