[zwave]Use schedule_ha_state and add debug message (#5143)

* Use schedule_ha_state and add debug message

* Logger not defined
This commit is contained in:
John Arild Berentsen authored and GitHub committed 2017-01-02 18:55:56 +01:00
1 parent 5c006cd2d2
commit 9c6a985c56
7 files changed
+20 -9

No files matched your search

+5 -1
View File
@@ -4,6 +4,7 @@ Interfaces with Z-Wave sensors.
For more details about this platform, please refer to the documentation
at https://home-assistant.io/components/sensor.zwave/
"""
import logging
# Because we do not compile openzwave on CI
# pylint: disable=import-error
from homeassistant.components.sensor import DOMAIN
@@ -11,6 +12,8 @@ from homeassistant.components import zwave
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup Z-Wave sensors."""
@@ -72,7 +75,8 @@ class ZWaveSensor(zwave.ZWaveDeviceEntity, Entity):
"""Called when a value has changed on the network."""
if self._value.value_id == value.value_id or \
self._value.node == value.node:
self.update_ha_state()
_LOGGER.debug('Value changed for label %s', self._value.label)
self.schedule_update_ha_state()
class ZWaveMultilevelSensor(ZWaveSensor):