Skip to content

Commit

Permalink
Fix processing time_at_elevation config when value is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
pnbruckner committed May 12, 2024
1 parent 3b75033 commit 332ce7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/sun2/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ def _config_sensors(self) -> Iterable[Sun2Entity]:
self._sun2_entity_params.unique_id = unique_id
name = config.get(CONF_NAME)

if at_time := config.get(CONF_ELEVATION_AT_TIME):
if (at_time := config.get(CONF_ELEVATION_AT_TIME)) is not None:
# For config entries, JSON serialization turns a time into a string.
# Convert back to time in that case.
if isinstance(at_time, str):
Expand All @@ -1201,7 +1201,7 @@ def _config_sensors(self) -> Iterable[Sun2Entity]:
)
continue

if elevation := config.get(CONF_TIME_AT_ELEVATION):
if (elevation := config.get(CONF_TIME_AT_ELEVATION)) is not None:
direction = SunDirection.__getitem__(
cast(str, config[CONF_DIRECTION]).upper()
)
Expand Down

0 comments on commit 332ce7c

Please sign in to comment.