deltaflyer4747 / xiaomi_yi Goto Github PK
View Code? Open in Web Editor NEWXiaomi Yi Camera settings via python (PC) script
Xiaomi Yi Camera settings via python (PC) script
hello, i am working on behalf of support for Yi Discovery, through C&C.
I have gone through so much trying to figure this out anyway possible,
my focus is on the PC environment and multi-camera set up,
if i can get past to "cannot connect to the address specified" then i'll figure out the rest
I've tried changing machines, operating systems (Win 10, Ubuntu 16 and even a Mac OSX 10.5 just for the sake of it)
The problem persisting is that the whole 6 of Yi Discovery's ( model:YDXJ2_V11YB ver: J22_1.3.33)
and 2 of Yi 4K (ver:1.3.0) cant connect to the CC.exe and get me a RTSP feed,
i tried rtsp://192.168.42.1/live with and without different ports to no avail on Yi Discovery's,
Yi4K has been a success on getting rtsp but no C&C support either.
I have 6 separate wireless lan cards on pc, and cant make the autoexec script work on changing IP's either so i am super stuck with a bunch of Yi's and we're drinking our sorrows away!
I can send a token on telnet on each camera, it responds but, that's it, no feed, no C&C, no hope.exe.
if i only could get past to C&C working then i'll be able to recover quickly and get it up to date with the today's support of Yi Cameras
since ive gone through every corner of this forum to find a glimpse.
Don't put the build .exe files etc. into the git repository, create a tag and upload the file to the tag in github. This prevents the repository to get huge (34 mb now for a few lines of code)
First of all thank you for your amazing work!
The problem that I am experiencing, is after connecting to the camera I'm only able to take one picture, after that the camera becomes unresponsive.
I have tried with two different cameras, the problem is the same, also tried just using the command line with telnet 7878 and then sending the messages, also getting the same result.
telnet 172.20.10.13 7878
Trying 172.20.10.13...
Connected to 172.20.10.13.
Escape character is '^]'.
{"msg_id":257,"token":0}
{ "msg_id": 7, "type": "vf_stop" }{"msg_id":257, "param":2, "rval": 0 }{ "rval": 0, "msg_id": 257, "param": 1 }
{ "rval": 0, "msg_id": 257, "param": 2 }{ "msg_id": 7, "type": "battery" ,"param":"57"}{"msg_id":769,"token":2}
{"rval":0,"msg_id":769}{"msg_id":769,"token":2}
{"rval":-21,"msg_id":769}{"msg_id":257,"token":0}
{ "msg_id": 7, "type": "vf_stop" }{ "rval": 0, "msg_id": 257, "param": 2 }{"msg_id":769,"token":2}
{"rval":-21,"msg_id":769}{ "msg_id": 7, "type": "battery" ,"param":"56"}
this only resulted in one picture as well.
I think I am able to start recoding video (light starts flashing, but not able to stop it and also the camera becomes unresponsive)
Sometimes after sending the message to start recording the camera beeps loudly 3 times, and then resets.
Hello. Can i view live video on PC from cam and record video on CAM at the same time?
I suggest the following for linux users wanting to use their mouse wheel in CC.pyw config
Tested on raspberry pi raspbian only.
under
def MenuConfig_WheelScroll(self, event):
remove Windows statement
self.controlcanvas.yview_scroll(-1*(event.delta/120), "units")
add Linux and Windows statements
if event.num == 5: # linux scroll down
self.controlcanvas.yview_scroll(1, "units")
elif event.num == 4: # linux scroll up
self.controlcanvas.yview_scroll(-1, "units")
else: # windows scroll event
self.controlcanvas.yview_scroll(-1*(event.delta/120), "units")
under
self.controlcanvas = Canvas(self.controlselect)
self.controlcanvas.bind_all("<MouseWheel>", self.MenuConfig_WheelScroll)
add for use with Linux OS
self.controlcanvas.bind_all("<Button-4>", self.MenuConfig_WheelScroll)
self.controlcanvas.bind_all("<Button-5>", self.MenuConfig_WheelScroll)
under
def UnbindAll(self):
self.master.unbind_all("<MouseWheel>")
add
self.master.unbind_all("<Button-4>")
self.master.unbind_all("<Button-5>")
Good day!
Is there any documentation on commands I can send to this camera? How have you found those commands, that are used in the script? Is is possible to connect the camera to my home WiFi? Thank you in advance!
Hello,
thanks for this project first of all!
I ordered 2 4k+ cameras for stereo vision, unfortunately I cannot in the moment load SD card (firmware 1.0.4 620r), but hopefully will resolve that, if you know about supported sd card for this firmware I would love to hear :-) :
http://forum.xiaoyi.com/forum.php?mod=viewthread&tid=50515&extra=
Main point of my question is if there is available to extract from the images taken and streamed via Wifi timestamp. I would like to use it for synchronization of images from 2 cameras for stereo vision. Thanks for any hints about this. I read articles where Andy S user and others discussed using NTP protocol to sync time and trigger at same time recording.
Well, my approach is little bit different, I will also use NTP to sync hours, but using OpenCV and FFmpeg projects I would like to capture images in parallel from both and sync them in the software. To to this I will need at each image timestamp mark, resolution in miliseconds is just fine for me, of course if we can get better to nanoseconds, could be more accurate ....
Thanks for any comments on this.
Hi all,
I am using the Yi Action Camera and am able to use your software to stream on VLC.
I have a 1GB memory card on the camera, and record everything on VLC directly to my PC.
I have two issues :
thanks for your help
1.) Is the new Night Vision Edition supported?
2.) How does one setup the camera initially (e.g. what Wifi it connects to)?
I want to connect Lamax X8 Electra action cam via Wi-Fi to my PC and use it in OBS Studio software as a video live feed source. I found no solution. I think your code could be used in my case with just little changes, because these cheap action cams must work +- all the same way. Do you thing its possible?
Hello, When I am trying to use software with this cam(Xiaomi Mijia Camera Mini 4K), it is showing connected and only able to get the sd card info. But after showing connected it is giving an error that connection failed. If the card info is accessible I guess we can work through any other options.
If I run vlc with rtsp://192.168.42.1:554/live it is showing output video but with 2sec delay.
I have a Yi camera. I cloned this Github project and tried the python script CC.pyw/CC.exe on my Windows 10 pc, and when the UI comes up, it shows IP address, JSON port, etc. But after clicking the Connect C&C button, a window pops up that says "Cannot connect to the address specified".
Using python 3.5
Found some issues:
When I press "f" key on wifi_password or wifi_ssid textbox, it always open the Files page. I think it's caused by "Files" button alt shortcut which is set to "f". Same thing happened too when I press "l" key, it will open "Control" page.
It's often happened that when switching from "Files" page to "Configure" page, the program will hang/freeze.
Suggestions:
Display error message if saving configuration failed.
I tried to set new wifi password which contains special character, after I click apply and switch forth and back to "Configure" page, I saw the wifi_password still displays the old password. Turns out the wifi password can't contain special character after I checked with andriod yi action app. The android app will give you error message if you try to set password with special character. I expect the program should behave same too by showing errror message if the operation is not successful.
Is it possible to remember last folder path in "Files" page?
The program always load the "/var/www/DCIM/.thumbnails" folder when switching to Files page. Is it possible to load the last opened folder instead?
Add "Disconnect" button.
I would like to be able to disconnect the wifi and return to initial dialog page (where you have ip address and own vlc path field) rather than to quit and relaunch the program.
Switch back from expert mode to simple mode.
It's strange that I can enable expert mode menu, but can't disable it.
Add some documentation about how to use the program on the readme.md.
Few thing about the UI are not obvious like "own vlc path" field. I thought it needs to be set with VLC folder path, but turns out it's vlc.exe file path.
I just got a Yi2 4K camera and am excited to be able to use it with PC! The program looks like it will connect, and the camera beeps and doesn't connect, and won't go to the next screen (goes blank), though the bottom left status says connected.
Any chance this can be adapted to work with the Yi2?
So far, I found out that the following will trigger the camera settings change to readonly status:
{"token": 1, "msg_id": 259, "param": "none_force"}
or
{"msg_id": 7, "type": "vf_start"}
Example:
{"token": 1, "msg_id": 9, "param": "video_standard"}
before:
{
"rval": 0, "msg_id": 9,
"options": [
"NTSC",
"PAL"
],
"param": "video_standard",
"permission": "settable"
}
after:
{
"rval": 0, "msg_id": 9,
"options": [
"NTSC",
"PAL"
],
"param": "video_standard",
"permission": "readonly"
}
My solution is to send 258 & 257 to renew the token. And futher, I also found out after vf_start, no need the send 259 to start the webport, which is already opened.
Path to VLC player is pointing to c:/Program Files/VideoLan/VLC/vlc.exe or c:/Program Files (x86)/VideoLan/VLC/vlc.exe. In case user has portable version or different drive installed it shows message "VLC Player not found".
Dear deltaflyer,
thank you for sharing that amazing project with us. I currently use your code to connect my raspberry pi with my Xiaomi Yi cam. Works fine.
I try to extend your Camera_photo.py script.
My aim is to display the photo that has been taken via pygame.
I figured out that the cam send some status updates that contain the image path on the cam:
See: https://gist.github.com/SkewPL/f57e6cff7fa14601f6b256926aa33437
But I can't figure out how to listen to that status updates.
Till now I just get the "{"rval":0,"msg_id":769}" response via data = srv.recv(512).
Do you have any idea how I can listen to -> { "msg_id": 7, "type": "photo_taken" ,"param":"/tmp/fuse_d/DCIM/127MEDIA/YDXJ0373.jpg"}?
Thanks and best regards
Ben
Have you tried this with latest firmware? Doesn't seem to be accepting connections on port 7878 anymore.
I suspect it is because at line 340 in CC.pyw the type should be battery_status; not battery.
Hi, thanks for this app. I used it in VM ware machine and works perfectly.
My problem is in the Mac when I run the CC.pyw it does not open the app.
Any tips what i m doing wrong?
Thanks
Jose
Since upgrading the camera firmware to 1.2.10 the configuration window in CC does not show any settings.
The following error message is shown:
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1535, in __call__
return self.func(*args)
File "./CC.pyw", line 869, in MenuConfig
ValueBox = OptionMenu(ThisFrame, ThisValue, *self.camsettableconfig[ThisOption])
TypeError: __init__() takes at least 4 arguments (3 given)
Title says all. On Fedora 30, and original sport version of Yiaomi Yi.
Also, just as in #19, certain ascii characters typed in the WiFi Password or SSID fields, navigate away from the settings/config' screen. HOWEVER even when using other characters, Image Flip for video recording, nor the WiFi Password, nor the SSID could be changed via the GUI. I have not had time to try and do so via a file, or cURL/JSON, et cetera, and some syntax snippets might help.
Hi,
I have a Yi camera. I cloned this Github project and tried the python script CC.pyw on my MacBook Pro, and when the UI comes up, it shows IP address, JSON port, etc. But after clicking the Connect C&C button, a window pops up that says "Cannot connect to the address specified".
Is the problem of my Yi camera or the Python script itself?
I also tried to enable telnet and shell console access to the camera (following instructions on https://forum.dashcamtalk.com/threads/xiaomi-console-access.11198/) without any success. I wonder if the problem is related.
Basically, I want to find a way to set its timezone to be something that's different from the Beijing Time.
Thanks for any suggestion!
Alex
def FileDownChunk(self, chunk_size=0, report_hook=None, FileTP=""):
...
towrite = ""
...
towrite += chunk
...
filek.write(chunk)
...
You use the "towrite" to keep file data get from YiCam, but final only write the last chunk to the downloaded file. Will you still keep update this repo?
There seems to be some quite confused people, judging by some of the other questions.
Is this intended for the Yi Action Camera, the GoPro like device , or the Yi Home Camera ?
My files are only transfering when I press any key on my MacBook or moving the mouse. Else it stops.
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.