simconnect
Python interface for MSFS2020 SimConnect.dll
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 18 committers (5.6%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.0%) to scientific vocabulary
Repository
Python interface for MSFS2020 SimConnect.dll
Basic Info
- Host: GitHub
- Owner: odwdinc
- License: agpl-3.0
- Language: Python
- Default Branch: master
- Size: 539 KB
Statistics
- Stars: 301
- Watchers: 29
- Forks: 115
- Open Issues: 39
- Releases: 0
Metadata Files
README.md
Python-SimConnect
Python interface for Microsoft Flight Simulator 2020 (MSFS2020) using SimConnect
This library allows Python scripts to read and set variables within MSFS2020 and trigger events within the simulation.
It also includes, as an example, "Cockpit Companion", a flask mini http server which runs locally. It provides a web UI with a moving map and simulation variables. It also provides simulation data in JSON format in response to REST API requests.
Full documentation for this example can be found at https://msfs2020.cc and it is included in a standalone repo here on Github as MSFS2020-cockpit-companion.
Mobiflight Simconnect events:
Yes this supports the new SimConnect commands that DocMoebiuz of MobiFlight developed. A full list of commands and install instructions
At this time MobiFlight SimConnect commands are not include in the AircraftEvents class and as so the AircraftEvents.find() and AircraftEvents.get() will not work. You will need to pass the Event ID to a new Event class as the Example below shows.
```py from SimConnect import *
Create SimConnect link
sm = SimConnect()
Creat a function to call the MobiFlight AS1000MFDSOFTKEYS_3 event.
Sk3 = Event(b'MobiFlight.AS1000MFDSOFTKEYS_3', sm)
Call the Event.
Sk3() sm.exit() quit() ```
Python interface example
```py from SimConnect import *
Create SimConnect link
sm = SimConnect()
Note the default _time is 2000 to be refreshed every 2 seconds
aq = AircraftRequests(sm, _time=2000)
Use _time=ms where ms is the time in milliseconds to cache the data.
Setting ms to 0 will disable data caching and always pull new data from the sim.
There is still a timeout of 4 tries with a 10ms delay between checks.
If no data is received in 40ms the value will be set to None
Each request can be fine tuned by setting the time param.
To find and set timeout of cached data to 200ms:
altitude = aq.find("PLANE_ALTITUDE") altitude.time = 200
Get the aircraft's current altitude
altitude = aq.get("PLANE_ALTITUDE") altitude = altitude + 1000
Set the aircraft's current altitude
aq.set("PLANE_ALTITUDE", altitude)
ae = AircraftEvents(sm)
Trigger a simple event
eventtotrigger = ae.find("APMASTER") # Toggles autopilot on or off eventto_trigger()
Trigger an event while passing a variable
targetaltitude = 15000 eventtotrigger = ae.find("APALTVARSETENGLISH") # Sets AP autopilot hold level eventtotrigger(targetaltitude) sm.exit() quit() ```
HTTP interface example
Run glass_server.py using Python 3.
http://localhost:5000
Method: GET
Variables: None
Output: Web interface with moving map and aircraft information
http://localhost:5000/dataset/<dataset_name>
Method: GET
Arguments to pass:
|Argument|Location|Description| |---|---|---| |datasetname|in path|can be navigation, airspeed compass, verticalspeed, fuel, flaps, throttle, gear, trim, autopilot, cabin|
Description: Returns set of variables from simulator in JSON format
http://localhost:5000/datapoint/<datapoint_name>/get
Method: GET
Arguments to pass:
|Argument|Location|Description| |---|---|---| |datapoint_name|in path|any variable name from MS SimConnect documentation|
Description: Returns individual variable from simulator in JSON format
http://localhost:5000/datapoint/<datapoint_name>/set
Method: POST
Arguments to pass:
|Argument|Location|Description| |---|---|---| |datapointname|in path|any variable name from MS SimConnect documentation| |index (optional)|form or json|the relevant index if required (eg engine number) - if not passed defaults to None| |valueto_use (optional)|value to set variable to - if not passed defaults to 0|
Description: Sets datapoint in the simulator
http://localhost:5000/event/<event_name>/trigger
Method: POST
Arguments to pass:
|Argument|Location|Description| |---|---|---| |eventname|in path|any event name from MS SimConnect documentation| |valueto_use (optional)|value to pass to the event|
Description: Triggers an event in the simulator
Running SimConnect on a separate system.
Note: At this time SimConnect can only run on Windows hosts.
Create a file called SimConnect.cfg in the same folder as your script.
Sample SimConnect.cfg:
ini
; Example SimConnect client configurations
[SimConnect]
Protocol=IPv4
Address=<ip of server>
Port=500
To enable the host running the sim to share over network,
add <Address>0.0.0.0</Address>
under the <Port>500</Port> in SimConnect.xml
SimConnect.xml can be located at
%AppData%\Microsoft Flight Simulator\SimConnect.xml
Sample SimConnect.xml:
```xml <?xml version="1.0" encoding="Windows-1252"?>
Notes:
Python 64-bit is needed. You may see this Error if running 32-bit python:
OSError: [WinError 193] %1 is not a valid Win32 application
Per mracko on COMRADIOSET:
MSFS uses the European COM frequency spacing of 8.33kHz for all default aircraft.
This means that in practice, you increment the frequency by 0.005 MHz and
skip x.x20, x.x45, x.x70, and x.x95 MHz frequencies.
Have a look here http://g3asr.co.uk/calculators/833kHz.htm
Events and Variables
Below are links to the Microsoft documentation
Owner
- Login: odwdinc
- Kind: user
- Repositories: 15
- Profile: https://github.com/odwdinc
GitHub Events
Total
- Issues event: 5
- Watch event: 22
- Issue comment event: 2
- Pull request event: 1
- Fork event: 6
Last Year
- Issues event: 5
- Watch event: 22
- Issue comment event: 2
- Pull request event: 1
- Fork event: 6
Committers
Last synced: almost 3 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| odwdinc | a****y@g****m | 137 |
| hankhank10 | m****n@g****m | 87 |
| iPhysicX | p****x@n****e | 24 |
| Jakob Klein | m****l@j****t | 4 |
| Jakob Klein | k****b@g****m | 4 |
| Aurexine | A****e@g****m | 3 |
| Jason Hanford-Smith | j****h@s****m | 2 |
| Koseng | 2****g | 2 |
| Marius Krämer | f****s@w****e | 1 |
| Greg Retkowski | g****g@r****t | 1 |
| Mike Neilson | g****e@g****m | 1 |
| Mike Shlanta | s****a@g****m | 1 |
| Maarten Tamboer | m****r@m****m | 1 |
| Peter Heiss | p****s@u****e | 1 |
| dff180 | d****0 | 1 |
| Darío Hereñú | m****a@g****m | 1 |
| David Heise | d****e | 1 |
| chssn | 3****n | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 86
- Total pull requests: 25
- Average time to close issues: 25 days
- Average time to close pull requests: 3 months
- Total issue authors: 60
- Total pull request authors: 18
- Average comments per issue: 2.74
- Average comments per pull request: 1.44
- Merged pull requests: 15
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 6
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 6
- Pull request authors: 1
- Average comments per issue: 0.17
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- vamshichittaluri (6)
- iceyrazor (5)
- Revel8804 (4)
- danricho (4)
- hankhank10 (3)
- omrygin (3)
- Pomax (2)
- westlakem (2)
- mracko (2)
- fyyyyy (2)
- artlazza (2)
- alptugidin (2)
- mischeaux (2)
- DownInTheShop (1)
- storca (1)
Pull Request Authors
- odwdinc (4)
- Koseng (3)
- Pomax (3)
- maartentamboer (1)
- CodeBizarre (1)
- sdshlanta (1)
- jules1468 (1)
- Heiss (1)
- WinkelCode (1)
- chssn (1)
- MikeNeilson (1)
- antsmc2 (1)
- dff180 (1)
- daheise (1)
- gregretkowski (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 2,225 last-month
- Total dependent packages: 0
- Total dependent repositories: 3
- Total versions: 41
- Total maintainers: 1
pypi.org: simconnect
Adds a pythonic wrapper for SimConnect SDK.
- Homepage: https://github.com/odwdinc/Python-SimConnect
- Documentation: https://simconnect.readthedocs.io/
- License: AGPL 3.0
-
Latest release: 0.4.26
published about 4 years ago
Rankings
Maintainers (1)
Dependencies
- black * develop
- pylint * develop
- pytest-cov * develop
- flask *
- appdirs ==1.4.4 develop
- astroid ==2.4.2 develop
- atomicwrites ==1.4.0 develop
- attrs ==20.1.0 develop
- black ==20.8b1 develop
- click ==7.1.2 develop
- colorama ==0.4.3 develop
- coverage ==5.2.1 develop
- iniconfig ==1.0.1 develop
- isort ==5.5.1 develop
- lazy-object-proxy ==1.4.3 develop
- mccabe ==0.6.1 develop
- more-itertools ==8.5.0 develop
- mypy-extensions ==0.4.3 develop
- packaging ==20.4 develop
- pathspec ==0.8.0 develop
- pluggy ==0.13.1 develop
- py ==1.9.0 develop
- pylint ==2.6.0 develop
- pyparsing ==2.4.7 develop
- pytest ==6.0.1 develop
- pytest-cov ==2.10.1 develop
- regex ==2020.7.14 develop
- six ==1.15.0 develop
- toml ==0.10.1 develop
- typed-ast ==1.4.1 develop
- typing-extensions ==3.7.4.3 develop
- wrapt ==1.12.1 develop
- click ==7.1.2
- flask ==1.1.2
- itsdangerous ==1.1.0
- jinja2 ==2.11.2
- markupsafe ==1.1.1
- werkzeug ==1.0.1
- atomicwrites ==1.4.0
- attrs ==20.1.0
- colorama ==0.4.3
- coverage ==5.2.1
- iniconfig ==1.0.1
- more-itertools ==8.5.0
- packaging ==20.4
- pluggy ==0.13.1
- py ==1.9.0
- pyparsing ==2.4.7
- pytest ==6.0.1
- pytest-cov ==2.10.1
- six ==1.15.0
- toml ==0.10.1
- actions/checkout master composite
- actions/setup-python v1 composite
- pypa/gh-action-pypi-publish master composite