From 41dcfe275e633ff870686ee9721e4e10a39185b5 Mon Sep 17 00:00:00 2001 From: Jordan H Date: Fri, 2 Feb 2024 20:31:53 +0000 Subject: [PATCH] bump pyfuelprices to 2.2.2 --- custom_components/fuel_prices/__init__.py | 6 +----- custom_components/fuel_prices/device_tracker.py | 9 +++++---- custom_components/fuel_prices/manifest.json | 2 +- requirements.txt | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/custom_components/fuel_prices/__init__.py b/custom_components/fuel_prices/__init__.py index 553e84f..023a7b5 100644 --- a/custom_components/fuel_prices/__init__.py +++ b/custom_components/fuel_prices/__init__.py @@ -112,12 +112,8 @@ async def handle_fuel_location_lookup(call: ServiceCall) -> ServiceResponse: ) except ValueError as err: raise HomeAssistantError("Country not available for fuel data.") from err - locations_built = [] - for loc in locations: - await loc.dynamic_build_fuels() - locations_built.append(loc.__dict__()) - return {"items": locations_built, "sources": entry.data.get("sources", [])} + return {"items": locations, "sources": entry.data.get("sources", [])} hass.services.async_register( DOMAIN, diff --git a/custom_components/fuel_prices/device_tracker.py b/custom_components/fuel_prices/device_tracker.py index abe7bfb..5f4f26f 100644 --- a/custom_components/fuel_prices/device_tracker.py +++ b/custom_components/fuel_prices/device_tracker.py @@ -1,4 +1,5 @@ """Device tracker for fuel prices.""" + from __future__ import annotations import logging @@ -36,16 +37,16 @@ async def async_setup_entry( coordinates=(area[CONF_LATITUDE], area[CONF_LONGITUDE]), radius=area[CONF_RADIUS], ): - if station.id not in found_entities: + if station["id"] not in found_entities: entities.append( FeulStationTracker( coordinator=cooridinator, - fuel_station_id=station.id, + fuel_station_id=station["id"], entity_id="devicetracker", - source=station.props[PROP_FUEL_LOCATION_SOURCE], + source=station["props"][PROP_FUEL_LOCATION_SOURCE], ) ) - found_entities.append(station.id) + found_entities.append(station["id"]) async_add_entities(entities, True) diff --git a/custom_components/fuel_prices/manifest.json b/custom_components/fuel_prices/manifest.json index 044de5b..e2ffd69 100644 --- a/custom_components/fuel_prices/manifest.json +++ b/custom_components/fuel_prices/manifest.json @@ -12,7 +12,7 @@ "requirements": [ "reverse-geocode==1.4.1", "these-united-states==1.1.0.21", - "pyfuelprices==2.1.11" + "pyfuelprices==2.2.2" ], "ssdp": [], "version": "0.0.0", diff --git a/requirements.txt b/requirements.txt index 429674c..cb14102 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ colorlog==6.7.0 homeassistant==2023.8.0 pip>=21.0,<23.2 ruff==0.0.292 -pyfuelprices==2.1.10 \ No newline at end of file +pyfuelprices==2.2.2 \ No newline at end of file