From 0c9337fe87c57c7a422e854987c50f322bb2e720 Mon Sep 17 00:00:00 2001 From: Jordan Harvey Date: Mon, 14 Oct 2024 10:09:52 +0100 Subject: [PATCH] 2024.10.0 (#23) * fix lint errors * update manifest * bump pyfuelprices (#21) --- .github/workflows/lint.yml | 2 +- custom_components/fuel_prices/__init__.py | 8 ++++---- custom_components/fuel_prices/config_flow.py | 1 - custom_components/fuel_prices/manifest.json | 4 +++- custom_components/fuel_prices/sensor.py | 4 +--- requirements.txt | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 25bf6cc..98fb955 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,7 @@ jobs: - name: "Set up Python" uses: actions/setup-python@v4.7.1 with: - python-version: "3.11" + python-version: "3.12" cache: "pip" - name: "Install requirements" diff --git a/custom_components/fuel_prices/__init__.py b/custom_components/fuel_prices/__init__.py index 89a4e45..b7a8127 100644 --- a/custom_components/fuel_prices/__init__.py +++ b/custom_components/fuel_prices/__init__.py @@ -1,6 +1,5 @@ """Fuel Prices integration.""" -import contextlib import logging from datetime import timedelta @@ -30,20 +29,21 @@ from .const import DOMAIN, CONF_AREAS, CONF_SOURCES, CONF_CHEAPEST_SENSORS, CONF_CHEAPEST_SENSORS_COUNT, CONF_CHEAPEST_SENSORS_FUEL_TYPE from .coordinator import FuelPricesCoordinator -type FuelPricesConfigEntry = ConfigEntry[FuelPricesConfig] - _LOGGER = logging.getLogger(__name__) PLATFORMS = [Platform.SENSOR] @dataclass class FuelPricesConfig: - """Represent a config for Anglian Water.""" + """Represent a Fuel Price Config.""" coordinator: FuelPricesCoordinator areas: list[dict] +type FuelPricesConfigEntry = ConfigEntry[FuelPricesConfig] + + def _build_configured_areas(hass_areas: dict) -> list[dict]: module_areas = [] for area in hass_areas: diff --git a/custom_components/fuel_prices/config_flow.py b/custom_components/fuel_prices/config_flow.py index 84bb590..1eae642 100644 --- a/custom_components/fuel_prices/config_flow.py +++ b/custom_components/fuel_prices/config_flow.py @@ -2,7 +2,6 @@ import logging from typing import Any -from homeassistant.config_entries import ConfigEntry, OptionsFlow from pyfuelprices.sources.mapping import SOURCE_MAP, COUNTRY_MAP import voluptuous as vol diff --git a/custom_components/fuel_prices/manifest.json b/custom_components/fuel_prices/manifest.json index 3e20305..88e0d4b 100644 --- a/custom_components/fuel_prices/manifest.json +++ b/custom_components/fuel_prices/manifest.json @@ -10,8 +10,10 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/pantherale0/ha-fuelprices/issues", "requirements": [ + "xmltodict", + "brotli", "these-united-states==1.1.0.21", - "pyfuelprices==2.6.4" + "pyfuelprices==2024.10.1" ], "ssdp": [], "version": "0.0.0", diff --git a/custom_components/fuel_prices/sensor.py b/custom_components/fuel_prices/sensor.py index 612709d..584bf71 100644 --- a/custom_components/fuel_prices/sensor.py +++ b/custom_components/fuel_prices/sensor.py @@ -11,14 +11,12 @@ from homeassistant.components.sensor import SensorEntity from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS, CONF_NAME, STATE_UNKNOWN -from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from pyfuelprices.const import PROP_FUEL_LOCATION_SOURCE from . import FuelPricesConfigEntry -from .const import CONF_AREAS, DOMAIN, CONF_STATE_VALUE, CONF_CHEAPEST_SENSORS, CONF_CHEAPEST_SENSORS_COUNT, CONF_CHEAPEST_SENSORS_FUEL_TYPE +from .const import CONF_STATE_VALUE, CONF_CHEAPEST_SENSORS, CONF_CHEAPEST_SENSORS_COUNT, CONF_CHEAPEST_SENSORS_FUEL_TYPE from .entity import FuelStationEntity, CheapestFuelEntity -from .coordinator import FuelPricesCoordinator _LOGGER = logging.getLogger(__name__) diff --git a/requirements.txt b/requirements.txt index f101449..c4ebede 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ colorlog==6.7.0 -homeassistant==2024.7.1 +git+https://github.com/home-assistant/core@dev pip>=21.0,<23.2 ruff==0.0.292 -pyfuelprices==2.6.4 \ No newline at end of file +pyfuelprices==2024.10.1 \ No newline at end of file