starkillerOG / reolink_aio

Reolink NVR/camera API PyPI package
MIT License
65 stars 13 forks source link

GetChnTypeInfo Unknown command #34

Closed hamshiva closed 1 year ago

hamshiva commented 1 year ago

Hi,

I am using the HomeAssistant Reolink integration and since the last upgrade using reolink-aio 0.6.0, my RLC-820A cameras aren't working anymore with the integration. I pin pointed the issue to the 6a49645 commit.

I discovered that the camera response to the GetChnTypeInfo command is: { "cmd" : "Unknown", "code" : 1, "error" : { "detail" : "not support", "rspCode" : -9 } }, As the cmd value is Unknown instead of GetChnTypeInfo the map_channel_json_response function fails to match the value.

My cameras are using the latest available firmware: RLC-820A Firmware: v3.1.0.956_22041501 Hardware: IPC_523128M8MP

Regards,

starkillerOG commented 1 year ago

@hamshiva if the GetChnTypeInfo is not available, that schould not be a issue for the integration, yes the camera will respond with Unknown, but that will just be ignored and the lib will fall back on other methods to get the needed info.

Most likely there is a diffrent issue causing the camera's to fail.

Could you turn on debug logging for the reolink integration in HomeAssistant, reboot HomeAssistant, turn off debug logging after 5 minutes and post the resulting debug .txt file here? I can then look if I can find the issue.

hamshiva commented 1 year ago

Hi,

Well It seems that homeassistant is using the version 0.5.16 of reolink_aio. I am not sure what happenned exactly not even sure I was using version 0.6.0...

I am unable to reproduce the issue anymore. But I could gather the debug log I got when the issue appeared. Serials and MAC addresses have been redacted. hass.log

starkillerOG commented 1 year ago

I can't see anything unusual in the debug log, if it happens again let me know. For now I will close the issue since it seems to be a one off thing.

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.

starkillerOG commented 1 year ago

The line which is indicating the problem is this one: Jun 14 08:54:48 storez hass[339]: 2023-06-14 08:54:48.655 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Reo2' for reolink integration not ready yet: Error while trying to setup 192.168.10.110:443: Error registering URL for webhook reolink_ec71db7d3d02_ONVIF: HomeAssistant URL is not available; Retrying in background

Probably something wrong with the network configuration at that time.

silpertan commented 1 year ago

I believe I am seeing this same issue. I try to add a Reolink E1 Zoom camera, and I get a message with the same text about "Error registering URL for webhook..." shown in your last comment. I notice another user with a similar complaint on reddit. My error response screen looks the same as the reddit user.

For me, this always fails. Unfortunately, the instructions for enabling debug logging mention clicking on the triple dots for the integration, but because I have never gotten any camera setup and no auto-detection happens, the integration doesn't show up under Settings -> Devices & Services, so I can't click on the three dots. Is there another way to enable logging?

I have verified that I can ping my camera from a terminal in Home Assistant. Camera access works fine through the camera's web interface. I also did a couple of packet captures. The initial attempt to add the integration uses HTTPS which showed it did do some stuff - probably the same as when I retried and selected port 80. In that case, I could see a login followed by a couple of CGI requests with responses, then a logout. It seems it can at least communicate. I can share any of this if it helps.

My camera firmware is up-to-date. I have a Home Assistant OS installation in a Windows Hyper-V VM. It is also fully updated: Home Assistant 2023.6.3 Supervisor 2023.06.4 Operating System 10.3 Frontend 20230608.0 - latest

hamshiva commented 1 year ago

Hi @silpertan, now that you mention it I do remember having the same behavior. The packet capture shown that the communication with the camera was working correctly and just like you I could see some HTTP requests then a logout.

@starkillerOG maybe we should reopen the issue ? @silpertan seems to be able to reproduce it.

silpertan commented 1 year ago

I just took the latest Home Assistant update (2023.7.0) and tried again with a different E1 Zoom camera. I updated the camera firmware to the latest and let it reset the config to factory default. Then I gave it a password and went to Home Assistant:

Operation failed with the message: See the [troubleshooting steps](https://www.home-assistant.io/integrations/reolink/#troubleshooting) if you encounter problems. Error registering URL for webhook reolink_38c804e0cc5b_ONVIF: HomeAssistant URL is not available

image

starkillerOG commented 1 year ago

@silpertan could you share a screenshot of your configuration under settings->system->network->HomeAssistant URL? You can blanck out the sensitive part of the URLs shown if you want, just need to see if the formatting is correct and it has the http:// or https://

Probably something is misconfigured there.

silpertan commented 1 year ago

Yes - that was the issue. I didn't have anything configured under Settings -> System -> Network -> Home Assistant URL (a place I've never looked until today), and there was an error message in the UI:

Screenshot_2023-07-06_06-47-55

I setup the Internet and Local Network URLs and the Reolink Integration successfully adds my camera.

Note (for others who may come across this conversation), this Home Assistant page provided some helpful discussion about the URL configurations.

starkillerOG commented 1 year ago

@silpertan glad it is now working for you!

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.

starkillerOG commented 1 year ago

I am improving the way this error is shown to also include directions to solve the problem, see PR: https://github.com/home-assistant/core/pull/96088/files