New Xiaomi aqara camera/gateway

Great work! Everything works flawlessly. Been waiting for something like this.

I have the stream added to zoneminder as well which makes the whole thing even better as you can use the recording and events functionality of zoneminder in HA

wow, I’ll try to test tonight also!

EDIT:
can I use it on the same RPi3 as my hass.io installation?
dependency packages list looks quite big, I’m thinking if it won’t slow down my hassio-device or something… also don’t want to mess my installation so my home won’t go into dumb mode again ;D

1 Like

Thanks for the videoP2Proxy. I’ve got it setup and I can stream the rtsp feed with VLC. However, I’m trying to connect it to XProtect (new software to me), but I can’t figure out how to get it to connect to the rtsp. Anyone out there know how and could point in in the right direction please?

I found it, so for anyone with the same:
Universal 1 channel driver,
edit the main address to rtsp (from http)
edit the camera settings:
delivery mode: Non Multipart Stream
video stream 1:
RTSP port 8554(or whatever you put)
RTP over RTSP (TCP)

Thanks!

Where do I get the camera hex token?

you need an old MiHome App / i successfully tried a version of december 2017 / go to the cam / help / about / multiple click on the version … a new menu will appear , and then you have to hang through several menus -->. see the token

Ok done that, but from the Mihome App (not camera), is that ok?

pi@pihole:~/videoP2Proxy $ videop2proxy --ip 192.168.1.46 --token atj775kefxxxxxxxxx --rtsp 8554
Starting proxy...
Starting RTSP server on "rtsp://192.168.1.239:8554/"
(Using port 8000 for optional RTSP-over-HTTP tunneling.)

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/pi/.local/lib/python3.5/site-packages/miio/device.py", line 130, in __init__
    self.token = bytes.fromhex(token)
ValueError: non-hexadecimal number found in fromhex() arg at position 0
Can't read output line 1 from command: python3 -c "import miio;result = miio.device.Device('192.168.1.46', 'atj775kefpxxxxxxx').send('get_ipcprop', ['all']);print(result['p2p_id']);print(result['avID']);print(result['avPass']);"
Error, waiting 10 seconds and resetting
Traceback (most recent call last):
  File "<string>", line 1, in <module>

Try first

miiocli device --ip 192.168.1.46 --token atj775kefxxxxxxxxx info

to check if your connection works. It should return the info of the device.

pi@pihole:~/videoP2Proxy $ miiocli device --ip 192.168.1.46 --token atj775kefpgxxxx info
-bash: miiocli: command not found

where how to install miiocli??

ok, made a quick test on virtual machine with ubuntu installed.
failed after autogen.sh, when issuing “make” command I got an error that said something linke “make: *** No object specified & makefile not found. stop.” [I have polish error messages, so had to translate it]

Hello,

I bought this camera:
https://www.gearbest.com/ip-cameras/pp_978606.html
because it has a gateway function.
But how do i access the gateway settings.
In MI App i can add camera but i dont see anywhere a gateway option
in the aqara app i can not add camera’s add all

If i look here:
https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
then :slight_smile: * Install the App on a Android device

  • Make sure you set your region to: Mainland China (Seems to be the longest line with Chines characters) under settings -> Locale - at time of writing this seems to be required.
  • Mainland China and language can set on English
  • Sign In/make an account
  • Select your Gateway in Mi Home and with a short while
  • Then the 3 dots at the top right of the screen
  • Then click on about

But i dont see about
Any help?

There is no point on doing that, your CPU will have to decode h264 and encode the mjpeg.
If you really want to try, maybe combining the stdout mode with gstreamer…

videop2proxy --ip CAMERA_IP --token CAMERA_HEX_TOKEN --stdout \
| gst-launch-1.0 -v fdsrc ! h264parse ! avdec_h264 ! jpegenc ! avimux ! filesink location=video.avi

Untested, making it work will be tricky. Can’t help on that one.


are you sure autogen.sh terminated successfully?


part of python-miio

I followed the instructions I still get command not found

I get the same error

I’m in the same boat. Really wanted this for the gateway but cannot connect it to HA. This thread seems focused on the camera side however.

The instructions you listed work for the stand alone Xiaomi Gateway (I have this as well) not the Gateway Camera.

You both should have more errors before that. Please paste.

This is as far as I can get

root@raspberrypi:/home/pi/videoP2Proxy# make
make  all-am
make[1]: Entering directory '/home/pi/videoP2Proxy'
  CXXLD    videop2proxy
/usr/bin/ld: cannot find -lIOTCAPIs
/usr/bin/ld: cannot find -lAVAPIs
collect2: error: ld returned 1 exit status
Makefile:482: recipe for target 'videop2proxy' failed
make[1]: *** [videop2proxy] Error 1
make[1]: Leaving directory '/home/pi/videoP2Proxy'
Makefile:386: recipe for target 'all' failed
make: *** [all] Error 2
root@raspberrypi:/home/pi/videoP2Proxy# /usr/bin/ld: cannot find -lIOTCAPIs
bash: /usr/bin/ld:: No such file or directory
root@raspberrypi:/home/pi/videoP2Proxy#

this is mine (pastebin) - even with syntax error after autogen.sh, I tried “make”, but also with no luck [like I wrote before, error says something like: “make: *** No object specified & makefile not found. stop.”]

hi thanks for sharing.
I tested the xiaomi gateway witout sussess
I followed all steps, got the key and got the attached log
Any Idea ?
cheers

videoP2Proxy$ videop2proxy --ip 192.168.1.89 --token ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’ --rtsp 8554
Starting proxy…
Starting RTSP server on “rtsp://192.168.1.59:8554/”
(Using port 8000 for optional RTSP-over-HTTP tunneling.)

Got error when receiving: timed out
Traceback (most recent call last):
File “/home/khzd19/.local/lib/python3.6/site-packages/miio/device.py”, line 257, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/khzd19/.local/lib/python3.6/site-packages/miio/device.py”, line 257, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/khzd19/.local/lib/python3.6/site-packages/miio/device.py”, line 257, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/khzd19/.local/lib/python3.6/site-packages/miio/device.py”, line 257, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “”, line 1, in
File “/home/khzd19/.local/lib/python3.6/site-packages/miio/device.py”, line 286, in send
return self.send(command, parameters, retry_count - 1)
File “/home/khzd19/.local/lib/python3.6/site-packages/miio/device.py”, line 286, in send
return self.send(command, parameters, retry_count - 1)
File “/home/khzd19/.local/lib/python3.6/site-packages/miio/device.py”, line 286, in send
return self.send(command, parameters, retry_count - 1)
File “/home/khzd19/.local/lib/python3.6/site-packages/miio/device.py”, line 289, in send
raise DeviceException(“No response from the device”) from ex
miio.exceptions.DeviceException: No response from the device
Can’t read output line 1 from command: python3 -c “import miio;result = miio.device.Device(‘192.168.1.89’, ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’).send(‘get_ipcprop’, [‘all’]);print(result[‘p2p_id’]);print(result[‘avID’]);print(result[‘avPass’]);”
Error, waiting 10 seconds and resetting

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx is only hidden in this chat :slight_smile:

Precision : ubuntu 18 is my test platform