Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix netatmo weatherstation setup error #24788

Merged
merged 4 commits into from
Jun 28, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions homeassistant/components/netatmo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ def _retry(_data):
module_items = config[CONF_MODULES].items()
for module_name, monitored_conditions in module_items:
for condition in monitored_conditions:
dev.append(NetatmoSensor(
data, module_name, condition.lower(),
config.get(CONF_STATION)))
if data.station_data:
dev.append(NetatmoSensor(
data, module_name, condition.lower(),
config.get(CONF_STATION)))
continue

# otherwise add all modules and conditions
Expand Down Expand Up @@ -187,12 +188,11 @@ def __init__(self, netatmo_data, module_name, sensor_type, station):
self._device_class = SENSOR_TYPES[self.type][3]
self._icon = SENSOR_TYPES[self.type][2]
self._unit_of_measurement = SENSOR_TYPES[self.type][1]
self._module_type = self.netatmo_data. \
station_data.moduleByName(module=module_name)['type']
module_id = self.netatmo_data. \
station_data.moduleByName(station=self.station_name,
module=module_name)['_id']
self._unique_id = '{}-{}'.format(module_id, self.type)
module = self.netatmo_data.station_data.moduleByName(
station=self.station_name, module=module_name
)
self._module_type = module['type']
self._unique_id = '{}-{}'.format(module['_id'], self.type)

@property
def name(self):
Expand Down