New Xiaomi aqara camera/gateway

You are right, I know. But in my mind there is no such thing as impossible :wink:
I ordered a zigbee sniffer to test my setup because I donā€™t want to connect to some servers in China (or any other ones not in my home setup) will see how it works in a few weeks.
I might try the SmartThings route though and will keep looking for a solutionā€¦

@Ozon1969 I think you can get the pass key when making a backup with an iOS device (like with the Xiaomi vacuum, you can read the guide there). In short; make a backup and read the database. Then convert the (32-digit) token in Terminal. Donā€™t know if you can also get it with an android device but the link explains this. Hope it helps.

I can get a 32 character token, but unfortunately, no token. Ordered some original gatewayā€™s and a cc2531sniffer. Will try that route for now and will try the method mentioned earlier to get the camera working

@Ozon1969 they explain how to convert it in the article. You can pm the code to me, but itā€™s very easy.

Ok pm send

Ok in the meantime, on to the video part.
I ran the video2proxy command and voila, something happens butā€¦ How can I check the stream?
When adding the rtsp URL to VLC it doesnā€™t showā€¦ What am I doing wrong here?
Hereā€™s what happens on the raspberry after the command is given


Starting proxyā€¦
Starting RTSP server on ā€œrtsp://192.168.1.59:8554/ā€
(Using port 8000 for optional RTSP-over-HTTP tunneling.)

[P2P client] startingā€¦
IOTC_Initialize2ā€¦
IOTC_Connect_ByUID_Parallelā€¦ SID:0
avClientStart2ā€¦ userName: admin passWord: 7f#####82f10
avClientStart2 mAvIndex=0
startIOTC video ret=0
startIOTC audio ret=0
[P2P client] running
[ReceiveVideo] Running
[ReceiveAudio] Running


Next steps?

Tested with ā€œip cam viewerā€ and it works

Not sure what you are looking for. YAML code? The only thing that was unclear for me from the post from @sendorm was where i needed to use the ip of the camera (initially i used the ip address of the camera everywhere) and where to use the ip address of the machine youā€™re running HA onā€¦

Good feedback. Iā€™ve fixed the post accordingly. Everything should be clearer now.

1 Like

@hal9000 I did tried your docker image, but got this error:

docker: Error response from daemon: cannot mount volume over existing file, file exists /var/lib/docker/overlay2/2eb62f77f4e0452ab97f6c3f707dc709fe4e106a33764774f2adbe3f2d03544c/merged/usr/share/zoneinfo/UTC.

did everything just as described. any idea what can I try to fix this?

@pejotigrek
The error is caused by these linesā€¦

    volumes:
      - /etc/localtime:/etc/localtime:ro

remove them from docker-compose.yaml and things should be fine. all the lines do is sync your pi clock to the container clock.

hmm, forgive me my noob question [this is the first time/first project I am using docker, and I donā€™t know too much about it :D]: where I can find this? or should I prepare somewhere?

I started docker image by entering via ssh [of course IP and TOKEN entered as found in my cam]:

docker run --name xiaomi \
  --restart=unless-stopped \
  -e IP=<CAMERA_IP> \
  -e TOKEN=<CAMERA_TOKEN> \
  -p 8554:8554 \
  -p 8580:80 \
  -d  annbob/xiaomi-aqara-rtsp

didnā€™t prepared any docker-compose.yaml file anywhere [I thought that the ā€œdocker-composeā€ part of instructions is for something elseā€¦ ;)]

@pejotigrek
Sorry for the confusion. I use something called Docker Compose to start my containers. I havenā€™t actually tried the Docker command until you wrote me. Iā€™m a bit of a NOOB, too. You are correct in the error being received. Iā€™ve updated the Docker command in my instructions to the below.

sudo docker run --name xiaomi \
  --restart=unless-stopped \
  -v /etc/localtime:/etc/localtime:ro \
  -v /etc/timezone:/etc/timezone:ro \
  -e IP=<CAMERA_IP> \
  -e TOKEN=<CAMERA_TOKEN> \
  -p 8554:8554 \
  -p 8580:80 \
  -d annbob/xiaomi-aqara-rtsp

