mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-30 05:13:40 +00:00
fix
This commit is contained in:
parent
39f426cd97
commit
069490d8cd
2 changed files with 13 additions and 13 deletions
|
|
@ -256,7 +256,7 @@ class TibberPricesBinarySensor(TibberPricesEntity, BinarySensorEntity):
|
||||||
}
|
}
|
||||||
# Merge any extra fields from the original interval (future-proofing)
|
# Merge any extra fields from the original interval (future-proofing)
|
||||||
new_interval.update(interval_copy)
|
new_interval.update(interval_copy)
|
||||||
new_interval["price_ct"] = round(new_interval["price"] * 100, 2)
|
new_interval["price_minor"] = round(new_interval["price"] * 100, 2)
|
||||||
price_diff = new_interval["price"] - annotation_ctx["ref_price"]
|
price_diff = new_interval["price"] - annotation_ctx["ref_price"]
|
||||||
new_interval[annotation_ctx["diff_key"]] = round(price_diff, 4)
|
new_interval[annotation_ctx["diff_key"]] = round(price_diff, 4)
|
||||||
new_interval[annotation_ctx["diff_ct_key"]] = round(price_diff * 100, 2)
|
new_interval[annotation_ctx["diff_ct_key"]] = round(price_diff * 100, 2)
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ if TYPE_CHECKING:
|
||||||
from .coordinator import TibberPricesDataUpdateCoordinator
|
from .coordinator import TibberPricesDataUpdateCoordinator
|
||||||
from .data import TibberPricesConfigEntry
|
from .data import TibberPricesConfigEntry
|
||||||
|
|
||||||
PRICE_UNIT_CENT = "ct/" + UnitOfPower.KILO_WATT + UnitOfTime.HOURS
|
PRICE_UNIT = CURRENCY_EURO + "/" + UnitOfPower.KILO_WATT + UnitOfTime.HOURS
|
||||||
PRICE_UNIT_EURO = CURRENCY_EURO + "/" + UnitOfPower.KILO_WATT + UnitOfTime.HOURS
|
PRICE_UNIT_MINOR = "ct/" + UnitOfPower.KILO_WATT + UnitOfTime.HOURS
|
||||||
HOURS_IN_DAY = 24
|
HOURS_IN_DAY = 24
|
||||||
LAST_HOUR_OF_DAY = 23
|
LAST_HOUR_OF_DAY = 23
|
||||||
INTERVALS_PER_HOUR = 4 # 15-minute intervals
|
INTERVALS_PER_HOUR = 4 # 15-minute intervals
|
||||||
|
|
@ -52,7 +52,7 @@ PRICE_SENSORS = (
|
||||||
name="Current Electricity Price",
|
name="Current Electricity Price",
|
||||||
icon="mdi:currency-eur",
|
icon="mdi:currency-eur",
|
||||||
device_class=SensorDeviceClass.MONETARY,
|
device_class=SensorDeviceClass.MONETARY,
|
||||||
native_unit_of_measurement=PRICE_UNIT_CENT,
|
native_unit_of_measurement=PRICE_UNIT_MINOR,
|
||||||
suggested_display_precision=1,
|
suggested_display_precision=1,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
|
@ -61,7 +61,7 @@ PRICE_SENSORS = (
|
||||||
name="Current Electricity Price",
|
name="Current Electricity Price",
|
||||||
icon="mdi:currency-eur",
|
icon="mdi:currency-eur",
|
||||||
device_class=SensorDeviceClass.MONETARY,
|
device_class=SensorDeviceClass.MONETARY,
|
||||||
native_unit_of_measurement=PRICE_UNIT_EURO,
|
native_unit_of_measurement=PRICE_UNIT,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
suggested_display_precision=2,
|
suggested_display_precision=2,
|
||||||
),
|
),
|
||||||
|
|
@ -71,7 +71,7 @@ PRICE_SENSORS = (
|
||||||
name="Next Interval Electricity Price",
|
name="Next Interval Electricity Price",
|
||||||
icon="mdi:currency-eur-off",
|
icon="mdi:currency-eur-off",
|
||||||
device_class=SensorDeviceClass.MONETARY,
|
device_class=SensorDeviceClass.MONETARY,
|
||||||
native_unit_of_measurement=PRICE_UNIT_CENT,
|
native_unit_of_measurement=PRICE_UNIT_MINOR,
|
||||||
suggested_display_precision=1,
|
suggested_display_precision=1,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
|
@ -80,7 +80,7 @@ PRICE_SENSORS = (
|
||||||
name="Next Interval Electricity Price",
|
name="Next Interval Electricity Price",
|
||||||
icon="mdi:currency-eur-off",
|
icon="mdi:currency-eur-off",
|
||||||
device_class=SensorDeviceClass.MONETARY,
|
device_class=SensorDeviceClass.MONETARY,
|
||||||
native_unit_of_measurement=PRICE_UNIT_EURO,
|
native_unit_of_measurement=PRICE_UNIT,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
suggested_display_precision=2,
|
suggested_display_precision=2,
|
||||||
),
|
),
|
||||||
|
|
@ -100,7 +100,7 @@ STATISTICS_SENSORS = (
|
||||||
name="Today's Lowest Price",
|
name="Today's Lowest Price",
|
||||||
icon="mdi:currency-eur",
|
icon="mdi:currency-eur",
|
||||||
device_class=SensorDeviceClass.MONETARY,
|
device_class=SensorDeviceClass.MONETARY,
|
||||||
native_unit_of_measurement=PRICE_UNIT_CENT,
|
native_unit_of_measurement=PRICE_UNIT_MINOR,
|
||||||
suggested_display_precision=1,
|
suggested_display_precision=1,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
|
@ -109,7 +109,7 @@ STATISTICS_SENSORS = (
|
||||||
name="Today's Lowest Price",
|
name="Today's Lowest Price",
|
||||||
icon="mdi:currency-eur",
|
icon="mdi:currency-eur",
|
||||||
device_class=SensorDeviceClass.MONETARY,
|
device_class=SensorDeviceClass.MONETARY,
|
||||||
native_unit_of_measurement=PRICE_UNIT_EURO,
|
native_unit_of_measurement=PRICE_UNIT,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
suggested_display_precision=2,
|
suggested_display_precision=2,
|
||||||
),
|
),
|
||||||
|
|
@ -119,7 +119,7 @@ STATISTICS_SENSORS = (
|
||||||
name="Today's Highest Price",
|
name="Today's Highest Price",
|
||||||
icon="mdi:currency-eur",
|
icon="mdi:currency-eur",
|
||||||
device_class=SensorDeviceClass.MONETARY,
|
device_class=SensorDeviceClass.MONETARY,
|
||||||
native_unit_of_measurement=PRICE_UNIT_CENT,
|
native_unit_of_measurement=PRICE_UNIT_MINOR,
|
||||||
suggested_display_precision=1,
|
suggested_display_precision=1,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
|
@ -128,7 +128,7 @@ STATISTICS_SENSORS = (
|
||||||
name="Today's Highest Price",
|
name="Today's Highest Price",
|
||||||
icon="mdi:currency-eur",
|
icon="mdi:currency-eur",
|
||||||
device_class=SensorDeviceClass.MONETARY,
|
device_class=SensorDeviceClass.MONETARY,
|
||||||
native_unit_of_measurement=PRICE_UNIT_EURO,
|
native_unit_of_measurement=PRICE_UNIT,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
suggested_display_precision=2,
|
suggested_display_precision=2,
|
||||||
),
|
),
|
||||||
|
|
@ -138,7 +138,7 @@ STATISTICS_SENSORS = (
|
||||||
name="Today's Average Price",
|
name="Today's Average Price",
|
||||||
icon="mdi:currency-eur",
|
icon="mdi:currency-eur",
|
||||||
device_class=SensorDeviceClass.MONETARY,
|
device_class=SensorDeviceClass.MONETARY,
|
||||||
native_unit_of_measurement=PRICE_UNIT_CENT,
|
native_unit_of_measurement=PRICE_UNIT_MINOR,
|
||||||
suggested_display_precision=1,
|
suggested_display_precision=1,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
|
@ -147,7 +147,7 @@ STATISTICS_SENSORS = (
|
||||||
name="Today's Average Price",
|
name="Today's Average Price",
|
||||||
icon="mdi:currency-eur",
|
icon="mdi:currency-eur",
|
||||||
device_class=SensorDeviceClass.MONETARY,
|
device_class=SensorDeviceClass.MONETARY,
|
||||||
native_unit_of_measurement=PRICE_UNIT_EURO,
|
native_unit_of_measurement=PRICE_UNIT,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
suggested_display_precision=2,
|
suggested_display_precision=2,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue