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

@ -71,7 +71,16 @@ BINARY_SENSORS = (
icon="mdi:dog-side", icon="mdi:dog-side",
icon_off="mdi:dog-side-off", icon_off="mdi:dog-side-off",
value=lambda api, ch: api.ai_detected(ch, PET_DETECTION_TYPE), value=lambda api, ch: api.ai_detected(ch, PET_DETECTION_TYPE),
supported=lambda api, ch: api.ai_supported(ch, PET_DETECTION_TYPE), supported=lambda api, ch: api.ai_supported(ch, PET_DETECTION_TYPE)
and not api.supported(ch, "ai_animal"),
),
ReolinkBinarySensorEntityDescription(
key=PET_DETECTION_TYPE,
translation_key="animal",
icon="mdi:paw",
icon_off="mdi:paw-off",
value=lambda api, ch: api.ai_detected(ch, PET_DETECTION_TYPE),
supported=lambda api, ch: api.supported(ch, "ai_animal"),
), ),
ReolinkBinarySensorEntityDescription( ReolinkBinarySensorEntityDescription(
key="visitor", key="visitor",

View file

@ -162,7 +162,23 @@ NUMBER_ENTITIES = (
native_min_value=0, native_min_value=0,
native_max_value=100, native_max_value=100,
supported=lambda api, ch: ( 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"), value=lambda api, ch: api.ai_sensitivity(ch, "dog_cat"),
method=lambda api, ch, value: api.set_ai_sensitivity(ch, int(value), "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_min_value=0,
native_max_value=8, native_max_value=8,
supported=lambda api, ch: ( 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"), value=lambda api, ch: api.ai_delay(ch, "dog_cat"),
method=lambda api, ch, value: api.set_ai_delay(ch, int(value), "dog_cat"), method=lambda api, ch, value: api.set_ai_delay(ch, int(value), "dog_cat"),

View file

@ -75,6 +75,9 @@
"pet": { "pet": {
"name": "Pet" "name": "Pet"
}, },
"animal": {
"name": "Animal"
},
"visitor": { "visitor": {
"name": "Visitor" "name": "Visitor"
}, },
@ -93,6 +96,9 @@
"pet_lens_0": { "pet_lens_0": {
"name": "Pet lens 0" "name": "Pet lens 0"
}, },
"animal_lens_0": {
"name": "Animal lens 0"
},
"visitor_lens_0": { "visitor_lens_0": {
"name": "Visitor lens 0" "name": "Visitor lens 0"
}, },
@ -111,6 +117,9 @@
"pet_lens_1": { "pet_lens_1": {
"name": "Pet lens 1" "name": "Pet lens 1"
}, },
"animal_lens_1": {
"name": "Animal lens 1"
},
"visitor_lens_1": { "visitor_lens_1": {
"name": "Visitor lens 1" "name": "Visitor lens 1"
} }
@ -245,6 +254,9 @@
"ai_pet_sensititvity": { "ai_pet_sensititvity": {
"name": "AI pet sensitivity" "name": "AI pet sensitivity"
}, },
"ai_animal_sensititvity": {
"name": "AI animal sensitivity"
},
"ai_face_delay": { "ai_face_delay": {
"name": "AI face delay" "name": "AI face delay"
}, },
@ -257,6 +269,9 @@
"ai_pet_delay": { "ai_pet_delay": {
"name": "AI pet delay" "name": "AI pet delay"
}, },
"ai_animal_delay": {
"name": "AI animal delay"
},
"auto_quick_reply_time": { "auto_quick_reply_time": {
"name": "Auto quick reply time" "name": "Auto quick reply time"
}, },