diff --git a/homeassistant/components/sensor/systemmonitor.py b/homeassistant/components/sensor/systemmonitor.py index 99e2453c4871fd0689bfd449fdeedabe9f6fb8c8..e03e987802bef32e9ed0210d03d2d50531326ed0 100644 --- a/homeassistant/components/sensor/systemmonitor.py +++ b/homeassistant/components/sensor/systemmonitor.py @@ -50,7 +50,7 @@ class SystemMonitorSensor(Entity): self.argument = argument self.type = sensor_type self._state = None - self.unit_of_measurement = SENSOR_TYPES[sensor_type][1] + self._unit_of_measurement = SENSOR_TYPES[sensor_type][1] self.update() @property @@ -62,6 +62,10 @@ class SystemMonitorSensor(Entity): """ Returns the state of the device. """ return self._state + @property + def unit_of_measurement(self): + return self._unit_of_measurement + def update(self): if self.type == 'disk_use_percent': self._state = psutil.disk_usage(self.argument).percent diff --git a/homeassistant/components/sensor/tellstick.py b/homeassistant/components/sensor/tellstick.py index 699821fa6b6c32576a8783c56f7f204b60902fe7..5720b65a669b28a730c13cec5ff0d7f8418e208d 100644 --- a/homeassistant/components/sensor/tellstick.py +++ b/homeassistant/components/sensor/tellstick.py @@ -99,7 +99,7 @@ class TellstickSensor(Entity): def __init__(self, name, sensor, datatype, sensor_info): self.datatype = datatype self.sensor = sensor - self.unit_of_measurement = sensor_info.unit or None + self._unit_of_measurement = sensor_info.unit or None self._name = "{} {}".format(name, sensor_info.name) @@ -112,3 +112,7 @@ class TellstickSensor(Entity): def state(self): """ Returns the state of the device. """ return self.sensor.value(self.datatype).value + + @property + def unit_of_measurement(self): + return self._unit_of_measurement