diff --git a/custom_components/alexa_media/sensor.py b/custom_components/alexa_media/sensor.py index d84dd56a..897397ef 100644 --- a/custom_components/alexa_media/sensor.py +++ b/custom_components/alexa_media/sensor.py @@ -182,14 +182,19 @@ def _fix_alarm_date_time(self, value): return value naive_time = dt.parse_datetime(value[1][self._sensor_property]) timezone = pytz.timezone(self._client._timezone) - if timezone: + if timezone and naive_time: value[1][self._sensor_property] = timezone.localize(naive_time) else: _LOGGER.warning( - "%s does not have a timezone set. " + "%s is returning erroneous data." "Returned times may be wrong. " - "Please set the timezone in the Alexa app.", + "Please confirm the timezone in the Alexa app is correct. " + "Debugging info: \nRaw: %s \nNaive Time: %s " + "\nTimezone: %s", self._client.name, + value[1], + naive_time, + self._client._timezone, ) return value