Replace MyChevy persistant_notification with error log entry (#19804)

The mychevy service is notoriously unreliable, often only having 50% uptime. 
Previously a persistent notification was emitted when the platform errored out. 
Users have found that is happening too often, so instead log an error when
this happens instead.
This commit is contained in:
Rene Nulsch 2019-01-08 14:06:08 +01:00 committed by Sean Dague
parent 4bbfc04f5e
commit 410f19c777

View File

@ -8,7 +8,7 @@ import logging
from homeassistant.components.mychevy import ( from homeassistant.components.mychevy import (
EVSensorConfig, DOMAIN as MYCHEVY_DOMAIN, MYCHEVY_ERROR, MYCHEVY_SUCCESS, EVSensorConfig, DOMAIN as MYCHEVY_DOMAIN, MYCHEVY_ERROR, MYCHEVY_SUCCESS,
NOTIFICATION_ID, NOTIFICATION_TITLE, UPDATE_TOPIC, ERROR_TOPIC UPDATE_TOPIC, ERROR_TOPIC
) )
from homeassistant.components.sensor import ENTITY_ID_FORMAT from homeassistant.components.sensor import ENTITY_ID_FORMAT
from homeassistant.core import callback from homeassistant.core import callback
@ -74,12 +74,9 @@ class MyChevyStatus(Entity):
@callback @callback
def error(self): def error(self):
"""Update state, trigger updates.""" """Update state, trigger updates."""
if self._state != MYCHEVY_ERROR: _LOGGER.error(
self.hass.components.persistent_notification.create( "Connection to mychevy website failed. "
"Error:<br/>Connection to mychevy website failed. " "This probably means the mychevy to OnStar link is down")
"This probably means the mychevy to OnStar link is down.",
title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID)
self._state = MYCHEVY_ERROR self._state = MYCHEVY_ERROR
self.async_schedule_update_ha_state() self.async_schedule_update_ha_state()