Avoid throwing an exception when a wemo device with attributes isn't found

This commit is contained in:
pavoni 2015-09-25 11:49:57 +01:00 committed by Paulus Schoutsen
parent 4f1bf7b2bf
commit 80c89d218b

View File

@ -123,9 +123,14 @@ class WemoSwitch(SwitchDevice):
def update(self): def update(self):
""" Update WeMo state. """ """ Update WeMo state. """
self.wemo.get_state(True) try:
if self.wemo.model_name == 'Insight': self.wemo.get_state(True)
self.insight_params = self.wemo.insight_params if self.wemo.model_name == 'Insight':
self.insight_params['standby_state'] = self.wemo.get_standby_state self.insight_params = self.wemo.insight_params
elif self.wemo.model_name == 'Maker': self.insight_params['standby_state'] = (
self.maker_params = self.wemo.maker_params self.wemo.get_standby_state)
elif self.wemo.model_name == 'Maker':
self.maker_params = self.wemo.maker_params
except AttributeError:
logging.getLogger(__name__).warning(
'Could not update status for %s', self.name)