home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.05k stars 29.71k forks source link

Reolink Day night mode select entity unavailable #96515

Closed RobertD502 closed 1 year ago

RobertD502 commented 1 year ago

The problem

After updating HA to 2023.7.2, the Day night mode select entity is no longer available. This seems to be related to a recent bump of reolink_aio where a new check is done for day/night capabilities which results in incorrectly not setting up the entity for my camera (RLC-423).

What version of Home Assistant Core has the issue?

2023.7.2

What was the last working version of Home Assistant Core?

2023.7.1

What type of installation are you running?

Home Assistant OS

Integration causing the issue

reolink

Link to integration documentation on our website

https://www.home-assistant.io/integrations/reolink/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

2FEA9C5A-953E-44AC-8ACC-1AF99960D851

home-assistant[bot] commented 1 year ago

Hey there @starkillerog, mind taking a look at this issue as it has been labeled with an integration (reolink) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `reolink` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign reolink` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


reolink documentation reolink source (message by IssueLinks)

RobertD502 commented 1 year ago

Further supporting dayNight availability:

{
"cmd" : "GetIsp",
"code" : 0,
"value" : {
"Isp" : {
"antiFlicker" : "Off",
"backLight" : "BackLightControl",
"blc" : 98,
"blueGain" : 128,
"channel" : 0,
"dayNight" : "Color",
"drc" : 175,
"exposure" : "Auto",
"gain" : {
"max" : 38,
"min" : 1
}
RobertD502 commented 1 year ago

GetIsp command initial, range, and current value:

   {
      "cmd" : "GetIsp",
      "code" : 0,
      "initial" : {
         "Isp" : {
            "antiFlicker" : "Off",
            "backLight" : "Off",
            "blc" : 128,
            "blueGain" : 128,
            "channel" : 0,
            "dayNight" : "Auto",
            "drc" : 128,
            "exposure" : "Auto",
            "gain" : {
               "max" : 60,
               "min" : 1
            },
            "mirroring" : 0,
            "nr3d" : 1,
            "redGain" : 128,
            "rotation" : 0,
            "shutter" : {
               "max" : 83,
               "min" : 0
            },
            "whiteBalance" : "Auto"
         }
      },
      "range" : {
         "Isp" : {
            "antiFlicker" : [ "Outdoor", "50HZ", "60HZ", "Off" ],
            "backLight" : [ "Off", "BackLightControl", "DynamicRangeControl" ],
            "blc" : {
               "max" : 255,
               "min" : 0
            },
            "blueGain" : {
               "max" : 255,
               "min" : 0
            },
            "channel" : 0,
            "dayNight" : [ "Auto", "Color", "Black&White" ],
            "drc" : {
               "max" : 255,
               "min" : 0
            },
            "exposure" : [ "Auto", "LowNoise", "Anti-Smearing", "Manual" ],
            "gain" : {
               "max" : 100,
               "min" : 1
            },
            "mirroring" : "boolean",
            "nr3d" : "boolean",
            "redGain" : {
               "max" : 255,
               "min" : 0
            },
            "rotation" : "boolean",
            "shutter" : {
               "max" : 83,
               "min" : 0
            },
            "whiteBalance" : [ "Auto", "Manual" ]
         }
      },
      "value" : {
         "Isp" : {
            "antiFlicker" : "Off",
            "backLight" : "BackLightControl",
            "blc" : 98,
            "blueGain" : 128,
            "channel" : 0,
            "dayNight" : "Color",
            "drc" : 175,
            "exposure" : "Auto",
            "gain" : {
               "max" : 38,
               "min" : 1
            },
            "mirroring" : 0,
            "nr3d" : 0,
            "redGain" : 128,
            "rotation" : 0,
            "shutter" : {
               "max" : 41,
               "min" : 0
            },
            "whiteBalance" : "Auto"
         }
      }
   }
starkillerOG commented 1 year ago

@RobertD502 thank you for reporting this issue with the RLC-423. Could you enable debug logging under Settings->Devices & Services->Reolink integration overflow menu (three vertical dots)->Enable debug logging, Then restart Home Assitant, wait for 2 minutes, disable debug logging and post the .txt log here?

I need the response to the GetAbility command.

Some camera's like the new colorX series still repond to the GetIsp command with a "dayNight" : "Color" command but in fact do not have this option, since they do not have the night option and are always in color mode. The ispDayNight in GetAbility should show if it is supported or not...

RobertD502 commented 1 year ago

@starkillerOG , here is the GetAbility Command:

   {
      "cmd" : "GetAbility",
      "code" : 0,
      "value" : {
         "Ability" : {
            "3g" : {
               "permit" : 0,
               "ver" : 0
            },
            "abilityChn" : [
               {
                  "alarmIoIn" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "alarmIoOut" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "alarmMd" : {
                     "permit" : 6,
                     "ver" : 1
                  },
                  "alarmRf" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "cameraMode" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "enc" : {
                     "permit" : 6,
                     "ver" : 1
                  },
                  "ftp" : {
                     "permit" : 6,
                     "ver" : 6
                  },
                  "image" : {
                     "permit" : 6,
                     "ver" : 1
                  },
                  "isp" : {
                     "permit" : 6,
                     "ver" : 1
                  },
                  "live" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "mask" : {
                     "permit" : 6,
                     "ver" : 1
                  },
                  "osd" : {
                     "permit" : 6,
                     "ver" : 2
                  },
                  "ptzCtrl" : {
                     "permit" : 1,
                     "ver" : 1
                  },
                  "ptzPatrol" : {
                     "permit" : 7,
                     "ver" : 1
                  },
                  "ptzPreset" : {
                     "permit" : 7,
                     "ver" : 1
                  },
                  "ptzTattern" : {
                     "permit" : 7,
                     "ver" : 0
                  },
                  "ptzType" : {
                     "permit" : 0,
                     "ver" : 2
                  },
                  "recCfg" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "recDownload" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "recReplay" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "recSchedule" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "snap" : {
                     "permit" : 6,
                     "ver" : 1
                  }
               }
            ],
            "alarmAudio" : {
               "permit" : 0,
               "ver" : 0
            },
            "alarmDisconnet" : {
               "permit" : 6,
               "ver" : 1
            },
            "alarmHddErr" : {
               "permit" : 0,
               "ver" : 0
            },
            "alarmHddFull" : {
               "permit" : 0,
               "ver" : 0
            },
            "alarmIpConflict" : {
               "permit" : 6,
               "ver" : 1
            },
            "auth" : {
               "permit" : 6,
               "ver" : 1
            },
            "autoMaint" : {
               "permit" : 6,
               "ver" : 1
            },
            "cloudStorage" : {
               "permit" : 0,
               "ver" : 0
            },
            "ddns" : {
               "permit" : 6,
               "ver" : 1
            },
            "devInfo" : {
               "permit" : 4,
               "ver" : 1
            },
            "disableAutoFocus" : {
               "permit" : 6,
               "ver" : 1
            },
            "disk" : {
               "permit" : 0,
               "ver" : 0
            },
            "display" : {
               "permit" : 6,
               "ver" : 1
            },
            "email" : {
               "permit" : 6,
               "ver" : 3
            },
            "emailSchedule" : {
               "permit" : 6,
               "ver" : 1
            },
            "exportCfg" : {
               "permit" : 4,
               "ver" : 1
            },
            "hourFmt" : {
               "permit" : 6,
               "ver" : 1
            },
            "http" : {
               "permit" : 6,
               "ver" : 1
            },
            "https" : {
               "permit" : 6,
               "ver" : 1
            },
            "importCfg" : {
               "permit" : 2,
               "ver" : 1
            },
            "ipcManager" : {
               "permit" : 6,
               "ver" : 1
            },
            "ledControl" : {
               "permit" : 0,
               "ver" : 0
            },
            "localLink" : {
               "permit" : 6,
               "ver" : 1
            },
            "log" : {
               "permit" : 6,
               "ver" : 1
            },
            "mediaPort" : {
               "permit" : 6,
               "ver" : 1
            },
            "ntp" : {
               "permit" : 6,
               "ver" : 1
            },
            "online" : {
               "permit" : 6,
               "ver" : 1
            },
            "onvif" : {
               "permit" : 6,
               "ver" : 1
            },
            "p2p" : {
               "permit" : 6,
               "ver" : 1
            },
            "performance" : {
               "permit" : 4,
               "ver" : 1
            },
            "pppoe" : {
               "permit" : 6,
               "ver" : 0
            },
            "push" : {
               "permit" : 6,
               "ver" : 1
            },
            "pushSchedule" : {
               "permit" : 6,
               "ver" : 1
            },
            "reboot" : {
               "permit" : 1,
               "ver" : 1
            },
            "restore" : {
               "permit" : 1,
               "ver" : 1
            },
            "rtmp" : {
               "permit" : 6,
               "ver" : 1
            },
            "rtsp" : {
               "permit" : 6,
               "ver" : 1
            },
            "sdCard" : {
               "permit" : 0,
               "ver" : 0
            },
            "talk" : {
               "permit" : 0,
               "ver" : 0
            },
            "time" : {
               "permit" : 6,
               "ver" : 1
            },
            "tvSystem" : {
               "permit" : 6,
               "ver" : 1
            },
            "upgrade" : {
               "permit" : 7,
               "ver" : 1
            },
            "upnp" : {
               "permit" : 6,
               "ver" : 1
            },
            "user" : {
               "permit" : 6,
               "ver" : 1
            },
            "videoClip" : {
               "permit" : 6,
               "ver" : 1
            },
            "wifi" : {
               "permit" : 0,
               "ver" : 0
            }
         }
      }
   }

I don't see any mention made of ispDayNight anywhere (in either the GetAbility shared above or within the rest of the debugging log). Since you mentioned that the ColorX series responds with a dayNight to the GetIsp command, do you happen to know what it lists in the dayNight key nested within range --> Isp (as seen in my previous comment)? I'm assuming since the ColorX doesn't have the IR hardware, the dayNight key nested within range would only have "Color" listed instead of the full list for cameras with IR support ("Auto", "Color", "Day&Night") - Perhaps this could be used to delineate which cameras support the dayNight feature and which don't?

starkillerOG commented 1 year ago

@RobertD502 thanks for the info. Yes, I was already thinking about the same thing (checking the range of dayNight). I will connect my CX410 tonight and check what it reports.

Other possibility is to assume ispDayNight is supported if that key is not present in the GetAbility list (probably only for older models that probably all support DayNight).

Will get this resolved soon.

RobertD502 commented 1 year ago

No rush - I forked the library to revert the daynight change and am running the integration as a custom component until the fix is implemented.

starkillerOG commented 1 year ago

The CX410 also reports a range of"dayNight": ["Auto","Color","Black&White"], while it does not have a dayNight settings, indicated by the getAbility: "ispDayNight" : {"permit" : 0, "ver" : 0}.

So I will go for the sollution to assume ispDayNight is supported if that key is not present in the GetAbility list.

starkillerOG commented 1 year ago

This issue schould be fixed with this commit: https://github.com/starkillerOG/reolink_aio/commit/0dda1bfd3690ce7179a8537f1addf5cc1773b0e5. I will publish a new reolink-aio version later today and make a PR to bump the HA version and tag that for HA 2023.8. Therefore closing this now.

If it still does not work in HA 2023.8.0 (released in a week), please let me know.

If you appreciate the reolink integration and want to support its development, please consider sponsering the upstream library or purchase Reolink products through this affiliate link.