fwestenberg / reolink_dev

Home Assistant Reolink addon
MIT License
550 stars 102 forks source link

Failed to connect with the camera - NVR #300

Closed KennethEgholm closed 2 years ago

KennethEgholm commented 2 years ago

Describe the bug When trying to install the integration, I get "Failed to connect with the camera". The IP I am pointing to is the IP of my Reolink NVR.

Screenshots image

Environment:

KennethEgholm commented 2 years ago

I don't see anything related to Reolink in the log - are there anywhere to see integration specific logs ?

KennethEgholm commented 2 years ago

Ok, sorry all. Got it working. I think my internal_url setting was wrong..

MacL3an commented 2 years ago

Could you please specify in more detail how you solved this? I have a brand new setup, running latest reolink_dev version 2.6 and brand new reolink cameras connected to an NVR (firmware 3.0.0.110). I enter the IP of the NVR, leave port 80 and enter credentials and just get this error. Logs say:

2021-10-08 20:16:43 DEBUG (MainThread) [reolink.camera_api] Reolink camera with host http://10.0.1.15/:80 trying to login with user hass
2021-10-08 20:16:48 DEBUG (MainThread) [reolink.camera_api] Host http://10.0.1.15/: Connection error Cannot connect to host http:80 ssl:default [Try again]
2021-10-08 20:16:48 DEBUG (MainThread) [reolink.camera_api] Host http://10.0.1.15/: Error translating Reolink settings response

When connecting to the camera directly through the HASS config it works, so my HASS can reach the NVR:

camera:
  - platform: generic
    name: Cam0
    still_image_url: "http://10.0.1.15/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=iamarandomstringoflettersand12345&user=XXX&password=YYYY"
    stream_source: "rtsp://XXX:YYY@10.0.1.15:554/h264Preview_01_sub"
KennethEgholm commented 2 years ago

OK, sure I can try. After having tried a lot I got the reolink integration working after I set "external_url" and "internal_url" in the homeassistant configuration block inside configuration.yaml.

Then I found that the home assistant wasn't able to reach my cast entities - but that isn't related to this I guess. They work again now, after I commented the "internal_url" in the configuration.

So, in short, what I did was to add the "internal_url" to the configuration and leave the base_url setting in the http configuration..

MacL3an commented 2 years ago

Thank you @KennethEgholm, internal_url did the trick! 🎉

KennethEgholm commented 2 years ago

You are welcome. Glad it helped you.

leroyloren commented 2 years ago

For me, it is still the latest works version 0.22.

0.26 cannot be connected to either NVR or camera directly.

All the latest firmware, including the completed internal_url

It always ends that the webhook cannot be renew.

MacL3an commented 2 years ago

Yeah, seems I spoke to soon since I also have trouble with "unable to renew subscription". I was now able to add the camera and it detects things like person/vehicle detection, but has trouble connecting to these sensors.

The UI looks like this: image

And the logs say:

