starkillerOG / reolink_aio

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

Support devices without HTTP API (such as Reolink Floodlight) #20

Open kevin-david opened 1 year ago

kevin-david commented 1 year ago

I know this would be a lot of work - but mostly wondering if you're open to a contribution if I find some time, and what approach would be acceptable.

As of today, this would require supporting the "Baichuan" protocol which is best understood by looking at this repo: https://github.com/QuantumEntangledAndy/neolink (and the one it's forked from) along with the blog post here: https://www.thirtythreeforty.net/posts/2020/05/hacking-reolink-cameras-for-fun-and-profit/

I took a stab at implementing this with the existing neolink tool here: https://github.com/QuantumEntangledAndy/neolink/pull/14. But it's still a bit of a mess.

More context and previous ideas I had here: https://github.com/fwestenberg/reolink_dev/issues/599#issuecomment-1345356470

starkillerOG commented 1 year ago

I will not have time myself to work on the "Baichuan" protocol.

A disadvantage will be that this is not a official API and that in the best case it can break when Reolink makes some changes or implements it diffrently in future models, and in worse case Reolink could actively try to protect their "Baichuan" protocol better by changing encryption keys or encryption protocols. We can also not ask Reolink to inform us about these things since this "Bauchuan" protocol is not ment to be used outside of Reolink, they have their HTTP API for that. So they will probably not be willing to help us with it.

That beeing sad, I am open to Pull Requests that would include the "Baichuan" protocol as a backup to the HTTP API. I do want to have it seperated as much as possible, so the 2 approaches that would be acceptable to me: 1) have a seperate reolink_baichuan pypi library (or use the neolink library if it is maintained) that exposes easy commands much like this reolink_aio library. This reolink_aio libary could have the reolink_baichuan library as a dependency and use it as backup for the HTTP API. 2) have a seperate baichuan folder inside reolink_ai folder of this library in which there is a baichuan.py file which has a class that exposes the baichuan protocol as simple commands (much like the "Host" class of this library). That class can then be used as backup in the Host class.

Possible use cases:

I will review PRs to this libary and try to help if you @kevin-david have the time to implement something like discribed above.

starkillerOG commented 1 year ago

I just saw that neolink is not written in python, which makes it much harder. It would need to be completly ported over to python...

xannor commented 1 year ago

tempting.... That was one of my goals with the prior code I was working on, to have a base reolink api and a baichuan and rest variants. However what I think may be a bit more practical, is an addon similar to what neolink does, that pushes events into HomeAssistant. This would work around some of the ONVIF shortcomings, and handle other client/device driven events that are not strictly motion, i.e. PTZ updates and light/storage statuses, etc. I might try to tackle that once I have the media playback in some form of stable state.

kylepyke commented 7 months ago

Is this still in the works?

starkillerOG commented 7 months ago

@kylepyke I don't think any current progress is beeing made. However Reolink just anounced a "Home Hub" at CES, that is a kind of NVR for battery powered cameras. It will provide battery powered camera's with the HTTP API through this "Home Hub" and schould therefore make battery powered camera's compatible with Home Assistant.

However it is still unknown when this "Home Hub" will be available for purchase, probably later than Q1 2024...