Use new SensorDeviceClass in arwn (#61275)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-08 21:56:41 +01:00 committed by GitHub
parent 84141ff3dd
commit 25db4a4f1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,10 +3,9 @@ import json
import logging
from homeassistant.components import mqtt
from homeassistant.components.sensor import SensorEntity
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.const import (
DEGREE,
DEVICE_CLASS_TEMPERATURE,
PRECIPITATION_INCHES,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
@ -37,7 +36,7 @@ def discover_sensors(topic, payload):
else:
unit = TEMP_CELSIUS
return ArwnSensor(
topic, name, "temp", unit, device_class=DEVICE_CLASS_TEMPERATURE
topic, name, "temp", unit, device_class=SensorDeviceClass.TEMPERATURE
)
if domain == "moisture":
name = f"{parts[2]} Moisture"