2021-10-11 14:37:07 DEBUG (MainThread) [reolink.camera_api] User hass has authorisation level admin
2021-10-11 14:37:07 DEBUG (MainThread) [custom_components.reolink_dev.base] Registering webhook for event ID reolink_dev-event-ec71db256bac
2021-10-11 14:37:07 DEBUG (MainThread) [reolink.subscription_manager] Host 10.0.1.15: Connection error Cannot connect to host 10.0.1.15:8000 ssl:default [Connect call failed ('10.0.1.15', 8000)]
2021-10-11 14:37:07 ERROR (MainThread) [custom_components.reolink_dev.base] Host 10.0.1.15 subscription failed to its webhook, base object state will to NotAvailable
2021-10-11 14:37:07 DEBUG (MainThread) [reolink.subscription_manager] Host 10.0.1.15: Connection error Cannot connect to host 10.0.1.15:8000 ssl:default [Connect call failed ('10.0.1.15', 8000)]
2021-10-11 14:37:07 DEBUG (MainThread) [reolink.subscription_manager] Host 10.0.1.15: Connection error Cannot connect to host 10.0.1.15:8000 ssl:default [Connect call failed ('10.0.1.15', 8000)]
2021-10-11 14:37:07 ERROR (MainThread) [custom_components.reolink_dev.base] Host 10.0.1.15 error renewing the Reolink subscription
2021-10-11 14:37:07 DEBUG (MainThread) [reolink.subscription_manager] Host 10.0.1.15: Connection error Cannot connect to host 10.0.1.15:8000 ssl:default [Connect call failed ('10.0.1.15', 8000)]
2021-10-11 14:37:07 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request params ={'token': 'c4c058d7ab7d6d8'}
2021-10-11 14:37:07 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request body =[{'cmd': 'GetFtp', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetEnc', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetEmail', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetIsp', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetIrLights', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetRec', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetPtzPreset', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetHddInfo', 'action': 1, 'param': {}}, {'cmd': 'GetAlarm', 'action': 1, 'param': {'Alarm': {'channel': 0, 'type': 'md'}}}, {'cmd': 'GetPushV20', 'action': 1, 'param': {'channel': 0}}]
2021-10-11 14:37:07 DEBUG (MainThread) [reolink.camera_api] send() HTTP Response status=200
2021-10-11 14:37:07 DEBUG (MainThread) [reolink.camera_api.data] send() HTTP Response data: [
{
"cmd" : "Unknown",
"code" : 1,
"error" : {
"detail" : "not support",
"rspCode" : -9
}
},
{
"cmd" : "GetEnc",
"code" : 0,
"initial" : {
"Enc" : {
"audio" : 0,
"channel" : 0,
"mainStream" : {
"bitRate" : 6144,
"frameRate" : 30,
"height" : 1920,
"profile" : "High",
"resolution" : 54,
"size" : "2560*1920",
"width" : 2560
},
"subStream" : {
"bitRate" : 256,
"frameRate" : 10,
"height" : 480,
"profile" : "High",
"size" : "640*480",
"width" : 640
}
}
},
"range" : {

[...]

2021-10-11 14:37:07 DEBUG (MainThread) [custom_components.reolink_dev] Finished fetching reolink data in 0.193 seconds (success: True)
2021-10-11 14:37:07 INFO (MainThread) [homeassistant.components.camera] Setting up camera.reolink_dev
2021-10-11 14:37:07 INFO (MainThread) [homeassistant.components.switch] Setting up switch.reolink_dev
2021-10-11 14:37:07 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.reolink_dev
2021-10-11 14:37:07 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.reolink_dev
2021-10-11 14:37:07 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new camera.reolink_dev entity: camera.camera1
2021-10-11 14:37:07 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.reolink_dev entity: switch.camera1_push_notifications
2021-10-11 14:37:07 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.reolink_dev entity: switch.camera1_ir_lights
2021-10-11 14:37:08 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.reolink_dev entity: switch.camera1_record_audio
2021-10-11 14:37:08 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.reolink_dev entity: binary_sensor.camera1_motion
2021-10-11 14:37:08 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.reolink_dev entity: binary_sensor.camera1_person_detected
2021-10-11 14:37:08 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.reolink_dev entity: binary_sensor.camera1_vehicle_detected
2021-10-11 14:37:08 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.reolink_dev entity: binary_sensor.camera1_pet_detected
2021-10-11 14:37:08 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.reolink_dev entity: sensor.camera1_last_event
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api] Sending command: Search to: 10.0.1.15 with body: [{'cmd': 'Search', 'action': 0, 'param': {'Search': {'channel': 0, 'onlyStatus': 1, 'streamType': 'main', 'StartTime': {'year': 2021, 'mon': 8, 'day': 1, 'hour': 0, 'min': 0, 'sec': 0}, 'EndTime': {'year': 2021, 'mon': 10, 'day': 11, 'hour': 14, 'min': 37, 'sec': 8}}}}]
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request params ={'cmd': 'Search', 'token': 'c4c058d7ab7d6d8'}
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request body =[{'cmd': 'Search', 'action': 0, 'param': {'Search': {'channel': 0, 'onlyStatus': 1, 'streamType': 'main', 'StartTime': {'year': 2021, 'mon': 8, 'day': 1, 'hour': 0, 'min': 0, 'sec': 0}, 'EndTime': {'year': 2021, 'mon': 10, 'day': 11, 'hour': 14, 'min': 37, 'sec': 8}}}}]
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api] send() HTTP Response status=200
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api.data] send() HTTP Response data: [
{
"cmd" : "Search",
"code" : 0,
"value" : {
"SearchResult" : {
"Status" : [
{
"mon" : 10,
"table" : "0000000111100000000000000000000",
"year" : 2021
}
],
"channel" : 0
}
}
}
]
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api] Response from 10.0.1.15: [{'cmd': 'Search', 'code': 0, 'value': {'SearchResult': {'Status': [{'mon': 10, 'table': '0000000111100000000000000000000', 'year': 2021}], 'channel': 0}}}]
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api] Sending command: Search to: 10.0.1.15 with body: [{'cmd': 'Search', 'action': 0, 'param': {'Search': {'channel': 0, 'onlyStatus': 0, 'streamType': 'main', 'StartTime': {'year': 2021, 'mon': 10, 'day': 11, 'hour': 0, 'min': 0, 'sec': 0}, 'EndTime': {'year': 2021, 'mon': 10, 'day': 11, 'hour': 23, 'min': 59, 'sec': 59}}}}]
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request params ={'cmd': 'Search', 'token': 'c4c058d7ab7d6d8'}
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request body =[{'cmd': 'Search', 'action': 0, 'param': {'Search': {'channel': 0, 'onlyStatus': 0, 'streamType': 'main', 'StartTime': {'year': 2021, 'mon': 10, 'day': 11, 'hour': 0, 'min': 0, 'sec': 0}, 'EndTime': {'year': 2021, 'mon': 10, 'day': 11, 'hour': 23, 'min': 59, 'sec': 59}}}}]
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api] send() HTTP Response status=200
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api.data] send() HTTP Response data scrapped because it's too large
2021-10-11 14:37:08 DEBUG (MainThread) [reolink.camera_api] Response from 10.0.1.15: [{'cmd': 'Search', 'code': 0, 'value': {'SearchResult': {'File': [{'EndTime': {'day': 11, 'hour': 0, 'min': 59, 'mon': 10, 'sec': 54, 'year': 2021}, 'PlaybackTime': {'day': 10, 'hour': 21, 'min': 59, 'mon': 10, 'sec': 54, 'year': 2021}, 'StartTime': {'day': 10, 'hour': 23, 'min': 59, 'mon': 10, 'sec': 54, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865758208', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 1, 'min': 0, 'mon': 10, 'sec': 0, 'year': 2021}, 'PlaybackTime': {'day': 10, 'hour': 22, 'min': 59, 'mon': 10, 'sec': 53, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 0, 'min': 59, 'mon': 10, 'sec': 53, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '5242880', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 1, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'PlaybackTime': {'day': 10, 'hour': 22, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 0, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865233920', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 2, 'min': 59, 'mon': 10, 'sec': 56, 'year': 2021}, 'PlaybackTime': {'day': 10, 'hour': 23, 'min': 59, 'mon': 10, 'sec': 56, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 1, 'min': 59, 'mon': 10, 'sec': 56, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865758208', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 3, 'min': 59, 'mon': 10, 'sec': 55, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 0, 'min': 59, 'mon': 10, 'sec': 55, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 2, 'min': 59, 'mon': 10, 'sec': 55, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865758208', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 4, 'min': 59, 'mon': 10, 'sec': 54, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 1, 'min': 59, 'mon': 10, 'sec': 54, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 3, 'min': 59, 'mon': 10, 'sec': 54, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865758208', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 5, 'min': 59, 'mon': 10, 'sec': 53, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 2, 'min': 59, 'mon': 10, 'sec': 53, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 4, 'min': 59, 'mon': 10, 'sec': 53, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865758208', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 6, 'min': 59, 'mon': 10, 'sec': 52, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 3, 'min': 59, 'mon': 10, 'sec': 52, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 5, 'min': 59, 'mon': 10, 'sec': 52, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865758208', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 7, 'min': 59, 'mon': 10, 'sec': 51, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 4, 'min': 59, 'mon': 10, 'sec': 51, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 6, 'min': 59, 'mon': 10, 'sec': 51, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865758208', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 8, 'min': 0, 'mon': 10, 'sec': 5, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 5, 'min': 59, 'mon': 10, 'sec': 50, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 7, 'min': 59, 'mon': 10, 'sec': 50, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '11534336', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 9, 'min': 0, 'mon': 10, 'sec': 0, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 6, 'min': 0, 'mon': 10, 'sec': 3, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 8, 'min': 0, 'mon': 10, 'sec': 3, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2863136768', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 9, 'min': 59, 'mon': 10, 'sec': 59, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 6, 'min': 59, 'mon': 10, 'sec': 59, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 8, 'min': 59, 'mon': 10, 'sec': 59, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865758208', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 10, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 7, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 9, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865758208', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 11, 'min': 7, 'mon': 10, 'sec': 49, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 8, 'min': 59, 'mon': 10, 'sec': 57, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 10, 'min': 59, 'mon': 10, 'sec': 57, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '375914496', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 12, 'min': 0, 'mon': 10, 'sec': 0, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 9, 'min': 7, 'mon': 10, 'sec': 48, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 11, 'min': 7, 'mon': 10, 'sec': 48, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2492989440', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 12, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 9, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 11, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865233920', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 13, 'min': 59, 'mon': 10, 'sec': 56, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 10, 'min': 59, 'mon': 10, 'sec': 56, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 12, 'min': 59, 'mon': 10, 'sec': 56, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '2865758208', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 14, 'min': 37, 'mon': 10, 'sec': 3, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 11, 'min': 59, 'mon': 10, 'sec': 55, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 13, 'min': 59, 'mon': 10, 'sec': 55, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '1773666304', 'type': 'main', 'width': 0}], 'Status': [{'mon': 10, 'table': '0000000111100000000000000000000', 'year': 2021}], 'channel': 0}}}]
2021-10-11 14:37:08 WARNING (MainThread) [custom_components.reolink_dev.sensor] Search command provided a file record without a name: {'EndTime': {'day': 11, 'hour': 14, 'min': 37, 'mon': 10, 'sec': 3, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 11, 'min': 59, 'mon': 10, 'sec': 55, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 13, 'min': 59, 'mon': 10, 'sec': 55, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '1773666304', 'type': 'main', 'width': 0}
2021-10-11 14:38:07 DEBUG (MainThread) [reolink.subscription_manager] Host 10.0.1.15: Connection error Cannot connect to host 10.0.1.15:8000 ssl:default [Connect call failed ('10.0.1.15', 8000)]
2021-10-11 14:38:07 DEBUG (MainThread) [reolink.subscription_manager] Host 10.0.1.15: Connection error Cannot connect to host 10.0.1.15:8000 ssl:default [Connect call failed ('10.0.1.15', 8000)]
2021-10-11 14:38:07 ERROR (MainThread) [custom_components.reolink_dev.base] Host 10.0.1.15 error renewing the Reolink subscription
2021-10-11 14:38:07 DEBUG (MainThread) [reolink.subscription_manager] Host 10.0.1.15: Connection error Cannot connect to host 10.0.1.15:8000 ssl:default [Connect call failed ('10.0.1.15', 8000)]
2021-10-11 14:38:07 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request params ={'token': 'c4c058d7ab7d6d8'}
2021-10-11 14:38:07 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request body =[{'cmd': 'GetFtp', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetEnc', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetEmail', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetIsp', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetIrLights', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetRec', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetPtzPreset', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetHddInfo', 'action': 1, 'param': {}}, {'cmd': 'GetAlarm', 'action': 1, 'param': {'Alarm': {'channel': 0, 'type': 'md'}}}, {'cmd': 'GetPushV20', 'action': 1, 'param': {'channel': 0}}]
2021-10-11 14:38:07 DEBUG (MainThread) [reolink.camera_api] send() HTTP Response status=200
MacL3an commented 2 years ago

I finally got my setup to work! Turned out ONVIF was disabled by default. Maybe you can find some helpful advice here @leroyloren.