-
Notifications
You must be signed in to change notification settings - Fork 76
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
get_day_night_color > list index out of range error #225
Comments
UPDATE: Overnight a perfectly working different camera suddenly failed with this exact error. 2858 times and counting! It had the exact same reduced response to the VideoInOptions payload as above.
|
Problem still occurring with 2 Dahua IPC-T5442T-ZE cameras updated with latest firmware. Only resolution (other than a software update) is to reset camera to factory defaults and restore a config backup that gets it 90% reconfigured properly. |
On occasion a camera doesn't respond with all the expected values. Ideally the code should check for unexpected values and handle them gracefully.
On several occasions I've seen a perfectly operating camera not being able to initialize in Home Assistant with this index out of range error. I've seen reports from others that have experienced this as well - such as: home-assistant/core#30216
I've tracked this problem down to the async_get_day_night_color call expecting VideoInOptions[0].DayNightColor=n to be returned in the response. When it is inexplicably missing, the following error results:
This is the video.py code section that throws this error when the result is undefined:
I have no idea why the camera will sometimes not respond with the full expected VideoInOptions API payload. What I typically do to fix this is to reset the firmware to defaults and set it all back up again. So while maybe it can be argued that this is not a bug in the code when the camera API is misbehaving, there really should be a value/range check with a default value created and warning that allows the camera to continue to be set up.
For reference, here is the full response received from the /cgi-bin/configManager.cgi?action=getConfig&name=VideoInOptions command when this error occurs:
The text was updated successfully, but these errors were encountered: