mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Merge pull request #68 from jamespcole/nzb-dev
Fixed attribute error with new unit_of_measurement changes
This commit is contained in:
commit
609064b9d8
@ -56,8 +56,7 @@ from homeassistant.helpers.entity import Entity
|
|||||||
# pylint: disable=no-name-in-module, import-error
|
# pylint: disable=no-name-in-module, import-error
|
||||||
from homeassistant.external.nzbclients.sabnzbd import SabnzbdApi
|
from homeassistant.external.nzbclients.sabnzbd import SabnzbdApi
|
||||||
from homeassistant.external.nzbclients.sabnzbd import SabnzbdApiException
|
from homeassistant.external.nzbclients.sabnzbd import SabnzbdApiException
|
||||||
from homeassistant.const import (
|
|
||||||
ATTR_UNIT_OF_MEASUREMENT, ATTR_FRIENDLY_NAME)
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
@ -118,7 +117,7 @@ class SabnzbdSensor(Entity):
|
|||||||
self.type = sensor_type
|
self.type = sensor_type
|
||||||
self.client_name = client_name
|
self.client_name = client_name
|
||||||
self._state = None
|
self._state = None
|
||||||
self.unit_of_measurement = SENSOR_TYPES[sensor_type][1]
|
self._unit_of_measurement = SENSOR_TYPES[sensor_type][1]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
@ -130,12 +129,9 @@ class SabnzbdSensor(Entity):
|
|||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state_attributes(self):
|
def unit_of_measurement(self):
|
||||||
""" Returns the state attributes. """
|
""" Unit of measurement of this entity, if any. """
|
||||||
return {
|
return self._unit_of_measurement
|
||||||
ATTR_FRIENDLY_NAME: self.name,
|
|
||||||
ATTR_UNIT_OF_MEASUREMENT: self.unit_of_measurement,
|
|
||||||
}
|
|
||||||
|
|
||||||
def refresh_sabnzbd_data(self):
|
def refresh_sabnzbd_data(self):
|
||||||
""" Calls the throttled SABnzbd refresh method. """
|
""" Calls the throttled SABnzbd refresh method. """
|
||||||
|
Loading…
x
Reference in New Issue
Block a user