Coinbase code quality improvements from review (#52307)

* Fix breaking loop if single bad currency

* Remove unneeded update

* Reduce executor calls and use helper

* Avoid setting up integration when not needed in test

* Remove defunct info from strings

* Move already configured check

* Move instance update out of data class init
This commit is contained in:
Tom Brien 2021-06-29 16:54:38 +01:00 committed by GitHub
parent b11af5e6f8
commit 897f5d9247
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 28 deletions

View file

@ -36,7 +36,6 @@ ATTRIBUTION = "Data provided by coinbase.com"
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Coinbase sensor platform."""
instance = hass.data[DOMAIN][config_entry.entry_id]
hass.async_add_executor_job(instance.update)
entities = []
@ -58,7 +57,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
"your settings in Coinbase's developer tools",
currency,
)
break
continue
entities.append(AccountSensor(instance, currency))
if CONF_EXCHANGE_RATES in config_entry.options: