mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Multiple Module Configuration
Handle multiple module (see configuration.yaml)
This commit is contained in:
parent
520a8d0d0d
commit
a8b36d9baa
@ -51,15 +51,14 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
data = NetAtmoData(authorization)
|
data = NetAtmoData(authorization)
|
||||||
|
|
||||||
module_name = 'Salon'
|
|
||||||
|
|
||||||
dev = []
|
dev = []
|
||||||
try:
|
try:
|
||||||
for variable in config['monitored_conditions']:
|
for module_name, monitored_conditions in config['modules'].items():
|
||||||
if variable not in SENSOR_TYPES:
|
for variable in monitored_conditions:
|
||||||
_LOGGER.error('Sensor type: "%s" does not exist', variable)
|
if variable not in SENSOR_TYPES:
|
||||||
else:
|
_LOGGER.error('Sensor type: "%s" does not exist', variable)
|
||||||
dev.append(NetAtmoSensor( data, module_name, variable, unit))
|
else:
|
||||||
|
dev.append(NetAtmoSensor(data, module_name, variable, unit))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -72,7 +71,7 @@ class NetAtmoSensor(Entity):
|
|||||||
|
|
||||||
def __init__(self, netatmo_data, module_name, sensor_type, temp_unit):
|
def __init__(self, netatmo_data, module_name, sensor_type, temp_unit):
|
||||||
self.client_name = 'NetAtmo'
|
self.client_name = 'NetAtmo'
|
||||||
self._name = SENSOR_TYPES[sensor_type][0]
|
self._name = module_name + '_' + SENSOR_TYPES[sensor_type][0]
|
||||||
self.netatmo_data = netatmo_data
|
self.netatmo_data = netatmo_data
|
||||||
self.module_name = module_name
|
self.module_name = module_name
|
||||||
self.temp_unit = temp_unit
|
self.temp_unit = temp_unit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user