Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reolink add animal detection #104216

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion homeassistant/components/reolink/binary_sensor.py
Expand Up @@ -71,7 +71,16 @@ class ReolinkBinarySensorEntityDescription(BinarySensorEntityDescription):
icon="mdi:dog-side",
icon_off="mdi:dog-side-off",
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"),
MartinHjelmare marked this conversation as resolved.
Show resolved Hide resolved
),
ReolinkBinarySensorEntityDescription(
key=PET_DETECTION_TYPE,
jpbede marked this conversation as resolved.
Show resolved Hide resolved
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(
key="visitor",
Expand Down
38 changes: 36 additions & 2 deletions homeassistant/components/reolink/number.py
Expand Up @@ -162,7 +162,23 @@ class ReolinkNumberEntityDescription(NumberEntityDescription):
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",
jpbede marked this conversation as resolved.
Show resolved Hide resolved
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"),
Expand Down Expand Up @@ -226,7 +242,25 @@ class ReolinkNumberEntityDescription(NumberEntityDescription):
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",
jpbede marked this conversation as resolved.
Show resolved Hide resolved
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"),
Expand Down
15 changes: 15 additions & 0 deletions homeassistant/components/reolink/strings.json
Expand Up @@ -75,6 +75,9 @@
"pet": {
"name": "Pet"
},
"animal": {
"name": "Animal"
},
"visitor": {
"name": "Visitor"
},
Expand All @@ -93,6 +96,9 @@
"pet_lens_0": {
"name": "Pet lens 0"
},
"animal_lens_0": {
"name": "Animal lens 0"
},
"visitor_lens_0": {
"name": "Visitor lens 0"
},
Expand All @@ -111,6 +117,9 @@
"pet_lens_1": {
"name": "Pet lens 1"
},
"animal_lens_1": {
"name": "Animal lens 1"
},
"visitor_lens_1": {
"name": "Visitor lens 1"
}
Expand Down Expand Up @@ -189,6 +198,9 @@
"ai_pet_sensititvity": {
"name": "AI pet sensitivity"
},
"ai_animal_sensititvity": {
"name": "AI animal sensitivity"
},
"ai_face_delay": {
"name": "AI face delay"
},
Expand All @@ -201,6 +213,9 @@
"ai_pet_delay": {
"name": "AI pet delay"
},
"ai_animal_delay": {
"name": "AI animal delay"
},
"auto_quick_reply_time": {
"name": "Auto quick reply time"
},
Expand Down