add message output

This commit is contained in:
Pascal Vizeli
2017-02-01 21:52:21 +01:00
parent df23aa6af0
commit 957e06e605

View File

@@ -321,7 +321,7 @@ def setup(hass, config):
def _service_handle_value(service): def _service_handle_value(service):
"""Set value on homematic variable.""" """Set value on homematic variable."""
entity_ids = service.data[ATTR_PROXY] entity_ids = service.data.get(ATTR_ENTITY_ID)
name = service.data[ATTR_NAME] name = service.data[ATTR_NAME]
value = service.data[ATTR_VALUE] value = service.data[ATTR_VALUE]
@@ -655,12 +655,15 @@ class HMHub(Entity):
def hm_set_variable(self, name, value): def hm_set_variable(self, name, value):
"""Set variable on homematic controller.""" """Set variable on homematic controller."""
if name not in self._variables:
_LOGGER.error("Variable %s not found on %s", name, self.name)
return
old_value = self._variables.get(name) old_value = self._variables.get(name)
if isinstance(old_value, bool): if isinstance(old_value, bool):
value = cv.boolean(value) value = cv.boolean(value)
else: else:
value = float(value) value = float(value)
self._homematic.setSystemVariable(self._name, name, value) self._homematic.setSystemVariable(self.name, name, value)
self._variables.update({name: value}) self._variables.update({name: value})
self.schedule_update_ha_state() self.schedule_update_ha_state()