Skip to content

Commit

Permalink
Move away from deprecated consts (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
bajansen authored Jan 10, 2024
1 parent 696eddb commit cfb1ebc
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions custom_components/frank_energie/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CURRENCY_EURO,
ENERGY_KILO_WATT_HOUR,
VOLUME_CUBIC_METERS,
UnitOfEnergy,
UnitOfVolume,
)
from homeassistant.core import HassJob, HomeAssistant
from homeassistant.helpers import event
Expand Down Expand Up @@ -59,7 +59,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="elec_markup",
name="Current electricity price (All-in)",
native_unit_of_measurement=f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_ELECTRICITY].current_hour.total,
Expand All @@ -68,7 +68,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="elec_market",
name="Current electricity market price",
native_unit_of_measurement=f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_ELECTRICITY].current_hour.market_price,
Expand All @@ -77,7 +77,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="elec_tax",
name="Current electricity price including tax",
native_unit_of_measurement=f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_ELECTRICITY].current_hour.market_price_with_tax,
Expand All @@ -88,7 +88,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="elec_tax_vat",
name="Current electricity VAT price",
native_unit_of_measurement=f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_ELECTRICITY].current_hour.market_price_tax,
Expand All @@ -97,7 +97,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="elec_sourcing",
name="Current electricity sourcing markup",
native_unit_of_measurement=f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_ELECTRICITY].current_hour.sourcing_markup_price,
Expand All @@ -106,7 +106,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="elec_tax_only",
name="Current electricity tax only",
native_unit_of_measurement=f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_ELECTRICITY].current_hour.energy_tax_price,
Expand All @@ -115,7 +115,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="gas_markup",
name="Current gas price (All-in)",
native_unit_of_measurement=f"{CURRENCY_EURO}/{VOLUME_CUBIC_METERS}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfVolume.CUBIC_METERS}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_GAS].current_hour.total,
Expand All @@ -124,7 +124,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="gas_market",
name="Current gas market price",
native_unit_of_measurement=f"{CURRENCY_EURO}/{VOLUME_CUBIC_METERS}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfVolume.CUBIC_METERS}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_GAS].current_hour.market_price,
Expand All @@ -133,7 +133,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="gas_tax",
name="Current gas price including tax",
native_unit_of_measurement=f"{CURRENCY_EURO}/{VOLUME_CUBIC_METERS}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfVolume.CUBIC_METERS}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_GAS].current_hour.market_price_with_tax,
Expand All @@ -142,7 +142,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="gas_tax_vat",
name="Current gas VAT price",
native_unit_of_measurement=f"{CURRENCY_EURO}/{VOLUME_CUBIC_METERS}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfVolume.CUBIC_METERS}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_GAS].current_hour.market_price_tax,
Expand All @@ -151,7 +151,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="gas_sourcing",
name="Current gas sourcing price",
native_unit_of_measurement=f"{CURRENCY_EURO}/{VOLUME_CUBIC_METERS}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfVolume.CUBIC_METERS}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_GAS].current_hour.sourcing_markup_price,
Expand All @@ -160,7 +160,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="gas_tax_only",
name="Current gas tax only",
native_unit_of_measurement=f"{CURRENCY_EURO}/{VOLUME_CUBIC_METERS}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfVolume.CUBIC_METERS}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_GAS].current_hour.energy_tax_price,
Expand All @@ -169,7 +169,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="gas_min",
name="Lowest gas price today",
native_unit_of_measurement=f"{CURRENCY_EURO}/{VOLUME_CUBIC_METERS}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfVolume.CUBIC_METERS}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_GAS].today_min.total,
Expand All @@ -178,7 +178,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="gas_max",
name="Highest gas price today",
native_unit_of_measurement=f"{CURRENCY_EURO}/{VOLUME_CUBIC_METERS}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfVolume.CUBIC_METERS}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_GAS].today_max.total,
Expand All @@ -187,7 +187,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="elec_min",
name="Lowest energy price today",
native_unit_of_measurement=f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_ELECTRICITY].today_min.total,
Expand All @@ -196,7 +196,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="elec_max",
name="Highest energy price today",
native_unit_of_measurement=f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_ELECTRICITY].today_max.total,
Expand All @@ -205,7 +205,7 @@ class FrankEnergieEntityDescription(SensorEntityDescription):
FrankEnergieEntityDescription(
key="elec_avg",
name="Average electricity price today",
native_unit_of_measurement=f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}",
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
suggested_display_precision=2,
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda data: data[DATA_ELECTRICITY].today_avg,
Expand Down

0 comments on commit cfb1ebc

Please sign in to comment.