ps: Add a global config object to Home Assistant
This commit is contained in:
1 parent
569b15d790
commit
9b643d57f0
23 files changed
+224
-173
No files matched your search
@@ -11,7 +11,7 @@ from pydispatch import dispatcher
|
||||
import homeassistant.components.zwave as zwave
|
||||
from homeassistant.helpers.device import Device
|
||||
from homeassistant.const import (
|
||||
ATTR_BATTERY_LEVEL, ATTR_UNIT_OF_MEASUREMENT, STATE_ON, STATE_OFF,
|
||||
ATTR_BATTERY_LEVEL, STATE_ON, STATE_OFF,
|
||||
TEMP_CELCIUS, TEMP_FAHRENHEIT, ATTR_LOCATION)
|
||||
|
||||
|
||||
@@ -77,11 +77,6 @@ class ZWaveSensor(Device):
|
||||
if battery_level is not None:
|
||||
attrs[ATTR_BATTERY_LEVEL] = battery_level
|
||||
|
||||
unit = self.unit
|
||||
|
||||
if unit:
|
||||
attrs[ATTR_UNIT_OF_MEASUREMENT] = unit
|
||||
|
||||
location = self._node.location
|
||||
|
||||
if location:
|
||||
@@ -90,8 +85,7 @@ class ZWaveSensor(Device):
|
||||
return attrs
|
||||
|
||||
@property
|
||||
def unit(self):
|
||||
""" Unit if sensor has one. """
|
||||
def unit_of_measurement(self):
|
||||
return self._value.units
|
||||
|
||||
def _value_changed(self, value):
|
||||
@@ -126,8 +120,7 @@ class ZWaveMultilevelSensor(ZWaveSensor):
|
||||
return value
|
||||
|
||||
@property
|
||||
def unit(self):
|
||||
""" Unit of this sensor. """
|
||||
def unit_of_measurement(self):
|
||||
unit = self._value.units
|
||||
|
||||
if unit == 'C':
|
||||
|
||||
Reference in new issue
Block a user