Skip to content

Commit

Permalink
2022.12.4-beta.4 Bug fix
Browse files Browse the repository at this point in the history
- Handle sensor data None
  • Loading branch information
craibo committed Dec 12, 2022
1 parent f1e4a4e commit 0bd3d27
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/ha_strava/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,14 @@ def suggested_unit_of_measurement(
@property
def name(self): # pylint: disable=too-many-return-statements
if self._sensor_index == 0:
if not self._data:
return "Title & Date"

if self._data.get(CONF_SENSOR_CITY):
return (
f"{self._data[CONF_SENSOR_TITLE]} | {self._data[CONF_SENSOR_CITY]}"
)

return (
f"{self._data[CONF_SENSOR_TITLE]}"
if self._data.get(CONF_SENSOR_TITLE)
Expand Down

0 comments on commit 0bd3d27

Please sign in to comment.