Skip to content

Commit

Permalink
fix(sensor): check for AttributeError timezone
Browse files Browse the repository at this point in the history
Closes #501
  • Loading branch information
alandtse committed Jan 15, 2020
1 parent 82f8af2 commit 84b4c61
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom_components/alexa_media/sensor.py
Expand Up @@ -178,7 +178,11 @@ def __init__(
def _fix_alarm_date_time(self, value):
import pytz

if self._sensor_property != "date_time" or not value:
if (
self._sensor_property != "date_time"
or not value
or isinstance(value[1][self._sensor_property], datetime.datetime)
):
return value
naive_time = dt.parse_datetime(value[1][self._sensor_property])
timezone = pytz.timezone(self._client._timezone)
Expand Down

0 comments on commit 84b4c61

Please sign in to comment.