Change Ezviz detection sensitivity to update per entity (#93995)
* Split detection sensitivity updates to entity instead of coordinator. * Detection Sensitivity entity individual poll. * Api return None instead of "unkown" when unkown. * Only add entity if camera supports * Cleanup detection type * Commit suggestions. --------- Co-authored-by: Chris Talkington <chris@talkingtontech.com>
This commit is contained in:
parent
d431a692e5
commit
6af1beb6bf
5 changed files with 113 additions and 40 deletions
|
@ -38,3 +38,32 @@ class EzvizEntity(CoordinatorEntity[EzvizDataUpdateCoordinator], Entity):
|
|||
def data(self) -> dict[str, Any]:
|
||||
"""Return coordinator data for this entity."""
|
||||
return self.coordinator.data[self._serial]
|
||||
|
||||
|
||||
class EzvizBaseEntity(Entity):
|
||||
"""Generic entity for EZVIZ individual poll entities."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: EzvizDataUpdateCoordinator,
|
||||
serial: str,
|
||||
) -> None:
|
||||
"""Initialize the entity."""
|
||||
self._serial = serial
|
||||
self.coordinator = coordinator
|
||||
self._camera_name = self.data["name"]
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, serial)},
|
||||
connections={
|
||||
(CONNECTION_NETWORK_MAC, self.data["mac_address"]),
|
||||
},
|
||||
manufacturer=MANUFACTURER,
|
||||
model=self.data["device_sub_category"],
|
||||
name=self.data["name"],
|
||||
sw_version=self.data["version"],
|
||||
)
|
||||
|
||||
@property
|
||||
def data(self) -> dict[str, Any]:
|
||||
"""Return coordinator data for this entity."""
|
||||
return self.coordinator.data[self._serial]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue