Skip to content

Commit

Permalink
Fix error on missing currency config entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Roeland authored and Roeland committed Aug 31, 2024
1 parent 9e73b45 commit 03136f2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions custom_components/entsoe/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from homeassistant.components.sensor import DOMAIN, RestoreSensor, SensorDeviceClass, SensorEntityDescription, SensorExtraStoredData, SensorStateClass
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_CURRENCY,
PERCENTAGE,
UnitOfEnergy,
)
Expand All @@ -22,7 +21,7 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.util import utcnow
from .const import ATTRIBUTION, CONF_COORDINATOR, CONF_ENTITY_NAME, DOMAIN, ICON
from .const import ATTRIBUTION, CONF_COORDINATOR, CONF_ENTITY_NAME, DOMAIN, ICON, DEFAULT_CURRENCY, CONF_CURRENCY
from .coordinator import EntsoeCoordinator

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -102,7 +101,7 @@ async def async_setup_entry(

entities = []
entity = {}
for description in sensor_descriptions(currency = config_entry.options[CONF_CURRENCY]):
for description in sensor_descriptions(currency = config_entry.options.get(CONF_CURRENCY, DEFAULT_CURRENCY)):
entity = description
entities.append(
EntsoeSensor(
Expand Down

0 comments on commit 03136f2

Please sign in to comment.