mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
Fix creation of unrequired sensors in OVO energy (#38835)
This commit is contained in:
parent
7343649c54
commit
1f3b9bc70c
@ -27,18 +27,20 @@ async def async_setup_entry(
|
|||||||
]
|
]
|
||||||
client: OVOEnergy = hass.data[DOMAIN][entry.entry_id][DATA_CLIENT]
|
client: OVOEnergy = hass.data[DOMAIN][entry.entry_id][DATA_CLIENT]
|
||||||
|
|
||||||
currency = coordinator.data.electricity[
|
entities = []
|
||||||
len(coordinator.data.electricity) - 1
|
|
||||||
].cost.currency_unit
|
if coordinator.data.electricity:
|
||||||
|
currency = coordinator.data.electricity[
|
||||||
|
len(coordinator.data.electricity) - 1
|
||||||
|
].cost.currency_unit
|
||||||
|
entities.append(OVOEnergyLastElectricityReading(coordinator, client))
|
||||||
|
entities.append(OVOEnergyLastElectricityCost(coordinator, client, currency))
|
||||||
|
if coordinator.data.gas:
|
||||||
|
entities.append(OVOEnergyLastGasReading(coordinator, client))
|
||||||
|
entities.append(OVOEnergyLastGasCost(coordinator, client, currency))
|
||||||
|
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
[
|
entities, True,
|
||||||
OVOEnergyLastElectricityReading(coordinator, client),
|
|
||||||
OVOEnergyLastGasReading(coordinator, client),
|
|
||||||
OVOEnergyLastElectricityCost(coordinator, client, currency),
|
|
||||||
OVOEnergyLastGasCost(coordinator, client, currency),
|
|
||||||
],
|
|
||||||
True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user