1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

ps: Add a global config object to Home Assistant

This commit is contained in:
Paulus Schoutsen
2015-03-18 23:02:58 -07:00
parent 569b15d790
commit 9b643d57f0
23 changed files with 224 additions and 173 deletions

View File

@@ -29,8 +29,7 @@ from collections import namedtuple
import tellcore.telldus as telldus
import tellcore.constants as tellcore_constants
from homeassistant.const import (
ATTR_FRIENDLY_NAME, ATTR_UNIT_OF_MEASUREMENT, TEMP_CELCIUS)
from homeassistant.const import TEMP_CELCIUS
from homeassistant.helpers.device import Device
DatatypeDescription = namedtuple("DatatypeDescription", ['name', 'unit'])
@@ -99,7 +98,7 @@ class TellstickSensor(Device):
def __init__(self, name, sensor, datatype, sensor_info):
self.datatype = datatype
self.sensor = sensor
self.unit = sensor_info.unit or None
self.unit_of_measurement = sensor_info.unit or None
self._name = "{} {}".format(name, sensor_info.name)
@@ -112,15 +111,3 @@ class TellstickSensor(Device):
def state(self):
""" Returns the state of the device. """
return self.sensor.value(self.datatype).value
@property
def state_attributes(self):
""" Returns the state attributes. """
attrs = {
ATTR_FRIENDLY_NAME: self._name,
}
if self.unit:
attrs[ATTR_UNIT_OF_MEASUREMENT] = self.unit
return attrs