Ezviz NumberEntity 1st update only when enabled (#96587)
* Initial commit * Initial commit * Fix async_aded_to_hasspull/96896/head
parent
b53eae2846
commit
e39187423f
|
@ -66,14 +66,11 @@ async def async_setup_entry(
|
|||
]
|
||||
|
||||
async_add_entities(
|
||||
[
|
||||
EzvizSensor(coordinator, camera, value, entry.entry_id)
|
||||
for camera in coordinator.data
|
||||
for capibility, value in coordinator.data[camera]["supportExt"].items()
|
||||
if capibility == NUMBER_TYPE.supported_ext
|
||||
if value in NUMBER_TYPE.supported_ext_value
|
||||
],
|
||||
update_before_add=True,
|
||||
EzvizSensor(coordinator, camera, value, entry.entry_id)
|
||||
for camera in coordinator.data
|
||||
for capibility, value in coordinator.data[camera]["supportExt"].items()
|
||||
if capibility == NUMBER_TYPE.supported_ext
|
||||
if value in NUMBER_TYPE.supported_ext_value
|
||||
)
|
||||
|
||||
|
||||
|
@ -98,6 +95,10 @@ class EzvizSensor(EzvizBaseEntity, NumberEntity):
|
|||
self.config_entry_id = config_entry_id
|
||||
self.sensor_value: int | None = None
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Run when about to be added to hass."""
|
||||
self.schedule_update_ha_state(True)
|
||||
|
||||
@property
|
||||
def native_value(self) -> float | None:
|
||||
"""Return the state of the entity."""
|
||||
|
|
Loading…
Reference in New Issue