Remove global variable from bloomsky (#33720)

This commit is contained in:
springstan 2020-04-05 23:16:30 +02:00 committed by GitHub
parent b1326928df
commit 983ed8b8b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 12 deletions

View file

@ -13,7 +13,7 @@ from homeassistant.const import (
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from . import BLOOMSKY
from . import DOMAIN
LOGGER = logging.getLogger(__name__)
@ -61,10 +61,11 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the available BloomSky weather sensors."""
# Default needed in case of discovery
sensors = config.get(CONF_MONITORED_CONDITIONS, SENSOR_TYPES)
bloomsky = hass.data[DOMAIN]
for device in BLOOMSKY.devices.values():
for device in bloomsky.devices.values():
for variable in sensors:
add_entities([BloomSkySensor(BLOOMSKY, device, variable)], True)
add_entities([BloomSkySensor(bloomsky, device, variable)], True)
class BloomSkySensor(Entity):