New Xiaomi aqara camera/gateway

No. This isn’t possible.

hi!
while checking if there’s any news on aqara camera/gateway, I’ve found this thread and your post - I use rooted phones and I have the said xiaomi device. if you’ll point me what I need to check and where [is it just the mihome database files, or different stuff?], I’d be more than happy to help, as my camera just lays on the shelf and collects dust right now… :wink:

I have a bit of know-how, but I’m not the expert, so hints are welcomed :wink:

oh, and did you do anything special to finally connect your camera? I have lots of issues with that… when it eventually adds itself into mihome app, it looks like working, but drops connection every time, so I don’t have any visuals or gateway at all…

btw. also a pebble user. nice too see a fellow pebbler in these dark times for this wonderful smartwatch! :slight_smile:

1 Like

Just a few hints because you are already mixing things up :wink:

  1. The Aqara Gateway(s) exposes at least two APIs: miIO and the LAN protocol
  2. The xiaomi_aqara component implements the LAN protocol V1 and V2
  3. To use the LAN protocol you must generate a key by https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)#Adding_the_Xiaomi_Gateway_to_Domoticz
  4. The “token” is a security feature of the miIO protocol which must be extracted from the MiHome app. This isn’t what you are looking for! The “token” isn’t needed for Aqara Gateways.
  5. If you enable the LAN protocol by MiHome the gateway should respond to a “whois” multicast message: https://github.com/Danielhiversen/PyXiaomiGateway/blob/master/xiaomi_gateway/init.py#L77
  6. Does the gateway respond? I don’t think so. If the gateway responds try to retrieve a list of paired devices
  7. get_id_list message (protocol V1), discovery message (protocol V2) https://github.com/Danielhiversen/PyXiaomiGateway/blob/master/xiaomi_gateway/init.py#L224

In short: I assume it’s not possible to enable the LAN protocol at the moment. UDP port 9898 of the gateway stays closed. The gateway won’t respond to a “whois” call and cannot be used at all.

1 Like

I’m thinking it might be time to send my Pebble to pasture, as the battery is starting to go in it. Been eyeing off a Fitbit Versa, but they’re pricey. They support Javascript apps though, so I could easily port my Pebble app to it, though that’d be a story for a different thread / PM

Anyway, to get the camera connected, I just tried and tried again until it worked. Turning off mobile data (i.e. only using WiFi) might have helped, because Android likes to use a mix of WiFi and mobile data sometimes, and that mixing has caused troubles with the Orvibo smart sockets I wrote software for / helped reverse engineer a few years back.

In regards to the rooted phone stuff, it’s been a while since I’ve rooted my phone, but find a file manager that works on rooted devices (for example this one). In one of the top-level folders, possibly /data, you should hopefully find a folder in there that might be something like com.xiaomi.mihome. The contents of that folder would be super handy (the Orvibo WiWo app had a SQLite database in there that contained useful info for when I reversed engineered their IR / RF blaster)

Also if you’ve got time, WiFinspect woluld be great (I’ve never used the app though). The steps would be like so:

  1. Open WiFinspect and tap on Network Sniffer
  2. Tap “Start Sniffing”
  3. Open the Mi Home app
  4. View your camera
  5. After a few seconds, go back to WiFinspector and stop sniffing.
  6. It’ll create a log. Not sure where it’ll store it, but it shouldn’t be too hard to find in your file manager. Send the log on if you don’t mind.

As an update to my last post, I’m confused as to what I’m seeing here, because if I connect to the camera then disconnect my modem from the internet (so my phone can only access the local network), the connection stays. But if it’s interrupted, it won’t connect back. Also running commands like netstat -t -u seemingly don’t show anything connect to the IP address of my camera. So I need to keep scratching my head until I get it.

1 Like

I’m gonna wait till my PT dies. then I’ll think what to do - as for now I don’t think anything could fill all the functions/features Pebble has and I use ;( but yeah, back on track - to the topic :slight_smile:

about connecting - all right, so I need to try harder :wink: oh, and I tried all combinations with on/off mobile, bluetooth, nfc… anything what could interfere even in the smallest part [like the nfc, which was absurd, but I’ve tried with and without anyway ;)]. gonna test more…

