Open garry0garry opened 2 years ago
Same issue here...rolling back to previous version for now.
Hi @garry0garry ,
With firmware 3.1.0-XXXX HTTP is disabled by default and will not work unless you re-enable it.
Please enable extra logging (https://github.com/fwestenberg/reolink_dev/blob/master/TSHOOT.md) and provide the big chunks of logs here.
Web IF of camera was also unavailable, so a reboot of my camera fixed it for me.
Web IF of camera was also unavailable, so a reboot of my camera fixed it for me.
I am having same issue since release of (beta) 3.1.XXX software, I do reboot my camera once a day
Please enable extra logging (https://github.com/fwestenberg/reolink_dev/blob/master/TSHOOT.md) and provide the big chunks of logs here.
home-assistant.zip See 192.168.50.140
`2022-01-25 18:45:42 DEBUG (MainThread) [reolink.camera_api] cam2/192.168.50.140::send() HTTP Request params ={'token': 'f35c69e4945a940'} 2022-01-25 18:45:42 DEBUG (MainThread) [reolink.camera_api] cam2/192.168.50.140::send() HTTP Request body =[{'cmd': 'GetMdState', 'action': 0, 'param': {'channel': 0}}, {'cmd': 'GetAiState', 'action': 0, 'param': {'channel': 0}}] 2022-01-25 18:45:42 DEBUG (MainThread) [reolink.camera_api] cam2/192.168.50.140::send() HTTP Response status=500 content-type=(text/html) 2022-01-25 18:45:42 DEBUG (MainThread) [reolink.camera_api.data] cam2/192.168.50.140::send() HTTP Response data:
2022-01-25 18:45:42 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API 2022-01-25 18:45:42 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Traceback (most recent call last): File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event await self._base.api.get_all_motion_states() File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 602, in get_all_motion_states json_data = json.loads(response) File "/usr/local/lib/python3.9/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) `
camera keeps crashing (this error message is repeated over and over): 2022-01-25 18:46:37 DEBUG (MainThread) [reolink.camera_api] cam2/192.168.50.140::send() HTTP Response status=500 content-type=(text/html)
Did you try to reboot it ?
Now disabled HTTPS and rebooted the camera. Did not help. I think an error exception should be made anyway.
fw v3.1.0.764_21121700 - now it's release
The following command should work and provide a token number , if not, open a ticket at Reolink:
curl -H 'Content-Type: application/json' -k -X POST "https://CAM_IP/cgi-bin/api.cgi?cmd=Login&token=" --data '[{"cmd": "Login", "action": 0, "param": {"User": {"userName": "admin", "password": "PASSWORD"}}}]'
HTTPS is working fine. I wrote about HTTP (without SSL).
1. HTTP - on HTTPS - on $ ... POST "http://192.168.50.140/cgi-bin ... - Ok $ ... POST "https://192.168.50.140/cgi-bin ... - Ok
HTTP - on HTTPS - off $ ... POST "http://192.168.50.140/cgi-bin ... - Ok $ ... POST "https://192.168.50.140/cgi-bin ... - 500 Internal Server Error
well you have mismatched USE_HTTPS and your port then ....
There is no option to specify http or https in the integration settings. There is no way to specify a port. In addition, there is a suspicion that you can do exception handling when the port is unavailable. If you think this is not an error, then I can close the ticket.
You need to enable HTTPS in your camera based on previous output you shared
+1 on this one. Also getting something similar like that in my logs.
2022-01-26 12:10:14 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Balkon Kamera.motion_states data
2022-01-26 12:11:14 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API
2022-01-26 12:11:14 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Traceback (most recent call last):
File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event
await self._base.api.get_all_motion_states()
File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 601, in get_all_motion_states
response = await self.send(body)
File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1685, in send
async with self._aiohttp_session.post(
File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 1138, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 535, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 542, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 907, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1081, in create_connection
transport, protocol = await self._create_connection_transport(
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1111, in _create_connection_transport
await waiter
asyncio.exceptions.CancelledError
@Wibias I don't see where the similarity is....
In order to exclude such questions from users, I suggest to create exception handling for connection timeout and HTTP 500. And automatically connect to HTTP. If HTTP is not available, connect to HTTPS.
The similarity I saw was both times its trying to query the motion state from the api and both time its File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event and after that get_all_motion_states. If there is no similarity I can also create a new Issue.
The similarity I saw was both times its trying to query the motion state from the api and both time its File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event and after that get_all_motion_states. If there is no similarity I can also create a new Issue.
yeah there is no similarity, please open a case
Reolink RLC-520A. Hardware IPC_523128M5MP, fw v3.1.0.764_21121700, fwestenberg/reolink_dev v0.47, HACS v1.19.3, HA v2021.12.10, RTSP and ONVIF options are enabled.
Strange situation. When I disabled HTTPS, leaving only HTTP, entries with errors immediately appeared in the log. Is this how it should be?
`2022-01-22 15:51:55 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API 2022-01-22 15:51:55 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Traceback (most recent call last): File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event await self._base.api.get_all_motion_states() File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 598, in get_all_motion_states json_data = json.loads(response) File "/usr/local/lib/python3.9/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2022-01-22 15:52:26 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API 2022-01-22 15:52:26 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Traceback (most recent call last): File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event await self._base.api.get_all_motion_states() File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 598, in get_all_motion_states json_data = json.loads(response) File "/usr/local/lib/python3.9/json/init.py", line 339, in loads raise TypeError(f'the JSON object must be str, bytes or bytearray, ' TypeError: the JSON object must be str, bytes or bytearray, not bool
2022-01-22 15:52:57 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API 2022-01-22 15:52:57 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Traceback (most recent call last): File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event await self._base.api.get_all_motion_states() File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 598, in get_all_motion_states json_data = json.loads(response) File "/usr/local/lib/python3.9/json/init.py", line 339, in loads raise TypeError(f'the JSON object must be str, bytes or bytearray, ' TypeError: the JSON object must be str, bytes or bytearray, not bool
2022-01-22 15:53:28 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API 2022-01-22 15:53:29 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Traceback (most recent call last): File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event await self._base.api.get_all_motion_states() File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 598, in get_all_motion_states json_data = json.loads(response) File "/usr/local/lib/python3.9/json/init.py", line 339, in loads raise TypeError(f'the JSON object must be str, bytes or bytearray, ' TypeError: the JSON object must be str, bytes or bytearray, not bool
2022-01-22 15:54:00 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API 2022-01-22 15:54:00 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Traceback (most recent call last): File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event await self._base.api.get_all_motion_states() File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 598, in get_all_motion_states json_data = json.loads(response) File "/usr/local/lib/python3.9/json/init.py", line 339, in loads raise TypeError(f'the JSON object must be str, bytes or bytearray, ' TypeError: the JSON object must be str, bytes or bytearray, not bool `