I need to write a script that automates Kstar and Ekos to start, connect devices, start sequence and so on..
For now I’m at the beginning, and this is my code:
import os
import logging
import time
import shlex, subprocess
import sys
from dbus import glib
glib.init_threads()
import dbus
bus = dbus.SessionBus()
def open_ekos_window(bus):
kstars = bus.get_object("org.kde.kstars", "/KStars")
main_window = dbus.Interface(kstars, 'org.kde.KMainWindow')
main_window.activateAction('ekos')
ekos_object = bus.get_object("org.kde.kstars", # Connection name
"/KStars/Ekos" # Object's path
)
# Get Ekos interface
E_iface = dbus.Interface(ekos_object, 'org.kde.kstars.Ekos')
# Start Ekos
E_iface.start()
def main():
open_ekos_window(bus)
if __name__ == '__main__':
main()
I use the astroberry OS, where the INDI drivers are automatically started at the beginning.
So far so good, but now I would to get the status of the single devices the to perform some checks. And after load some scheduler to start some sequence.
I can connect, checks the connection and also set the camera properties through the indi dbus interface.
Now I need to use some special functionality of ekos, like the autofocus. Looking in the introspection file of ekos, I didn't find any method that start the autofocus routine.
By now, the only way that came to mind is to load a scheduler with the autofocus setp selected. But is there another method? Maybe more simply and more "command line" like?
I try to look at the API reference of Kstars and Ekos, but I think that the methods reported are only valid for C language and not for python bindings.
One thing that seems obvious but that I hadn’t realized before, was that the functionality that you want reach through DBus must be already active. I thought instead that it was enough to be present in the functionality of the parent program.
If I will meet another problem I will post here, hoping to make this discussion another help for the scripting and development section of Kstars/Ekos.