From 5fce2e2b47da639f28aa61db0ddfa7521d1bd742 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Sun, 1 Apr 2018 02:45:50 +0200 Subject: [PATCH] Fix mysensors update callback (#13602) * Add callback annotation to mysensors dispatch callback. --- homeassistant/components/mysensors.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/mysensors.py b/homeassistant/components/mysensors.py index a560b49648f..74df860a0fc 100644 --- a/homeassistant/components/mysensors.py +++ b/homeassistant/components/mysensors.py @@ -19,6 +19,7 @@ from homeassistant.components.mqtt import ( from homeassistant.const import ( ATTR_BATTERY_LEVEL, CONF_NAME, CONF_OPTIMISTIC, EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, STATE_OFF, STATE_ON) +from homeassistant.core import callback from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import ( @@ -301,9 +302,9 @@ def setup(hass, config): """Call MQTT publish function.""" mqtt.publish(hass, topic, payload, qos, retain) - def sub_callback(topic, callback, qos): + def sub_callback(topic, sub_cb, qos): """Call MQTT subscribe function.""" - mqtt.subscribe(hass, topic, callback, qos) + mqtt.subscribe(hass, topic, sub_cb, qos) gateway = mysensors.MQTTGateway( pub_callback, sub_callback, event_callback=None, persistence=persistence, @@ -627,6 +628,7 @@ class MySensorsEntity(MySensorsDevice, Entity): """Return true if entity is available.""" return self.value_type in self._values + @callback def _async_update_callback(self): """Update the entity.""" self.async_schedule_update_ha_state(True)