Skip to content

Commit

Permalink
New release (#910)
Browse files Browse the repository at this point in the history
  • Loading branch information
BottlecapDave committed Jun 12, 2024
2 parents d4cd0ad + e299959 commit c49519b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .build/createGithubRelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async function createGithubRelease(githubToken: string, githubOwnerRepo: string,
}
}

const minimumHAVersionNote = `\\n**Minimum HA Version**: ${getMinimumHomeAssistantVersion()}\n\n`;
const minimumHAVersionNote = `\n**Minimum HA Version**: ${getMinimumHomeAssistantVersion()}\n\n`;
createGithubRelease(
process.env.GITHUB_TOKEN,
process.env.GITHUB_REPOSITORY,
Expand Down
3 changes: 1 addition & 2 deletions custom_components/octopus_energy/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import re
from datetime import datetime, timedelta


from homeassistant.util.dt import (as_local, as_utc, parse_datetime)

from ..const import (
Expand Down Expand Up @@ -48,7 +47,7 @@ def __init__(self, product: str, code: str):
def is_day_night_tariff(tariff_code: str) -> bool:
tariff_parts = get_tariff_parts(tariff_code)
print(tariff_parts)
return tariff_parts is not None and tariff_parts.rate.startswith("2")
return tariff_parts is not None and "2" in tariff_parts.rate

def get_active_tariff(utcnow: datetime, agreements):
latest_agreement = None
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/api_client/test_get_electricity_rates.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from datetime import datetime, timedelta
import pytest

from homeassistant.util.dt import (now)

from integration import (get_test_context)
from custom_components.octopus_energy.api_client import OctopusEnergyApiClient

Expand Down Expand Up @@ -59,13 +57,15 @@ async def async_assert_electricity_data(product_code, tariff_code, is_smart_mete
("AGILE-FLEX-22-11-25", "E-1R-AGILE-FLEX-22-11-25-D", None, datetime.strptime("2022-12-01T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2022-12-04T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z")),
("SILVER-FLEX-22-11-25", "E-1R-SILVER-FLEX-22-11-25-C", None, datetime.strptime("2023-07-01T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2023-07-02T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z")),
("BUS-PANELP-12M-FIXED-SEPTEMBER2022", "BUS-PANELP-12M-FIXED-SEPTEMBER2029", None, datetime.strptime("2023-07-01T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2023-07-02T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z")),
("SILVER-23-12-06", "E-FLAT2R-SILVER-23-12-06-A", None, datetime.strptime("2024-06-11T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2024-06-12T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z")),
("SUPER-GREEN-24M-21-07-30", "E-1R-SUPER-GREEN-24M-21-07-30-A", 10, datetime.strptime("2022-12-01T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2022-12-04T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z")),
("GO-18-06-12", "E-1R-GO-18-06-12-A", 10, datetime.strptime("2022-12-01T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2022-12-04T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z")),
("VAR-21-09-29", "E-1R-VAR-21-09-29-A", 10, datetime.strptime("2022-12-01T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2022-12-04T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z")),
("AGILE-18-02-21", "E-1R-AGILE-18-02-21-A", 10, datetime.strptime("2022-12-01T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2022-12-04T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z")),
("AGILE-FLEX-22-11-25", "E-1R-AGILE-FLEX-22-11-25-D", 10, datetime.strptime("2022-12-01T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2022-12-04T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z")),
("SILVER-FLEX-22-11-25", "E-1R-SILVER-FLEX-22-11-25-C", 10, datetime.strptime("2023-07-01T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2023-07-04T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z")),
("BUS-PANELP-12M-FIXED-SEPTEMBER2022", "BUS-PANELP-12M-FIXED-SEPTEMBER2029", 10, datetime.strptime("2023-07-01T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2023-07-04T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z")),
("SILVER-23-12-06", "E-FLAT2R-SILVER-23-12-06-A", 10, datetime.strptime("2024-06-11T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z"), datetime.strptime("2024-06-12T00:00:00+01:00", "%Y-%m-%dT%H:%M:%S%z")),
])
async def test_when_get_electricity_rates_is_called_with_tariff_then_data_is_returned_in_thirty_minute_increments(product_code, tariff_code, price_cap, period_from,period_to):
await async_assert_electricity_data(product_code, tariff_code, False, price_cap, period_from, period_to)
Expand Down
1 change: 1 addition & 0 deletions tests/unit/utils/test_is_day_night_tariff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
("E-1R-AGILE-FLEX-22-11-25-B", False),
("BUS-PANELP-12M-FIXED-SEPTEMBER2029", False),
("E-2R-VAR-22-11-01-A", True),
("E-FLAT2R-SILVER-23-12-06-A", True),
])
async def test_when_tariff_code_provided_then_expected_result_returned(tariff_code: str, expected_result: bool):
# Act
Expand Down

0 comments on commit c49519b

Please sign in to comment.