mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Ezviz NumberEntity 1st update only when enabled (#96587)
* Initial commit * Initial commit * Fix async_aded_to_hass
This commit is contained in:
parent
b53eae2846
commit
e39187423f
@ -66,14 +66,11 @@ async def async_setup_entry(
|
|||||||
]
|
]
|
||||||
|
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
[
|
EzvizSensor(coordinator, camera, value, entry.entry_id)
|
||||||
EzvizSensor(coordinator, camera, value, entry.entry_id)
|
for camera in coordinator.data
|
||||||
for camera in coordinator.data
|
for capibility, value in coordinator.data[camera]["supportExt"].items()
|
||||||
for capibility, value in coordinator.data[camera]["supportExt"].items()
|
if capibility == NUMBER_TYPE.supported_ext
|
||||||
if capibility == NUMBER_TYPE.supported_ext
|
if value in NUMBER_TYPE.supported_ext_value
|
||||||
if value in NUMBER_TYPE.supported_ext_value
|
|
||||||
],
|
|
||||||
update_before_add=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -98,6 +95,10 @@ class EzvizSensor(EzvizBaseEntity, NumberEntity):
|
|||||||
self.config_entry_id = config_entry_id
|
self.config_entry_id = config_entry_id
|
||||||
self.sensor_value: int | None = None
|
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
|
@property
|
||||||
def native_value(self) -> float | None:
|
def native_value(self) -> float | None:
|
||||||
"""Return the state of the entity."""
|
"""Return the state of the entity."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user