Correct deprecated volt units on yalexs_ble sensor (#83738)

This commit is contained in:
J. Nick Koston 2022-12-10 15:02:21 -10:00 committed by GitHub
parent f19a1147fe
commit a65ce7e6c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,9 +14,9 @@ from homeassistant.components.sensor import (
SensorStateClass, SensorStateClass,
) )
from homeassistant.const import ( from homeassistant.const import (
ELECTRIC_POTENTIAL_VOLT,
PERCENTAGE, PERCENTAGE,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT, SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
UnitOfElectricPotential,
) )
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity import EntityCategory
@ -72,7 +72,7 @@ SENSORS: tuple[YaleXSBLESensorEntityDescription, ...] = (
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
has_entity_name=True, has_entity_name=True,
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT, native_unit_of_measurement=UnitOfElectricPotential.VOLT,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
value_fn=lambda state, info, connection: state.battery.voltage value_fn=lambda state, info, connection: state.battery.voltage
if state.battery if state.battery