Add and use frequency constants (#34113)

This commit is contained in:
springstan authored and GitHub committed 2020-04-12 22:44:31 +02:00
1 parent 00b6409b76
commit 19dd797dfe
9 files changed
+29 -14

No files matched your search

+2 -3
View File
@@ -5,7 +5,7 @@ from cpuinfo import cpuinfo
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME
from homeassistant.const import CONF_NAME, FREQUENCY_GIGAHERTZ
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
@@ -42,7 +42,6 @@ class CpuSpeedSensor(Entity):
self._name = name
self._state = None
self.info = None
self._unit_of_measurement = "GHz"
@property
def name(self):
@@ -57,7 +56,7 @@ class CpuSpeedSensor(Entity):
@property
def unit_of_measurement(self):
"""Return the unit the value is expressed in."""
return self._unit_of_measurement
return FREQUENCY_GIGAHERTZ
@property
def device_state_attributes(self):