Skip to content

Commit

Permalink
add configured sources to handle_fuel_location_lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
pantherale0 committed Dec 20, 2023
1 parent 283a306 commit b4e662f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/fuel_prices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logging

from pyfuelprices import FuelPrices, SOURCE_MAP
from pyfuelprices import FuelPrices

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
Expand All @@ -27,7 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
_LOGGER.debug("Got request to setup entry.")
try:
fuel_prices: FuelPrices = FuelPrices.create(
enabled_sources=entry.data.get("sources", [])
enabled_sources=entry.data.get("sources", None)
)
await fuel_prices.update()
hass.data[DOMAIN][entry.entry_id] = FuelPricesCoordinator(
Expand Down Expand Up @@ -66,7 +66,7 @@ def handle_fuel_location_lookup(call: ServiceCall) -> ServiceResponse:
built[fuel.fuel_type] = fuel.cost
locations.append(built)

return {"items": locations, "sources": []}
return {"items": locations, "sources": entry.data.get("sources", [])}

hass.services.async_register(
DOMAIN,
Expand Down

0 comments on commit b4e662f

Please sign in to comment.