Discussion Is it possible to read the remaining Cargo Capacity plus remaining Drones and show it on an external Display ?

Greetings, as a Beginner Project, I would like to have an external Display (Arduino + OLED, Raspberry or another PC) to show the Math of remaining Cargo Capacity + remaining Drones as a little Helper and Indicator how long I can continue Mining :)

After a few hours only finding Trade List readouts and analysers of Logfiles, I want to ask if it is possible (allowed by the API) to read actual data from the ship ?
If yes, where/how can I start doing this ?

Thank you in advance.
 
The official docs are here: https://elite-journal.readthedocs.io/en/latest/Status File/

You can get the total amount of cargo from the status.json and the buy and sell events from the journal - and EDDiscovery also lists "buy drone" and "drone launch" events, so these should be in there somewhere, too.

If you want examples - EDDscovery and EDMC are listed on Github. As is my little AutoHotkey script I use to translate flip switches (toggles) into button presses for ED, depending on the current status https://github.com/markus-i/AHK-EDToggle
 
Greetings, as a Beginner Project, I would like to have an external Display (Arduino + OLED, Raspberry or another PC) to show the Math of remaining Cargo Capacity + remaining Drones as a little Helper and Indicator how long I can continue Mining :)

After a few hours only finding Trade List readouts and analysers of Logfiles, I want to ask if it is possible (allowed by the API) to read actual data from the ship ?
If yes, where/how can I start doing this ?

Thank you in advance.
Maybe a look at EDDI is helpful for you ? EDDI only tells you something about the ship (cargo etc.),
but you can also transfer variables to Voice Attack and process them there.


... and hier is the old VA thread:
 
Last edited:
As above, status.json and the journal files should have all you need. Only downside is that status.json only updates once a second or so (though really, that's only an issue when race tracking :) ).
 
Juhu, the first Prototype works 😄 Thank you all 👏
SerialCargo.jpg


But when I change from ED in Fullscreen to another Window and then go back to ED Fullscreen, the Screen turns black, ED hangs/freezes a Minute till a Crash Report opens and I have to kill the Task. Did I chose a bad way to open and read the file ? When I start the Python Script first, then ED and don't leave the Fullscreen, everything works fine.

Python:
import time
import serial
import json

# https://www.python.org
# https://pypi.org/project/pyserial/

tCargoBay:int = 120  # Later dynamic readout
tCargoLoaded:int = 0

#serialport = serial.Serial('/dev/ttyUSB0', 115200)   # Linux
#serialport = serial.Serial('/dev/cu.usbserial-11240', 115200)  # Mac
serialport = serial.Serial(port="COM3", baudrate=115200)  # Win

serialport.close()  # Just to get a clean state

serialport.open()
#ser.isOpen()    # Causes flickering

time.sleep(2)

serialport.write("9000\n".encode())    # Just for test and show something, it's not over 9000

time.sleep(2)

try:
    while True:

        try:  # If E:D not running no "Cargo" Entry in File
            with open(r"C:\Users\<username>\Saved Games\Frontier Developments\Elite Dangerous\Status.json", 'r') as f:
                data = json.load(f)  #Status.json
            tCargoLoaded=int(float(str(data['Cargo']).encode() ) )
            serialport.write(str(tCargoBay - tCargoLoaded).encode())
            serialport.write("\n".encode())
        except:
            #pass
            serialport.write("-1\n".encode())

        time.sleep(20)
except KeyboardInterrupt: #Ctrl-C (SIGINT)
        time.sleep(2)

serialport.close()
 
Last edited:
Sound more like a problem with changeing out of ED Fullscreen and going back. Try it without starting your script, if it still crashes it's not your script.
 
Sound more like a problem with changeing out of ED Fullscreen and going back. Try it without starting your script, if it still crashes it's not your script.
Agreed. Very hard to believe that a read-only open on the status file could be responsible for crashing the game. (If it is what's crashing the game, I'd blame the game rather than the script :))
Meanwhile, I can never remember for sure, but doesn't the "with" clause in Python automagically close the file anyway?
 
Silly me, I just hit the 4 key and there it is.
Is what and what keys ?

Yes, "with open" works as a context manager, “file.close()” will automatically be called.
Thats a good thing of Python.

A bad thing is, as soon the Python 3.11.1 IDLE is just open, without a running script, ED may crash. Without IDLE is no Problem.
My workaround so far is open CMD(DOS-Box;)), then start it there "python c:\path\script.py", will pack it in a ".bat" later or look for other options.
(Update: Still crashes, but not so often)

Thanks again for the help !
 
Last edited:
Is what and what keys ?
Whenever I'm mining, I keep my 4 panel (the right side panel in the game) on the inventory list. It shows how much cargo you're using, how many limpets I have left and how much of everything I'm presently carrying. I hit the 4 key, that panel pops up, I instantly know everything.
 
Back
Top Bottom