Use Enums in zamg (#61976)

This commit is contained in:
Robert Hillis 2021-12-15 19:17:20 -05:00 committed by GitHub
parent b22a9e4d0a
commit d68946f568
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,11 @@ from aiohttp.hdrs import USER_AGENT
import requests import requests
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.const import ( from homeassistant.const import (
AREA_SQUARE_METERS, AREA_SQUARE_METERS,
ATTR_ATTRIBUTION, ATTR_ATTRIBUTION,
@ -23,7 +27,6 @@ from homeassistant.const import (
CONF_MONITORED_CONDITIONS, CONF_MONITORED_CONDITIONS,
CONF_NAME, CONF_NAME,
DEGREE, DEGREE,
DEVICE_CLASS_TEMPERATURE,
LENGTH_METERS, LENGTH_METERS,
PERCENTAGE, PERCENTAGE,
PRESSURE_HPA, PRESSURE_HPA,
@ -124,7 +127,7 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
key="temperature", key="temperature",
name="Temperature", name="Temperature",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
col_heading=f"T {TEMP_CELSIUS}", col_heading=f"T {TEMP_CELSIUS}",
dtype=float, dtype=float,
), ),
@ -139,7 +142,7 @@ SENSOR_TYPES: tuple[ZamgSensorEntityDescription, ...] = (
key="dewpoint", key="dewpoint",
name="Dew Point", name="Dew Point",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
col_heading=f"TP {TEMP_CELSIUS}", col_heading=f"TP {TEMP_CELSIUS}",
dtype=float, dtype=float,
), ),