Thanks for pointing out the bug in my instructions.

thanks! that worked great :slight_smile:
I mean: it started container without problems, and after a while it outputted a 64-character long string which looks like some kind of checksum [I guess I can ignore it?]. Iā€™m still fighting to get the image [looks like my camera is dropping connection, so probably my local problem] but docker runs without issues :slight_smile:

@pejotigrek
The 64-character long string is the container id that docker uses to store the containerā€™s files. ie /var/lib/docker/containers/f05034836ce9d27abc82721da4ca69cdd10093b5f616747e73ca5ca8db492425 is my version. Yours should be similar. The number should change every time you recreate the container. Starting and stopping the container will use the same id.
if you run the below command, you should see similar output to what is shown below. If you see something similar then the container is running correctly.

sudo docker logs xiaomi

Starting proxy...
Starting RTSP server on "rtsp://172.17.0.2:8554/"
(Using port 80 for optional RTSP-over-HTTP tunneling.)

[P2P client] starting...
IOTC_Initialize2...
IOTC_Connect_ByUID_Parallel... SID:0
avClientStart2... userName: admin passWord: 788e640ac9d8
avClientStart2 mAvIndex=0
startIOTC video ret=0
startIOTC audio ret=0
[P2P client] running
[ReceiveVideo] Running
[ReceiveAudio] Running

Iā€™ve been trying to root out a problem that stops the camera image from being seen in HA after about 2 hours. Still trying to track that down. There is an image in the repo that allows you to restart the videop2proxy program at an interval that you specify. Command is below.

sudo docker run --name xiaomi \
  --restart=unless-stopped \
  -v /etc/localtime:/etc/localtime:ro \
  -v /etc/timezone:/etc/timezone:ro \
  -e IP=<CAMERA_IP> \
  -e TOKEN=<CAMERA_TOKEN> \
  -e DELAY=<DELAY_IN_SECONDS_BETWEEN_RESTARTS>
  -e RESTARTDLY=<TIME_BETWEEN_STOPPING_VIDEOP2PROXY_&_RESTARTING_AGAIN>
  -p 8554:8554 \
  -p 8580:80 \
  -d annbob/xiaomi-aqara-rtsp:autoreload

Defaults are 7200 seconds between restarts and 15 seconds between stop and restart.

1 Like

thank you for the explaination!
will try the new image soon

Just a heads up for anyone toying around with this camera:

Port 22 definitely is telnet (the username is root and the password is lumi-201 and itā€™s running Linux like some of the other cameras), but the latest firmware DISABLES telnet.

So, if you want to attempt to develop custom firmware, do NOT update to the latest version! The MiHome app actually locks you out of the camera until you upgrade, so BE CAREFUL!

This is likely due to https://www.youtube.com/watch?v=DHsqb2poGII (where I got the password from) where Dennis said he spoke to Xiaomiā€™s security team to warn them of some vulnerabilities.

(Note: I havenā€™t tried the docker container to see if that still works, but I assume it does, because itā€™s not using telnet access)

EDIT: Yep, only port left open is port 54355, used to communicate with Xiaomiā€™s cloud services. Iā€™m going to run a more thorough port scan tomorrow, however I can confirm: video2proxy (and the docker containers) **ARE STILL WORKING**. I just connected to my camera through VLC.

Hi guys,

My camera stopped working after few days. Iā€™m able to put it asleep and wake it up but I cannot see anything. Any ideas?

Thanks,
Marco

Version 3.3.7_248.0143 of the firmware also disables videop2proxy. Do not update to this version.
The program gives this error:

KeyError: 'p2p_id'
Can't read output line 1 from command: python3 -c "import miio;result = miio.device.Device('192.168.1.xx', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').send('get_ipcprop', ['all']);print(result['p2p_id']);print(result['avID']);print(result['avPass']);"

The keys are correct of course.

2 Likes

Thatā€™s exactly what I have doneā€¦ damn