zwave refactor, don't use ozw values directly in properties. (#5961)

* First round of not using values directly

* Round two

* lint

* Round four

* Conflict

* Round five

* Update zwave.py

* round six

* Docstring

* flakywakie

* Fetch values in constructor

* Blank line removal

* Set attributes in callback

* Docstring

* Round seven

* Ughgit add homeassistant/components/lock/zwave.py!

* Sloppy code
This commit is contained in:
John Arild Berentsen authored and Paulus Schoutsen committed 2017-02-17 23:56:05 -08:00
1 parent c1eed148cc
commit 799fbe42f8
8 files changed
+78 -76

No files matched your search

+6 -1
View File
@@ -38,11 +38,16 @@ class ZwaveSwitch(zwave.ZWaveDeviceEntity, SwitchDevice):
def __init__(self, value):
"""Initialize the Z-Wave switch device."""
zwave.ZWaveDeviceEntity.__init__(self, value, DOMAIN)
self.update_properties()
def update_properties(self):
"""Callback on data changes for node values."""
self._state = self._value.data
@property
def is_on(self):
"""Return true if device is on."""
return self._value.data
return self._state
def turn_on(self, **kwargs):
"""Turn the device on."""