Reolink add animal detection (#104216)

This commit is contained in:
starkillerOG 2023-11-21 12:45:02 +01:00 committed by GitHub
parent 2d38a42fea
commit 2dd0a74b38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 3 deletions

View file

@ -162,7 +162,23 @@ NUMBER_ENTITIES = (
native_min_value=0,
native_max_value=100,
supported=lambda api, ch: (
api.supported(ch, "ai_sensitivity") and api.ai_supported(ch, "dog_cat")
api.supported(ch, "ai_sensitivity")
and api.ai_supported(ch, "dog_cat")
and not api.supported(ch, "ai_animal")
),
value=lambda api, ch: api.ai_sensitivity(ch, "dog_cat"),
method=lambda api, ch, value: api.set_ai_sensitivity(ch, int(value), "dog_cat"),
),
ReolinkNumberEntityDescription(
key="ai_pet_sensititvity",
translation_key="ai_animal_sensititvity",
icon="mdi:paw",
entity_category=EntityCategory.CONFIG,
native_step=1,
native_min_value=0,
native_max_value=100,
supported=lambda api, ch: (
api.supported(ch, "ai_sensitivity") and api.supported(ch, "ai_animal")
),
value=lambda api, ch: api.ai_sensitivity(ch, "dog_cat"),
method=lambda api, ch, value: api.set_ai_sensitivity(ch, int(value), "dog_cat"),
@ -226,7 +242,25 @@ NUMBER_ENTITIES = (
native_min_value=0,
native_max_value=8,
supported=lambda api, ch: (
api.supported(ch, "ai_delay") and api.ai_supported(ch, "dog_cat")
api.supported(ch, "ai_delay")
and api.ai_supported(ch, "dog_cat")
and not api.supported(ch, "ai_animal")
),
value=lambda api, ch: api.ai_delay(ch, "dog_cat"),
method=lambda api, ch, value: api.set_ai_delay(ch, int(value), "dog_cat"),
),
ReolinkNumberEntityDescription(
key="ai_pet_delay",
translation_key="ai_animal_delay",
icon="mdi:paw",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_step=1,
native_unit_of_measurement=UnitOfTime.SECONDS,
native_min_value=0,
native_max_value=8,
supported=lambda api, ch: (
api.supported(ch, "ai_delay") and api.supported(ch, "ai_animal")
),
value=lambda api, ch: api.ai_delay(ch, "dog_cat"),
method=lambda api, ch, value: api.set_ai_delay(ch, int(value), "dog_cat"),