Skip to content

Commit

Permalink
Categorize some of the sensors as diagnostic (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
slovdahl authored Jun 27, 2023
1 parent 8bb57c2 commit 36d1a59
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion custom_components/spothinta/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CURRENCY_EURO, UnitOfEnergy
from homeassistant.const import CURRENCY_EURO, EntityCategory, UnitOfEnergy
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceEntryType
from homeassistant.helpers.entity import DeviceInfo
Expand Down Expand Up @@ -75,55 +75,63 @@ class SpotHintaSensorEntityDescription(
key="max_price_today",
name="Highest price - Today",
service_type="energy",
entity_category=EntityCategory.DIAGNOSTIC,
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
value_fn=lambda data: data.energy_today.highest_price_today,
),
SpotHintaSensorEntityDescription(
key="max_price_tomorrow",
name="Highest price - Tomorrow",
service_type="energy",
entity_category=EntityCategory.DIAGNOSTIC,
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
value_fn=lambda data: data.energy_today.highest_price_tomorrow,
),
SpotHintaSensorEntityDescription(
key="min_price_today",
name="Lowest price - Today",
service_type="energy",
entity_category=EntityCategory.DIAGNOSTIC,
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
value_fn=lambda data: data.energy_today.lowest_price_today,
),
SpotHintaSensorEntityDescription(
key="min_price_tomorrow",
name="Lowest price - Tomorrow",
service_type="energy",
entity_category=EntityCategory.DIAGNOSTIC,
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}",
value_fn=lambda data: data.energy_today.lowest_price_tomorrow,
),
SpotHintaSensorEntityDescription(
key="highest_price_time_today",
name="Time of highest price - Today",
service_type="energy",
entity_category=EntityCategory.DIAGNOSTIC,
device_class=SensorDeviceClass.TIMESTAMP,
value_fn=lambda data: data.energy_today.highest_price_time_today,
),
SpotHintaSensorEntityDescription(
key="highest_price_time_tomorrow",
name="Time of highest price - Tomorrow",
service_type="energy",
entity_category=EntityCategory.DIAGNOSTIC,
device_class=SensorDeviceClass.TIMESTAMP,
value_fn=lambda data: data.energy_today.highest_price_time_tomorrow,
),
SpotHintaSensorEntityDescription(
key="lowest_price_time_today",
name="Time of lowest price - Today",
service_type="energy",
entity_category=EntityCategory.DIAGNOSTIC,
device_class=SensorDeviceClass.TIMESTAMP,
value_fn=lambda data: data.energy_today.lowest_price_time_today,
),
SpotHintaSensorEntityDescription(
key="lowest_price_time_tomorrow",
name="Time of lowest price - Tomorrow",
service_type="energy",
entity_category=EntityCategory.DIAGNOSTIC,
device_class=SensorDeviceClass.TIMESTAMP,
value_fn=lambda data: data.energy_today.lowest_price_time_tomorrow,
),
Expand Down

0 comments on commit 36d1a59

Please sign in to comment.