Skip to content

Commit

Permalink
Fix "Always On" doorbell led option for latest NVR firmware, changed …
Browse files Browse the repository at this point in the history
…from "Always" to "KeepOn"
  • Loading branch information
starkillerOG committed Dec 30, 2024
1 parent 4f4ff13 commit 781c713
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion reolink_aio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ def __init__(
self._email_settings: dict[int, dict] = {}
self._ir_settings: dict[int, dict] = {}
self._status_led_settings: dict[int, dict] = {}
self._status_led_range: dict[int, dict] = {}
self._whiteled_settings: dict[int, dict] = {}
self._sleep: dict[int, bool] = {}
self._battery: dict[int, dict] = {}
Expand Down Expand Up @@ -825,7 +826,11 @@ def doorbell_led_list(self, channel: int) -> list[str]:
mode_values.append(StatusLedEnum.stayoff)
mode_values.extend([StatusLedEnum.auto, StatusLedEnum.alwaysonatnight])
if self.api_version("supportDoorbellLightKeepOn", channel) > 0:
mode_values.append(StatusLedEnum.alwayson)
options = self._status_led_range.get(channel, {}).get("PowerLed").get("eDoorbellLightState", [])
if "KeepOn" in options:
mode_values.append(StatusLedEnum.alwayson)
else:
mode_values.append(StatusLedEnum.always)

return [val.name for val in mode_values]

Expand Down Expand Up @@ -2281,6 +2286,8 @@ async def get_host_data(self) -> None:
if self.supported(channel, "webhook"):
ch_body.append({"cmd": "GetWebHook", "action": 0, "param": {"channel": channel}})
# checking range
if self.supported(channel, "doorbell_led"):
ch_body.append({"cmd": "GetPowerLed", "action": 1, "param": {"channel": channel}})
if self.supported(channel, "zoom_basic") or self.api_version("supportDigitalZoom", channel) > 0:
ch_body.append({"cmd": "GetZoomFocus", "action": 1, "param": {"channel": channel}})
if self.supported(channel, "pan_tilt") and self.api_version("ptzPreset", channel) >= 1:
Expand Down Expand Up @@ -3744,6 +3751,8 @@ def map_channel_json_response(self, json_data, channel: int, chime_id: int = -1)
# GetPowerLed returns incorrect channel
# response_channel = data["value"]["PowerLed"]["channel"]
self._status_led_settings[channel] = data["value"]
if "range" in data:
self._status_led_range[channel] = data["range"]

elif data["cmd"] == "GetWhiteLed":
response_channel = data["value"]["WhiteLed"]["channel"]
Expand Down
3 changes: 2 additions & 1 deletion reolink_aio/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class StatusLedEnum(Enum):
stayoff = "KeepOff"
auto = "Off"
alwaysonatnight = "On"
alwayson = "Always"
always = "Always"
alwayson = "KeepOn"


class DayNightEnum(Enum):
Expand Down

0 comments on commit 781c713

Please sign in to comment.