about rooted stuff - I use X-plore File Manager - highly recommend! not only supports root files browsing, but also has sqllite browser built in [along with other cool stuff like wifi-server for connecting from desktop]. swiss-army-knife-file-manager app :slight_smile: and yes - there is a database for mihome app - it’s a file from which tokens could be extracted to connect to gateways, vacuums etc. unfortunately the aqara camera/gateway combo didn’t showed up there :frowning: data base file is called miio2.db and it’s located in /data/data/com.xiaomi.smarthome/databases/. if you want to see what other stuff is in the com.xiaomi.smarthome folder - check this out - I’ve put the listing on pastebin.

I will try WiFinspect [or other sniffer, AFAIR it’s possible that I have something like this already installed, been playing with my home and office networks so I have few different tools somewhere in the darkest part of my Pixel’s storage ;)] yeah, but first I need to connect my camera with success… so I guess I’ll let you know after this mission completes. for now - give me a sign if you’ll need some more info from the com.xiaomi.smarthome app.

I have an CamGateway. Love to get it working. Let me know if I can contribute.

I’m also looking a RSTP option for this device.

1 Like

There’s certainly some interesting folders in there.

Did miio.db contain anything useful? Also what about all those zip files in com.xiaomi.smarthome\app_plugin\?

Also, any chance the folder could be zipped up and sent on to me? Preferably when you’ve got the camera connected? Some of those cache files might hold info about what ports to try or what else is needed to view the cameras.

@Grayda The MiHome Plugin 108 (https://drive.google.com/drive/folders/0BzFWe26yNg9DTEVsV3RvbTZjUGc) provides the device support of the lumi.camera.aq1.

1 Like

I monitored the wifi traffic while the device is added in the home app and it talks UDP packets to port 54321. It seems the camera sends the miio token that way.

Using GitHub - aholstenson/miio: Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more I get

$ miio discover
INFO Discovering devices. Press Ctrl+C to stop.

Device ID: 7554xxxx
Model info: Unknown
Address: 192.168.1.33
Token: ???
Support: Unknown

We may be able to use this library once the token data is decrypted from the UDP packets.

Did anyone manage to pop the camera open? It doesn’t look like there are any screws (except for the stand) Tried twisting it and sliding a thin flat screw driver between the little line that holds together the front and the back of the camera but no luck. Would love to see if there’s a way to hook up a serial connection to it.

Check this post out. It is from a russish page.

https://4pda.ru/forum/index.php?showtopic=895326&st=0#entry71970847

Awesome! Looks like there’s exactly what I need, thanks :slight_smile: Problem though is I still can’t pop it open (don’t know if it’s mentioned somewhere in the forum you provided, unfortunately I don’t speak Russian)

I don’t speak russian, too. But If you look at the first picture, you will see the position of the 6 clips and then you can try to open it. I did it once and I remember that it takes some force to open up.

To open it without damaging the case with a screwdriver put the stand back in the middle of the speaker so you can apply pressure to the top and the bottom joint of the main body very hard but gently, it separates the two plastic pieces without breaking it (sometimes the black front plastic part pops up first).

Be aware that the stand is attached to the front part of the main camera body, it can help when partly opened.

Hi
Any update? Have tried all tips without success :frowning:
Any workaround?
Thanks

Hope that someone find a way to integrate this camera. Cross fingers! :slight_smile:

Anyone has a solution for the Xiaomi Camera 360?

I tried the ffmpeg addon, didn’t pick up any files

camera:
  - platform: ffmpeg
    input: ../addons/xiaomi_camera_videos/

Hi
Last update from my tests:
I installed a ZigBee c2531, I m able to see all Xiaomi devices except this camera :frowning_face:
Hope a new release of zigbee2mqtt integrate it :slight_smile:
To follow

I just got the Xiaomi Aqara Gateway Camera thinking it would work with HA via the Xiaomi Gateway (Aqara) Component. After several hours of messing with it I found this thread that seems to have been going since last year. That’s pretty discouraging since I bought the Xiaomi Gateway Camera specifically for this purpose. Has anyone reached out to Xiaomi support about this?

@MGWGIT, @Danielhiversen, @Bieniu, @scop, @PaulAnnekov, @ileler, @covrig, @syssi,& @cdce8p.

Do any of you have any thoughts? I thought i’d include you in this discussion as you all worked on the Xiaomi Gateway integration.