Infinite Flight Connect - Python

Infinite Flight Connect Python

Note

This is a technical post. Feel free to skip to the bottom to learn how to use it!

While working on a different project, I needed a way to connect to the Infinite Flight Connect API. Therefore, I spent an afternoon creating a python module to make it easier to interface with the IF Connect API. The Connect API allows a program to communicate with Infinite Flight through a TCP connection. You can read all about the API here: Connect API v1 | Infinite Flight.

My python module makes it much easier for any developer interface with the API. It is also open source on GitHub so feel free to tinker and play with it all you want :)

Getting set up

  1. Enable IF Connect in the Infinite Flight settings (also make sure your computer and simulator are running on the same local network)
  2. Install the python module using pip pip3 install IFConnectOld (make sure it’s version >=1.0.2 since 1.0.0 and 1.0.1 doesn’t work)
  3. In your own python script, import the module from IFConnectOld import *
  4. To send a command, use the send_command function send_command function with the command, parameters and whether or not you want to await response. This function prints out the status and then returns the response if await_response is true.

Example

from IFConnectOld import *

send_command("Airplane.GetState", [], await_response=True) # This command will yield a response.
send_command("Commands.LandingLights", []) # await response if false by default. this command does not return a response and awaiting a response will simply lead to the program hanging.

The source code for this project be found at the following GitHub link.

14 Likes

Very good your project, I’ll even take a look. I made the site of my VO on top of python

1 Like

ah nice, not sure how this would work with a website since this is the connect api rather than the live api, but i’m sure you can figure something out

This is really Nice! Might start looking into this one!

1 Like

Sounds great. I tried to make it as easy and efficient as possible. LMK if you find any bugs!

Hey this looks useful. Will look into some use cases for this. Was thinking of a remote monitoring and management system for autopilot controls and stuff. Might be feasible and possible. Thanks

2 Likes

Looks cool! I’m not a Python person but appreciate anyone doing things with the API. Now give the new one a shot, it’s a pain but super rewarding.

4 Likes

Liked ! Was thinking of developing something nice with the connect API.
Oh, and I just followed your github btw :p

1 Like

@sanketpandia Of course, looking forward to seeing what you come up with :)


@Sebastien_Cartier Thanks for the follow 🤪. Excited to see what you develop with the API :)

1 Like

Haha, I’ll definitely work on it when I can. I’ll probably need to read your NodeJS code a few more times before I can get it to work 😬

I’m completely not familiar with anything related to coding, but will this improve our experience with using joystick?

1 Like

Very cool! I’m a big fan of Python so it’s nice to see that someone has built a module to get Python and the connect API together. Like others have said, I’m excited to see IFConnectNew with the new API :)

2 Likes

I’m not certain the v2 branch actually works 😬

Let me know if you have any questions though.

1 Like

Very nice! Might develop something like LFC

2 Likes

Hopefully… We need something enabling us to use our joysticks, cause lately the connection and performance has degraded drastically…

1 Like

@Crown.plane I’m not sure how this python library will help with joystick support. If you talking about the LiveFlight Connect app for Mac/Windows made by Cameron, that talks directly to the API without going through a Python library. Maybe someone will make another joystick connect app using this but I’m not sure… If LiveFlight Connect acting up lately, maybe reach out to the community for support? Although, I haven’t had many issues on my end, I know that the project has been marked as deprecated on GitHub…


@tomthetank If your a big fan of python, I’m sure you can find a creative use case for this (no pressure or anything 😅). If I do update this API to v2, it’d probably just be called IFConnect just to keep it short and simple.


@KaiM I’ll read the documentation and then your code. I’ll also lyk if I find anything I can help with on JS although I’m still fairly unfamiliar with JS.


@Saharsh excited to see what you develop!

2 Likes

I know that the app is deprecated but i have issues in its performance… Sometimes suddenly disconnects and freezes… It’s response to inputs has some lags and unfortunately it’s unreliable

1 Like

Hi
This is a really amazing project. I finally see a python project about Connect API.
These days, I am trying to develop the connect v2 by using python.
I think I can successfully connect to IF and get status or run command now.
I have done the setState function, but it does not work!
hahah I am not sure the reason (Still testing).

If you are interested, please contact me and I can share my project with you.

I am thinking to use python to build a flight assistant tool for IF pilot in the future. hahah

Thank you!

1 Like

I haven’t worked on v2 yet although I plan to check it out some time soon. Good luck with your project.

1 Like

Thank you so much for this amazing project. Looking forward to playing around with the API a bit. Also, do you happen to know the list of all possible commands which we can send to the simulator?

1 Like