Energyzero - Add sensor entity to pick best hours (#98916)
* Add entity to pick best hours * Add entity also to diagnostics * Remove string translation that doesn't exists --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
816f834807
commit
d8f0c090cf
6 changed files with 88 additions and 4 deletions
|
@ -13,7 +13,13 @@ from homeassistant.components.sensor import (
|
|||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CURRENCY_EURO, PERCENTAGE, UnitOfEnergy, UnitOfVolume
|
||||
from homeassistant.const import (
|
||||
CURRENCY_EURO,
|
||||
PERCENTAGE,
|
||||
UnitOfEnergy,
|
||||
UnitOfTime,
|
||||
UnitOfVolume,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -114,6 +120,14 @@ SENSORS: tuple[EnergyZeroSensorEntityDescription, ...] = (
|
|||
icon="mdi:percent",
|
||||
value_fn=lambda data: data.energy_today.pct_of_max_price,
|
||||
),
|
||||
EnergyZeroSensorEntityDescription(
|
||||
key="hours_priced_equal_or_lower",
|
||||
translation_key="hours_priced_equal_or_lower",
|
||||
service_type="today_energy",
|
||||
native_unit_of_measurement=UnitOfTime.HOURS,
|
||||
icon="mdi:clock",
|
||||
value_fn=lambda data: data.energy_today.hours_priced_equal_or_lower,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue