Closed MacL3an closed 3 years ago
I upgraded from v22 (which did work, although motion sensors do not update reliably) to v26, and I'm getting this message
Logger: custom_components.reolink_dev.base Source: custom_components/reolink_dev/base.py:360 Integration: Reolink IP camera (documentation, issues) First occurred: 8:21:10 AM (630 occurrences) Last logged: 5:49:14 PM
Host 10.0.0.195 error renewing the Reolink subscription
Thanks @MacL3an. There's a reply from @johannbrink in this thread which shows how to get the sensors working via the rest integration (edit configuration.yaml)
binary_sensor:
- platform: rest
resource: http://[NVR IP]/api.cgi?cmd=GetMdState&channel=0&user=[user]&password=[password]
name: driveway_motion
device_class: motion
value_template: "{{ value_json[0].value.state }}"
scan_interval: 2
- platform: rest
resource: http://[NVR IP]/api.cgi?cmd=GetAiState&channel=1&user=[user]&password=[password]
name: driveway_is_people
device_class: motion
value_template: "{{ value_json[0].value.people.alarm_state }}"
scan_interval: 2
- platform: rest
resource: http://[NVR IP]/api.cgi?cmd=GetAiState&channel=1&user=[user]&password=[password]
name: driveway_is_vehicle
device_class: motion
value_template: "{{ value_json[0].value.vehicle.alarm_state }}"
scan_interval: 2
I tried it on my NVR, which uses the latest 130 firmware, and it works really well! Would be great if the integration could do the same.
@markaggar, fantastic it worked! thanks! When this integration works, does it give any more functionality or does it just automate this setup?
Then a question from a HASS beginner: How do I create an automation when a motion is triggered? I assume I use the State
trigger, but how do I figure out what to write in From
and To
? I've looked in the history for the entity, but then I only se "human friendly" names which I assume do not work and I don't see anything in the Supervisor logs, but I'm probably looking in the wrong place.
@MacL3an You can literally write "on" (without the quotes) in the to: field. Has to be lower case. The integration (when it works) does let you control various states such as IR mode, push notifications and recording. For me I'm mostly concerned about motion though. I now have smart motion detectors all around the house!
I just figured it out myself by setting the logging level at DEBUG
and then going to Configuration/Logs and I found this:
2021-10-09 22:30:28 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [547809385104] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "binary_sensor.cam01_is_people", "old_state": {"entity_id": "binary_sensor.cam01_is_people", "state": "on", "attributes": {"friendly_name": "cam01_is_people", "device_class": "motion"}, "last_changed": "2021-10-09T20:30:20.024422+00:00", "last_updated": "2021-10-09T20:30:20.024422+00:00", "context": {"id": "de7e4874482a98f98f417c96830a86b5", "parent_id": null, "user_id": null}}, "new_state": {"entity_id": "binary_sensor.cam01_is_people", "state": "off", "attributes": {"friendly_name": "cam01_is_people", "device_class": "motion"}, "last_changed": "2021-10-09T20:30:28.018783+00:00", "last_updated": "2021-10-09T20:30:28.018783+00:00", "context": {"id": "1f111743ad739788b3ab5b20f63db2e7", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-10-09T20:30:28.018783+00:00", "context": {"id": "1f111743ad739788b3ab5b20f63db2e7", "parent_id": null, "user_id": null}}}
But thanks for taking the time to write. Since it is a 'binary' sensor I guess on/off makes sense :).
States such as IR mode and push can be controlled via the reolink app, so I guess I'm not loosing any functionality then. Thanks again for your help!
You can also go to the developer tools section and see what the current state is for entities.
@MacL3an Can you please enable debug logs and provide them back?
logger:
logs:
custom_components.reolink_dev: debug
custom_components.reolink_dev.base.data: warning
reolink: debug
btw @MacL3an what did you input the boxes? It feels like you didnt "http://HOST" instead of just "HOST"
@MacL3an Can you please enable debug logs and provide them back?
logger: logs: custom_components.reolink_dev: debug custom_components.reolink_dev.base.data: warning reolink: debug
When I used the url http://10.0.1.15/
, then I got the same as in my original post:
2021-10-11 13:38:21 DEBUG (MainThread) [reolink.camera_api] Reolink camera with host http://10.0.1.15/:80 trying to login with user hass
2021-10-11 13:38:26 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-11 13:38:26 DEBUG (MainThread) [reolink.camera_api] Host http://10.0.1.15/: Error translating Reolink settings response
When I try only 10.0.1.15/
I actually get something more useful, so I assume that is the correct path:
2021-10-11 13:39:01 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request params ={'cmd': 'Login', 'token': 'null'}
2021-10-11 13:39:01 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request body =[{'cmd': 'Login', 'action': 0, 'param': {'User': {'userName': 'hass', 'password': '<password>'}}}]
2021-10-11 13:39:01 DEBUG (MainThread) [reolink.camera_api] send() HTTP Response status=200
2021-10-11 13:39:01 DEBUG (MainThread) [reolink.camera_api.data] send() HTTP Response data: [
{
"cmd" : "Login",
"code" : 0,
"value" : {
"Token" : {
"leaseTime" : 3600,
"name" : "9fcc3a215c49e65"
}
}
}
]
2021-10-11 13:39:01 DEBUG (MainThread) [reolink.camera_api] Get response from 10.0.1.15: [{'cmd': 'Login', 'code': 0, 'value': {'Token': {'leaseTime': 3600, 'name': '9fcc3a215c49e65'}}}]
2021-10-11 13:39:01 DEBUG (MainThread) [reolink.camera_api] Reolink camera logged in at IP 10.0.1.15. Leasetime 11-10-2021 14:39, token 9fcc3a215c49e65
2021-10-11 13:39:01 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request params ={'token': '9fcc3a215c49e65'}
2021-10-11 13:39:01 DEBUG (MainThread) [reolink.camera_api] send() HTTP Request body =[{'cmd': 'GetDevInfo', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetLocalLink', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetNetPort', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetUser', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetOsd', 'action': 1, 'param': {'channel': 0}}, {'cmd': 'GetAbility', 'action': 1, 'param': {'User': {'userName': 'hass'}}}]
2021-10-11 13:39:01 DEBUG (MainThread) [reolink.camera_api] send() HTTP Response status=200
2021-10-11 13:39:01 DEBUG (MainThread) [reolink.camera_api.data] send() HTTP Response data: SdmRpZYy6KCNGVcvB8p0j+VmFHbUTzd8rQB2JoayM7OZkV0vF35ks3Yrhvsdt2unimteXn1zy/4GGvI6Vj+8IIs7SMV7P1J8Jq89vP+AjRsD9L7d69uoJdIi7E3AiTXBCEMQMqW5WB8MIdEppXJZQrDpCbhte9fwgxC3Yxpvrs3Bp3+<redacted>
2021-10-11 13:39:01 DEBUG (MainThread) [reolink.camera_api] Host 10.0.1.15: Error translating Reolink settings response
I got it to work! I followed the suggestion I got here and setup the internal_url
field. Perhaps something to add to the docs. Would it help with a PR with that documentation update?
Yeah, seems I spoke to soon as I now 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:
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
I am having a similar problem except that it seems like I can see the sensors, but not the camera stream. I get an error opening the stream but I can see the thumbnail image of the camera feed in lovelace.
My logs have this:
2021-10-11 09:37:33 DEBUG (MainThread) [reolink.camera_api] Sending command: Search to: 10.0.0.40 with body: [{'cmd': 'Search', 'action': 0, 'param': {'Search': {'channel': 1, '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': 9, 'min': 37, 'sec': 33}}}}]
2021-10-11 09:37:33 DEBUG (MainThread) [reolink.camera_api] Response from 10.0.0.40: [{'cmd': 'Search', 'code': 0, 'value': {'SearchResult': {'Status': [{'mon': 10, 'table': '0000111111100000000000000000000', 'year': 2021}], 'channel': 1}}}]
2021-10-11 09:37:33 DEBUG (MainThread) [reolink.camera_api] Sending command: Search to: 10.0.0.40 with body: [{'cmd': 'Search', 'action': 0, 'param': {'Search': {'channel': 1, '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 09:37:33 DEBUG (MainThread) [reolink.camera_api] Response from 10.0.0.40: [{'cmd': 'Search', 'code': 0, 'value': {'SearchResult': {'File': [{'EndTime': {'day': 11, 'hour': 0, 'min': 0, 'mon': 10, 'sec': 1, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 4, 'min': 54, 'mon': 10, 'sec': 34, 'year': 2021}, 'StartTime': {'day': 10, 'hour': 23, 'min': 54, 'mon': 10, 'sec': 34, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '84934656', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 1, 'min': 0, 'mon': 10, 'sec': 0, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 4, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'StartTime': {'day': 10, 'hour': 23, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '934805504', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 1, 'min': 59, 'mon': 10, 'sec': 54, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 5, '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': '934805504', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 2, 'min': 59, 'mon': 10, 'sec': 49, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 6, 'min': 59, 'mon': 10, 'sec': 48, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 1, 'min': 59, 'mon': 10, 'sec': 48, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '934805504', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 3, 'min': 0, 'mon': 10, 'sec': 2, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 7, 'min': 59, 'mon': 10, 'sec': 42, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 2, 'min': 59, 'mon': 10, 'sec': 42, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '5242880', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 3, 'min': 49, 'mon': 10, 'sec': 19, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 7, 'min': 59, 'mon': 10, 'sec': 59, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 2, 'min': 59, 'mon': 10, 'sec': 59, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '769654784', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 4, 'min': 0, 'mon': 10, 'sec': 0, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 8, 'min': 49, 'mon': 10, 'sec': 19, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 3, 'min': 49, 'mon': 10, 'sec': 19, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '166723584', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 4, 'min': 59, 'mon': 10, 'sec': 58, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 8, 'min': 59, 'mon': 10, 'sec': 57, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 3, 'min': 59, 'mon': 10, 'sec': 57, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '934805504', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 5, 'min': 59, 'mon': 10, 'sec': 56, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 9, 'min': 59, 'mon': 10, 'sec': 55, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 4, 'min': 59, 'mon': 10, 'sec': 55, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '935329792', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 6, 'min': 59, 'mon': 10, 'sec': 54, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 10, 'min': 59, 'mon': 10, 'sec': 53, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 5, 'min': 59, 'mon': 10, 'sec': 53, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '934805504', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 7, 'min': 44, 'mon': 10, 'sec': 7, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 11, 'min': 59, 'mon': 10, 'sec': 48, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 6, 'min': 59, 'mon': 10, 'sec': 48, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '691011584', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 8, 'min': 0, 'mon': 10, 'sec': 3, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 12, 'min': 44, 'mon': 10, 'sec': 4, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 7, 'min': 44, 'mon': 10, 'sec': 4, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '249036800', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 9, 'min': 0, 'mon': 10, 'sec': 1, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 12, 'min': 59, 'mon': 10, 'sec': 59, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 7, 'min': 59, 'mon': 10, 'sec': 59, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '934805504', 'type': 'main', 'width': 0}, {'EndTime': {'day': 11, 'hour': 9, 'min': 35, 'mon': 10, 'sec': 35, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 13, 'min': 59, 'mon': 10, 'sec': 54, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 8, 'min': 59, 'mon': 10, 'sec': 54, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '556793856', 'type': 'main', 'width': 0}], 'Status': [{'mon': 10, 'table': '0000111111100000000000000000000', 'year': 2021}], 'channel': 1}}}]
2021-10-11 09:37:33 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/reolink_dev/sensor.py", line 134, in _update_event_range
file["name"],
KeyError: 'name'
and then when I try to stream:
2021-10-11 09:38:33 DEBUG (MainThread) [reolink.subscription_manager] Host 10.0.0.40 should renew in: 839 seconds...
2021-10-11 09:38:33 DEBUG (MainThread) [custom_components.reolink_dev] Finished fetching reolink data in 0.169 seconds (success: True)
2021-10-11 09:38:49 ERROR (stream_worker) [homeassistant.components.stream.worker] Error opening stream rtmp://10.0.0.40:1935/bcs/channel1_main.bcs?channel=1&stream=0&user=admin&password=<mypassword>
2021-10-11 09:38:50 ERROR (stream_worker) [homeassistant.components.stream.worker] Error opening stream rtmp://10.0.0.40:1935/bcs/channel1_main.bcs?channel=1&stream=0&user=admin&password=<mypassword>
2021-10-11 09:39:33 DEBUG (MainThread) [reolink.subscription_manager] Host 10.0.0.40 should renew in: 779 seconds...
2021-10-11 09:39:33 DEBUG (MainThread) [custom_components.reolink_dev] Finished fetching reolink data in 0.228 seconds (success: True)
@MacL3an it clearly states it cannot connect to 10.0.1.15 on port 8000 at the time, did you check that port was open on your camera around the same time (this is used by ONVIF protocol)
All I know is that in the reolink app the port for ONVIF is set to 8000 (the default) in the NVR:
I'm not sure if there is any other setting I can play around with or something else I can investigate? I should not need to do any port forwarding/opening on my router, right?
you should try an external RTMP client to check it is working, or use netcat/telnet to check that you are getting a TCP connect
On the NVR, make sure ONVIF is turned on.
I feel like an idiot here, but I cannot find this setting in the Mac or iOS Reolink app. I can set the port, but not enable ONVIF. The only relevant screen is the one I showed above where I can enable UPNP (which I have not enabled).
As I wrote in the first post, I have managed to connect HASS to the camera via rtsp via the following config, which works ok:
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"
or polling for motion via standard http:
binary_sensor:
- platform: rest
resource: http://[NVR IP]/api.cgi?cmd=GetMdState&channel=0&user=[user]&password=[password]
name: driveway_motion
device_class: motion
value_template: "{{ value_json[0].value.state }}"
Onvif and Rtsp are 2 different service. Onvif seems to be disabled on yours
@MacL3an - the screen shot I provided is from the monitor that is plugged into the NVR. I can't find this option in the PC or Android app, just the NVR.
I also did this same thing yesterday, I made the changes to the NVR to enable Onvif Protocol, then restarted the NVR
Then in HA I already had the cameras added from a previous version v22. I had to remove them all after installing v26, then added each channel using my NVR ip address back in. If I didn't remove them and add them back in the upgrade also didn't work properly, all the motion just showed unavailable.
Once I did that the separate motion sensors appeared as devices and are now working
I finally got it working!
I e-mailed Reolink and asked about enabling ONVIF and they told me you can only do it via a screen connected directly to the NVR and also "don't worry if you don't have a monitor, Onvif is enabled by default". However, since I could not connect another ONVIF app to the camera (Security Spy) I went through the hassle of connecting a monitor and there it, of course, turned out that ONVIF was in fact disabled. By the removing the camera and adding it again everything worked like a charm.
Thanks again for all the friendly support. Would you guys appreciate a PR where I update the docs to mention things that make sure ONVIF is enabled (not enabled by default and needs a monitor) and that the internal_url
field needs to be set @cpainchaud?
Describe the bug I cannot connect to my Reolink NVR.
To Reproduce I have installed version 2.6 using HACS. I go Configuration, Integration, Add Integration, Find
Reolink IP Camera
and fill in the IP address of the NVR and use port 80. I get the errorFailed to connect with the camera
. The error logs say:Screenshots
Environment: Please provide useful information about your environment, like:
Additional context If I connect directly to the camera via HASS config it works: