Remove global variable from bloomsky (#33720)
This commit is contained in:
1 parent
b1326928df
commit
983ed8b8b4
4 files changed
+17
-12
No files matched your search
@@ -13,7 +13,6 @@ from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
BLOOMSKY = None
|
||||
BLOOMSKY_TYPE = ["camera", "binary_sensor", "sensor"]
|
||||
|
||||
DOMAIN = "bloomsky"
|
||||
@@ -31,12 +30,14 @@ def setup(hass, config):
|
||||
"""Set up the BloomSky component."""
|
||||
api_key = config[DOMAIN][CONF_API_KEY]
|
||||
|
||||
global BLOOMSKY # pylint: disable=global-statement
|
||||
bloomsky = None
|
||||
try:
|
||||
BLOOMSKY = BloomSky(api_key, hass.config.units.is_metric)
|
||||
bloomsky = BloomSky(api_key, hass.config.units.is_metric)
|
||||
except RuntimeError:
|
||||
return False
|
||||
|
||||
hass.data[DOMAIN] = bloomsky
|
||||
|
||||
for component in BLOOMSKY_TYPE:
|
||||
discovery.load_platform(hass, component, DOMAIN, {}, config)
|
||||
|
||||
|
||||
Reference in new issue
Block a user