Please use https://github.com/starkillerOG/reolink_aio since this repository is no longet maintained.
fwestenberg / reolink Goto Github PK
View Code? Open in Web Editor NEWPython Reolink package
License: MIT License
Python Reolink package
License: MIT License
Please use https://github.com/starkillerOG/reolink_aio since this repository is no longet maintained.
Describe the bug
Looks like there is an unhandled exception, at a minimum.
More generally, the integration only displays a live feed for a few minutes for me, before the image goes away and I start getting error messages in the log.
To Reproduce
Manually installed HA integration from the files in the HA pull request.
I'm using 5 GHz wifi to the 511W, so there might be small periods of times where it drops out, although I ran with vlc last night for quite a while and it seemed perfectly fine before adding the reolink integration.
configuration.yaml config for this:
reolink:
stream:
Expected behavior
No tracebacks generated
Environment:
Please provide useful information about your environment, like:
Additional context
Looking a the traceback closer, I'm not sure if the proper way to handle this is to filter out exceptional values so that the stream component doesn't see them, or if it's actually a problem with the stream component (in which case, if you can figure out how to fix it, I'm sure core would appreciate a PR).
2020-12-06 13:24:42 ERROR (MainThread) [reolink.camera_api] Error translating Reolink settings response
2020-12-06 13:24:52 ERROR (MainThread) [reolink.camera_api] Error translating login response to json
2020-12-06 13:24:52 ERROR (MainThread) [reolink.camera_api] Error translating Reolink state response
2020-12-06 13:26:00 ERROR (stream_worker) [homeassistant.components.stream.worker] Error demuxing stream: [Errno 5] I/O error: 'rtmp://192.168.2.20:1935/bcs/channel0_main.bcs?channel=0&stream=0&token=<some_string_was_here>'
2020-12-06 13:26:00 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/stream/core.py", line 187, in get
return await self.handle(request, stream, sequence)
File "/usr/src/homeassistant/homeassistant/components/stream/hls.py", line 57, in handle
return web.Response(body=self.render(track).encode("utf-8"), headers=headers)
File "/usr/src/homeassistant/homeassistant/components/stream/hls.py", line 37, in render
segment = track.get_segment(track.segments[-1])
IndexError: list index out of range
2020-12-06 13:26:02 ERROR (MainThread) [reolink.camera_api] Error translating Reolink settings response
2020-12-06 13:26:12 ERROR (MainThread) [reolink.camera_api] Error translating login response to json
2020-12-06 13:26:12 ERROR (MainThread) [reolink.camera_api] Error translating Reolink state response
2020-12-06 13:26:56 ERROR (stream_worker) [homeassistant.components.stream.worker] Error demuxing stream: [Errno 1414092869] Immediate exit requested: 'rtmp://192.168.2.20:1935/bcs/channel0_main.bcs?channel=0&stream=0&token=<some-string-was-here>'
2020-12-06 13:27:22 ERROR (MainThread) [reolink.camera_api] Error translating login response to json
2020-12-06 13:27:22 ERROR (MainThread) [reolink.camera_api] Error translating Reolink settings response
2020-12-06 13:27:32 ERROR (MainThread) [reolink.camera_api] Error translating login response to json
Tested Versions 009, 008, 007 and MAIN
HACS Version: 1.6.2
HA Version: 0.117.6
Error message:
Logger: custom_components.hacs.repository.integration.fwestenberg.reolink
Source: custom_components/hacs/repositories/integration.py:88
Integration: HACS (documentation, issues)
First occurred: 4:20:12 PM (2 occurrences)
Last logged: 4:20:13 PM
No file found 'custom_components/None/manifest.json'
I was running version 007, upon update the integration was deleted and my configuration got invalid due to the absence of the reolink_dev platform.
copy to \config:
.github/ISSUE_TEMPLATE
reolink
license
README.md
setup.cfg
setup.py
test.py
api = camera_api.Api('192.168.1.10', 80, 'user', 'mypassword')
get settings, like ports etc.:
await api.get_settings()
Store the subscribe ##port
subscribe_port = api.onvif_port
get the states:
await api.get_states()
print some state value:
print(api.ir_state)
enable the infrared lights:
await api.set_ir_lights(True)
logout
await api.logout()
Now subscribe to events, suppose our webhook url is http://192.168.1.11/webhook123
sman = subscription_manager.Manager('192.168.1.10', subscribePort, ' user', 'mypassword')
await sman.subscribe('http://192.168.1.11/webhook123')
After some minutes check the renew timer (keep the eventing alive):
if (sman.renewTimer <= 100):
await sman.renew()
Unsubscribe
await sman.unsubscribe()
Describe the bug
As I continue trying different things to get a reliable live-feed, I ran into a different traceback.
More generally, the integration only displays a live feed for a few minutes for me, before the image goes away and I start getting error messages in the log.
To Reproduce
Manually installed HA integration from the files in the HA pull request.
Changed from stream: to ffmpeg: and then restarted HA. Immediately (during bootup) got the following trace.
But it doesn't happen every time. I just rebooted and I got a stream fine, although my doorbell stream was offline. I let it run for 5 minutes this way, then I refreshed the browser. The doorbell stream came up, but after the browser refresh, the reolink component didn't display a stream and spit the following out to the log:
2020-12-06 15:11:07 ERROR (MainThread) [reolink.camera_api] Error translating Reolink settings response
2020-12-06 15:11:17 ERROR (MainThread) [reolink.camera_api] Error translating login response to json
2020-12-06 15:11:17 ERROR (MainThread) [reolink.camera_api] Error translating Reolink state response
2020-12-06 15:11:27 ERROR (MainThread) [reolink.camera_api] Error translating login response to json
2020-12-06 15:11:27 ERROR (MainThread) [homeassistant.components.camera] Error requesting stream: camera.driveway does not support play stream service
I'm using 5 GHz wifi to the 511W, so there might be small periods of times where it drops out, although I ran with vlc last night for quite a while and it seemed perfectly fine before adding the reolink integration.
configuration.yaml config for this:
reolink:
ffmpeg:
Expected behavior
No tracebacks generated
Environment:
Please provide useful information about your environment, like:
Additional context
2020-12-06 13:41:48 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Driveway for reolink
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/reolink/__init__.py", line 72, in async_setup_entry
await base.subscribe(webhook_url)
File "/config/custom_components/reolink/base.py", line 76, in subscribe
if not await self._sman.subscribe(self._webhook_url):
File "/usr/local/lib/python3.8/site-packages/reolink/subscription_manager.py", line 126, in subscribe
response = await self.send(headers, xml)
File "/usr/local/lib/python3.8/site-packages/reolink/subscription_manager.py", line 83, in send
async with session.post(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 1124, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 551, in _request
await resp.start(conn)
File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 907, in start
self._continue = None
File "/usr/local/lib/python3.8/site-packages/aiohttp/helpers.py", line 656, in __exit__
raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
I have below error in the log. Hacs installed, Integration installed, everything looks okay but no camera entities.
(2021-01-10 21:38:10 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Tuin for reolink_dev Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/reolink_dev/init.py", line 70, in async_setup_entry webhook_id = await register_webhook(hass, base.event_id)
File "/config/custom_components/reolink_dev/init.py", line 155, in register_webhook handlers = hass.data["webhook"]).
Any idea or suggestion? Removed and reinstalled Hacs and Integrations but without succes.
#38 causes issues on NVR's . It reboots them when trying {"cmd": "GetPush", "action": 1, "param": {"channel": self._channel}}. This is related to the open issues #276 #258 on https://github.com/fwestenberg/reolink_dev.
I would like to thank you for your efforts. I’m doing the first steps in Python and your package was the reason for that.
May I please ask for a basic example, of how to ie turn on Siren or read a status. It would be help me understand the logic. Ansyn code is a bit complicated topic for me. I tried to see code example at the sister library reolink_dev, but I couldn’t figure out anything. Many thanks
Hi,
I also run Blink cameras, but whenever I install the reolink custom integration I get the following error (TypeError: unhashable type: 'list') .... wondering if this is something that can be ironed out between the two integrations? Thanks
Blink's integration
def enable_motion_detection(self):
"""Enable motion detection for the camera."""
self._camera.set_motion_detect(True)
Reolink Integration
# Event enable motion detection
def handler_enable_motion_detection(call):
component = hass.data.get(DOMAIN)
entity = component.get_entity(call.data.get(ATTR_ENTITY_ID))
if entity:
entity.enable_motion_detection()
hass.services.async_register(DOMAIN, SERVICE_ENABLE_MOTION_DETECTION, handler_enable_motion_detection)
Error log :
2020-11-26 20:39:43 INFO (MainThread) [homeassistant.components.automation.cameras_on] Cameras On: Executing step call service 2020-11-26 20:39:43 ERROR (MainThread) [homeassistant.components.automation.cameras_on] Cameras On: Error executing script. Unexpected error for call_service at pos 1: unhashable type: 'list' Traceback (most recent call last): File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 253, in _async_step await getattr( File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 460, in _async_call_service_step await service_task File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/core.py", line 1451, in async_call task.result() File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/core.py", line 1490, in _execute_service await self._hass.async_add_executor_job(handler.job.target, service_call) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/homeassistant/homeassistant/custom_components/reolink_dev/camera.py", line 149, in handler_enable_motion_detection entity = component.get_entity(call.data.get(ATTR_ENTITY_ID)) File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_component.py", line 99, in get_entity entity_obj = platform.entities.get(entity_id) TypeError: unhashable type: 'list' 2020-11-26 20:39:43 ERROR (MainThread) [homeassistant.components.automation.cameras_on] While executing automation automation.cameras_on Traceback (most recent call last): File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/automation/__init__.py", line 433, in async_trigger await self.action_script.async_run( File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 1010, in async_run await asyncio.shield(run.async_run()) File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 245, in async_run await self._async_step(log_exceptions=False) File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 253, in _async_step await getattr( File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 460, in _async_call_service_step await service_task File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/core.py", line 1451, in async_call task.result() File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/core.py", line 1490, in _execute_service await self._hass.async_add_executor_job(handler.job.target, service_call) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/homeassistant/homeassistant/custom_components/reolink_dev/camera.py", line 149, in handler_enable_motion_detection entity = component.get_entity(call.data.get(ATTR_ENTITY_ID)) File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_component.py", line 99, in get_entity entity_obj = platform.entities.get(entity_id) TypeError: unhashable type: 'list'
@fwestenberg since this library is far behind the reolink_aio library, would it maybe be a good idea the archive this repository and put a link to reolink_aio in the readme?
Thank you once more for the amazing work you did and the ground-work you lay for the reolink_aio library!
I've noticed that there might be a problem in API calls for enabling email. For my camera (RLC-510 WA) with firmware v3.1.0.764_21121712 email switch has disappeared from Home Assistant integration fwestenberg/reolink_dev#560 and I also have noticed that this API call
http://[CAMERA_IP]/api.cgi?cmd=getEmail&user=[USER]&password=[PASSWORD]
is not working and this one does
http://[CAMERA_IP]/api.cgi?cmd=getEmailV20&user=[USER]&password=[PASSWORD]
So in my opinion and according to this Relonk API guide:
https://drive.google.com/drive/folders/19vQBJia0wKvzwscA-EpTDSFV5OfNYUL6
for my camera command SetEmailV20 should be used. Is it a bug ? Seems like You are using V20 calls for ftp and some other stuff...
I found a bug in my vod_search code, that I did not plan for. If the search returns no results, the camera does not respond with a Files entry (I though it would return an empty array) I will submit a PR to fix this, though it shouldn't be an issue untill you release my fixes/updates to the integration for playback refresh.
Describe the bug
Tried to change the integration from rtmp to rtsp to see if it helps with the stream errors / timeouts I'm getting. But the integration never seems to change
To Reproduce
After adding integration, go to the integration options and attempt to change to rtsp. It doesn't seem to apply.
Expected behavior
When selectiong rtsp and clicking "submit", integration remembers that I selected rtsp.
Environment:
Additional context
Log seems to indicate still using rtmp:
2020-12-11 10:01:10 ERROR (stream_worker) [homeassistant.components.stream.worker] Error opening stream rtmp://192.168.2.20:1935/bcs/channel0_main.bcs?channel=0&stream=0&token=<token_string>
I tried to add repository through HACS but had 'Repostitory structure for v0014 is not compliant' error. I am using HA version 2020.12.7; HA OS version 5.9. Could not find any info in logs.
Describe the bug
Starting with 0.56 I see some test failures:
============================= test session starts ==============================
platform linux -- Python 3.9.6, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /build/source
collected 9 items / 6 deselected / 3 selected
test.py FFF [100%]
=================================== FAILURES ===================================
__________________________ TestLogin.test_wrong_host ___________________________
self = <test.TestLogin testMethod=test_wrong_host>
def test_wrong_host(self):
api = Api(
host="192.168.1.0",
port=self._port,
username=self._user,
password=self._password,
)
> assert not self._loop.run_until_complete(api.login())
test.py:67:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/lib/python3.9/asyncio/base_events.py:642: in run_until_complete
return future.result()
reolink/camera_api.py:828: in login
response = await self.send(body, param)
reolink/camera_api.py:1610: in send
async with self._aiohttp_session.post(
/nix/store/dshms9cp7bwdgadfjdb61635nsl3sl77-python3.9-aiohttp-3.8.0/lib/python3.9/site-packages/aiohttp/client.py:1140: in __aenter__
self._resp = await self._coro
/nix/store/dshms9cp7bwdgadfjdb61635nsl3sl77-python3.9-aiohttp-3.8.0/lib/python3.9/site-packages/aiohttp/client.py:466: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7ffff5ad06d0>
def __enter__(self) -> BaseTimerContext:
task = current_task(loop=self._loop)
if task is None:
> raise RuntimeError(
"Timeout context manager should be used " "inside a task"
)
E RuntimeError: Timeout context manager should be used inside a task
/nix/store/dshms9cp7bwdgadfjdb61635nsl3sl77-python3.9-aiohttp-3.8.0/lib/python3.9/site-packages/aiohttp/helpers.py:698: RuntimeError
________________________ TestLogin.test_wrong_password _________________________
self = <test.TestLogin testMethod=test_wrong_password>
def test_wrong_password(self):
api = Api(
host=self._host, port=self._port, username=self._user, password="wrongpass"
)
> assert not self._loop.run_until_complete(api.login())
test.py:42:
[...]
I haven't check if this is related to aiohttp >= 3.8.
To Reproduce
Run tests
Expected behavior
That the tests pass.
Screenshots
n/a
Environment:
n/a
Additional context
n/a
install with hacs fails
since 0.02...?
Describe the bug
The current version is 0.0.53. The GitHub release is 0053 while named v0.53
.
Please tag the releases on GitHub with the exact version number. Otherwise it causes trouble for the distributions which are shipping this module as package.
Thanks
To Reproduce
n/a
Expected behavior
n/a
Screenshots
n/a
Environment:
Please provide useful information about your environment, like:
Additional context
n/a
Hi, streaming from RLC-810A is not supported, as the main stream url on this device is:
rtsp://admin:[email protected]:554//h265Preview_01_main
Hi , Could you please post some basic examples for beginners, Looking for push notification example.
Many Thanks
After upgrading home assistant to version 2021.9.0, the following error appear as per new changes in latest home assistant release
Logger: homeassistant.components.camera
Source: components/camera/init.py:465
Integration: Camera (documentation, issues)
First occurred: September 1, 2021, 11:49:15 PM (1 occurrences)
Last logged: September 1, 2021, 11:49:15 PM
The camera entity camera.box does not support requesting width and height, please open an issue with the integration author
Describe the bug
It seems to be that using the latest version (v0015) in HACS is not working. When downloading the the custom repositories in HACS with following URL (https://github.com/fwestenberg/reolink) gives the error Repostitory structure for v0015 is not compliant
To Reproduce
Add the newest implementation using the custom repositories in HACS
Expected behavior
The reolink repositories to download
Screenshots
If applicable, add screenshots to help explain your problem.
Environment:
Please provide useful information about your environment, like:
Additional context
Add any other context about the problem here.
Hello First of all thank you for your work and support
I'm facing a issue when I try to add the NVR over the reolink integration available on the HA Home Assistant as you can view in the picture bellow
The NVR model is the RLN16-410 and the addon version is the last one v0.13
Can you please help in order to solve this issue ?
Thank you and best regards
Hi,
When i try to add an RLC-820a i get the message that the camera is added succesfully, but after that the integration shows up with the message: setup failed, check the logging.
In the logging the following message shows:
Error setting up entry Camera1 for reolink_dev
Traceback (most recent call last):
File "/config/custom_components/reolink_dev/init.py", line 78, in async_setup_entry
push = hass.data[DOMAIN][base.push_manager]
KeyError: 'push_manager-ec71db3575c9'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/reolink_dev/init.py", line 87, in async_setup_entry
await push.subscribe(base.event_id)
File "/config/custom_components/reolink_dev/base.py", line 318, in subscribe
get_url(self._hass, prefer_external=False),
File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 116, in get_url
raise NoURLAvailableError
homeassistant.helpers.network.NoURLAvailableError
Does someone has an idea how to fix this problem?
I have a failure with the RTSP, since in the configuration.yaml I put the ip and http port, when the rtsp opens I get the ip with the http port, because I have it written in the configuration.yaml
Is there a way to add the HTTP port without RTSP detecting it?
configuration.yaml
platform: reolink_dev
host: IP_ADDRESS_:PORT_HTTP
username: USERNAME_ADMIN
password: YOUR_PASSWORD
name: Reolink Camera
stream: main
protocol: rtsp
channel: 0
scan_interval: 5
Stream connection failed: rtsp://USERNAME_ADMIN:YOUR_PASSWORD@IP_ADDRESS_:PORT_HTTP:PORT_RTSP/h264Preview_01_main
I'm wondering if anyone could implement spotlight support in this library? I have found this documentation here that might be of help https://home-cdn.reolink.us/wp-content/uploads/2021/05/070123211620350601.5874.docx
It references SetWhiteLed command, which is what my cameras web interface is sending when trying to configure the backlight. I have no experience with python but there is reolink_dev home assistant integration that I would like to attempt to integrate this feature in
I am an official technical staff member of reolink. I learned that you have made outstanding contributions in supporting the home assistant project in reolink. We would like to give you a sponsorship fund. You can open a personal sponsorship link on github.
How can i install the Api on a RaspberryPi? Please Show me the correct way.
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.