mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Use new SensorDeviceClass in arwn (#61275)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
84141ff3dd
commit
25db4a4f1f
@ -3,10 +3,9 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components import mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
DEGREE,
|
DEGREE,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
PRECIPITATION_INCHES,
|
PRECIPITATION_INCHES,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
@ -37,7 +36,7 @@ def discover_sensors(topic, payload):
|
|||||||
else:
|
else:
|
||||||
unit = TEMP_CELSIUS
|
unit = TEMP_CELSIUS
|
||||||
return ArwnSensor(
|
return ArwnSensor(
|
||||||
topic, name, "temp", unit, device_class=DEVICE_CLASS_TEMPERATURE
|
topic, name, "temp", unit, device_class=SensorDeviceClass.TEMPERATURE
|
||||||
)
|
)
|
||||||
if domain == "moisture":
|
if domain == "moisture":
|
||||||
name = f"{parts[2]} Moisture"
|
name = f"{parts[2]} Moisture"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user