Fix sensor type creation with multiple Ambient weather stations (#30850)

This commit is contained in:
Aaron Bach authored and Paulus Schoutsen committed 2020-01-16 11:37:28 -08:00
1 parent 7da84dca76
commit 9bfcd04a4f
4 files changed
+25 -12

No files matched your search

@@ -9,7 +9,13 @@ from . import (
TYPE_SOLARRADIATION_LX,
AmbientWeatherEntity,
)
from .const import ATTR_LAST_DATA, DATA_CLIENT, DOMAIN, TYPE_SENSOR
from .const import (
ATTR_LAST_DATA,
ATTR_MONITORED_CONDITIONS,
DATA_CLIENT,
DOMAIN,
TYPE_SENSOR,
)
_LOGGER = logging.getLogger(__name__)
@@ -25,7 +31,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
sensor_list = []
for mac_address, station in ambient.stations.items():
for condition in ambient.monitored_conditions:
for condition in station[ATTR_MONITORED_CONDITIONS]:
name, unit, kind, device_class = SENSOR_TYPES[condition]
if kind == TYPE_SENSOR:
sensor_list.append(