mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Use new SensorStateClass enum in amberelectric (#61265)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
e4e0dcbae0
commit
549b72e48e
@ -15,9 +15,9 @@ from amberelectric.model.current_interval import CurrentInterval
|
|||||||
from amberelectric.model.forecast_interval import ForecastInterval
|
from amberelectric.model.forecast_interval import ForecastInterval
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
STATE_CLASS_MEASUREMENT,
|
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CURRENCY_DOLLAR, ENERGY_KILO_WATT_HOUR
|
from homeassistant.const import CURRENCY_DOLLAR, ENERGY_KILO_WATT_HOUR
|
||||||
@ -209,7 +209,7 @@ async def async_setup_entry(
|
|||||||
key="current",
|
key="current",
|
||||||
name=f"{entry.title} - {friendly_channel_type(channel_type)} Price",
|
name=f"{entry.title} - {friendly_channel_type(channel_type)} Price",
|
||||||
native_unit_of_measurement=UNIT,
|
native_unit_of_measurement=UNIT,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
icon=ICONS[channel_type],
|
icon=ICONS[channel_type],
|
||||||
)
|
)
|
||||||
entities.append(AmberPriceSensor(coordinator, description, channel_type))
|
entities.append(AmberPriceSensor(coordinator, description, channel_type))
|
||||||
@ -219,7 +219,7 @@ async def async_setup_entry(
|
|||||||
key="forecasts",
|
key="forecasts",
|
||||||
name=f"{entry.title} - {friendly_channel_type(channel_type)} Forecast",
|
name=f"{entry.title} - {friendly_channel_type(channel_type)} Forecast",
|
||||||
native_unit_of_measurement=UNIT,
|
native_unit_of_measurement=UNIT,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
icon=ICONS[channel_type],
|
icon=ICONS[channel_type],
|
||||||
)
|
)
|
||||||
entities.append(AmberForecastSensor(coordinator, description, channel_type))
|
entities.append(AmberForecastSensor(coordinator, description, channel_type))
|
||||||
@ -228,7 +228,7 @@ async def async_setup_entry(
|
|||||||
key="renewables",
|
key="renewables",
|
||||||
name=f"{entry.title} - Renewables",
|
name=f"{entry.title} - Renewables",
|
||||||
native_unit_of_measurement="%",
|
native_unit_of_measurement="%",
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
icon="mdi:solar-power",
|
icon="mdi:solar-power",
|
||||||
)
|
)
|
||||||
entities.append(AmberGridSensor(coordinator, renewables_description))
|
entities.append(AmberGridSensor(coordinator, renewables_description))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user