mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
[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:
parent
5c006cd2d2
commit
9c6a985c56
@ -99,6 +99,7 @@ class ZWaveBinarySensor(BinarySensorDevice, zwave.ZWaveDeviceEntity, Entity):
|
|||||||
"""Called when a value has changed on the network."""
|
"""Called when a value has changed on the network."""
|
||||||
if self._value.value_id == value.value_id or \
|
if self._value.value_id == value.value_id or \
|
||||||
self._value.node == value.node:
|
self._value.node == value.node:
|
||||||
|
_LOGGER.debug('Value changed for label %s', self._value.label)
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,9 +89,9 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
|||||||
"""Called when a value has changed on the network."""
|
"""Called when a value has changed on the network."""
|
||||||
if self._value.value_id == value.value_id or \
|
if self._value.value_id == value.value_id or \
|
||||||
self._value.node == value.node:
|
self._value.node == value.node:
|
||||||
|
_LOGGER.debug('Value changed for label %s', self._value.label)
|
||||||
self.update_properties()
|
self.update_properties()
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
_LOGGER.debug("Value changed on network %s", value)
|
|
||||||
|
|
||||||
def update_properties(self):
|
def update_properties(self):
|
||||||
"""Callback on data change for the registered node/value pair."""
|
"""Callback on data change for the registered node/value pair."""
|
||||||
|
@ -78,9 +78,9 @@ class ZwaveRollershutter(zwave.ZWaveDeviceEntity, CoverDevice):
|
|||||||
"""Called when a value has changed on the network."""
|
"""Called when a value has changed on the network."""
|
||||||
if self._value.value_id == value.value_id or \
|
if self._value.value_id == value.value_id or \
|
||||||
self._value.node == value.node:
|
self._value.node == value.node:
|
||||||
|
_LOGGER.debug('Value changed for label %s', self._value.label)
|
||||||
self.update_properties()
|
self.update_properties()
|
||||||
self.update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
_LOGGER.debug("Value changed on network %s", value)
|
|
||||||
|
|
||||||
def update_properties(self):
|
def update_properties(self):
|
||||||
"""Callback on data change for the registered node/value pair."""
|
"""Callback on data change for the registered node/value pair."""
|
||||||
@ -170,9 +170,9 @@ class ZwaveGarageDoor(zwave.ZWaveDeviceEntity, CoverDevice):
|
|||||||
def value_changed(self, value):
|
def value_changed(self, value):
|
||||||
"""Called when a value has changed on the network."""
|
"""Called when a value has changed on the network."""
|
||||||
if self._value.value_id == value.value_id:
|
if self._value.value_id == value.value_id:
|
||||||
|
_LOGGER.debug('Value changed for label %s', self._value.label)
|
||||||
self._state = value.data
|
self._state = value.data
|
||||||
self.update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
_LOGGER.debug("Value changed on network %s", value)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_closed(self):
|
def is_closed(self):
|
||||||
|
@ -127,6 +127,7 @@ class ZwaveDimmer(zwave.ZWaveDeviceEntity, Light):
|
|||||||
"""Called when a value has changed on the network."""
|
"""Called when a value has changed on the network."""
|
||||||
if self._value.value_id == value.value_id or \
|
if self._value.value_id == value.value_id or \
|
||||||
self._value.node == value.node:
|
self._value.node == value.node:
|
||||||
|
_LOGGER.debug('Value changed for label %s', self._value.label)
|
||||||
if self._refresh_value:
|
if self._refresh_value:
|
||||||
if self._refreshing:
|
if self._refreshing:
|
||||||
self._refreshing = False
|
self._refreshing = False
|
||||||
@ -142,10 +143,10 @@ class ZwaveDimmer(zwave.ZWaveDeviceEntity, Light):
|
|||||||
|
|
||||||
self._timer = Timer(self._delay, _refresh_value)
|
self._timer = Timer(self._delay, _refresh_value)
|
||||||
self._timer.start()
|
self._timer.start()
|
||||||
self.update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
else:
|
else:
|
||||||
self.update_properties()
|
self.update_properties()
|
||||||
self.update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def brightness(self):
|
def brightness(self):
|
||||||
|
@ -76,6 +76,7 @@ class ZwaveLock(zwave.ZWaveDeviceEntity, LockDevice):
|
|||||||
"""Called when a value has changed on the network."""
|
"""Called when a value has changed on the network."""
|
||||||
if self._value.value_id == value.value_id or \
|
if self._value.value_id == value.value_id or \
|
||||||
self._value.node == value.node:
|
self._value.node == value.node:
|
||||||
|
_LOGGER.debug('Value changed for label %s', self._value.label)
|
||||||
self.update_properties()
|
self.update_properties()
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ Interfaces with Z-Wave sensors.
|
|||||||
For more details about this platform, please refer to the documentation
|
For more details about this platform, please refer to the documentation
|
||||||
at https://home-assistant.io/components/sensor.zwave/
|
at https://home-assistant.io/components/sensor.zwave/
|
||||||
"""
|
"""
|
||||||
|
import logging
|
||||||
# Because we do not compile openzwave on CI
|
# Because we do not compile openzwave on CI
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
from homeassistant.components.sensor import DOMAIN
|
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.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Setup Z-Wave sensors."""
|
"""Setup Z-Wave sensors."""
|
||||||
@ -72,7 +75,8 @@ class ZWaveSensor(zwave.ZWaveDeviceEntity, Entity):
|
|||||||
"""Called when a value has changed on the network."""
|
"""Called when a value has changed on the network."""
|
||||||
if self._value.value_id == value.value_id or \
|
if self._value.value_id == value.value_id or \
|
||||||
self._value.node == value.node:
|
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):
|
class ZWaveMultilevelSensor(ZWaveSensor):
|
||||||
|
@ -4,11 +4,14 @@ Z-Wave platform that handles simple binary switches.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/switch.zwave/
|
https://home-assistant.io/components/switch.zwave/
|
||||||
"""
|
"""
|
||||||
|
import logging
|
||||||
# Because we do not compile openzwave on CI
|
# Because we do not compile openzwave on CI
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
||||||
from homeassistant.components import zwave
|
from homeassistant.components import zwave
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
@ -46,8 +49,9 @@ class ZwaveSwitch(zwave.ZWaveDeviceEntity, SwitchDevice):
|
|||||||
def _value_changed(self, value):
|
def _value_changed(self, value):
|
||||||
"""Called when a value has changed on the network."""
|
"""Called when a value has changed on the network."""
|
||||||
if self._value.value_id == value.value_id:
|
if self._value.value_id == value.value_id:
|
||||||
|
_LOGGER.debug('Value changed for label %s', self._value.label)
|
||||||
self._state = value.data
|
self._state = value.data
|
||||||
self.update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user