Use enums in pi_hole (#62064)

This commit is contained in:
Robert Hillis 2021-12-16 16:34:59 -05:00 committed by GitHub
parent 6ba11fe6c7
commit a16f963605
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,7 @@ from typing import Any
from hole import Hole
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_UPDATE,
BinarySensorDeviceClass,
BinarySensorEntityDescription,
)
from homeassistant.components.sensor import SensorEntityDescription
@ -122,7 +122,7 @@ BINARY_SENSOR_TYPES: tuple[PiHoleBinarySensorEntityDescription, ...] = (
PiHoleBinarySensorEntityDescription(
key="core_update_available",
name="Core Update Available",
device_class=DEVICE_CLASS_UPDATE,
device_class=BinarySensorDeviceClass.UPDATE,
extra_value=lambda api: {
"current_version": api.versions["core_current"],
"latest_version": api.versions["core_latest"],
@ -132,7 +132,7 @@ BINARY_SENSOR_TYPES: tuple[PiHoleBinarySensorEntityDescription, ...] = (
PiHoleBinarySensorEntityDescription(
key="web_update_available",
name="Web Update Available",
device_class=DEVICE_CLASS_UPDATE,
device_class=BinarySensorDeviceClass.UPDATE,
extra_value=lambda api: {
"current_version": api.versions["web_current"],
"latest_version": api.versions["web_latest"],
@ -142,7 +142,7 @@ BINARY_SENSOR_TYPES: tuple[PiHoleBinarySensorEntityDescription, ...] = (
PiHoleBinarySensorEntityDescription(
key="ftl_update_available",
name="FTL Update Available",
device_class=DEVICE_CLASS_UPDATE,
device_class=BinarySensorDeviceClass.UPDATE,
extra_value=lambda api: {
"current_version": api.versions["FTL_current"],
"latest_version": api.versions["FTL_latest"],