Limit log spam from rest and include reason in platform retry (#48666)

- Each retry was logging the error again
- Now we set the cause of the PlatformNotReady to allow Home Assistant to log as needed
This commit is contained in:
J. Nick Koston 2021-04-04 17:26:18 -10:00 committed by GitHub
parent 9ba66fe232
commit 30382c3dbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 10 deletions

View file

@ -50,9 +50,11 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
conf = config
coordinator = None
rest = create_rest_data_from_config(hass, conf)
await rest.async_update()
await rest.async_update(log_errors=False)
if rest.data is None:
if rest.last_exception:
raise PlatformNotReady from rest.last_exception
raise PlatformNotReady
name = conf.get(CONF_NAME)