Replace Reolink HDR switch by HDR select entity (#122373)

* Add HDR select

* Update strings.json

* Update strings.json

* add icon

* remove HDR switch

* cleanup old HDR switch

* add tests

* Keep HDR switch entity around untill HA 2025.2.0

* Add repair issue

* Update strings.json

* fixes and review comments

* Add tests

* Update homeassistant/components/reolink/strings.json

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Update homeassistant/components/reolink/switch.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* fixes and simplify

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
starkillerOG 2024-07-23 13:28:33 +02:00 committed by GitHub
parent 0d765a27c9
commit 1fd3c9d6dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 147 additions and 11 deletions

View file

@ -9,6 +9,7 @@ from typing import Any
from reolink_aio.api import (
DayNightEnum,
HDREnum,
Host,
SpotlightModeEnum,
StatusLedEnum,
@ -118,6 +119,17 @@ SELECT_ENTITIES = (
api.set_status_led(ch, StatusLedEnum[name].value, doorbell=True)
),
),
ReolinkSelectEntityDescription(
key="hdr",
cmd_key="GetIsp",
translation_key="hdr",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
get_options=[method.name for method in HDREnum],
supported=lambda api, ch: api.supported(ch, "HDR"),
value=lambda api, ch: HDREnum(api.HDR_state(ch)).name,
method=lambda api, ch, name: api.set_HDR(ch, HDREnum[name].value),
),
)