×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Properties like CCD_TEMPERATURE within Python

  • Posts: 116
  • Thank you received: 2
How can i get the properties like ccd-temperature within a Python script.
I have this code so far:

import dbus
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)

from gi.repository import GObject as gobject

import os
import time

#


# Create a session bus.
bus = dbus.SessionBus()

# Create an object that will proxy for a particular remote object.
remote_object = bus.get_object("org.kde.kstars", # Connection name
"/KStars/INDI" # Object's path
)

# Introspection returns an XML document containing information
# about the methods supported by an interface.
print ("Introspection data:\n")
#print (remote_object.Introspect())

# Get INDI interface
iface = dbus.Interface(remote_object, 'org.kde.kstars.INDI')
print ("Hello, Python!")


devices = iface.getDevices()

print ("We received the following devices:")
for device in devices:
print (device)
#props = iface.GetAll('org.kde.kstars.INDI')
props = iface.getText("OpenWeatherMap", "WEATHER_TEMPERATURE")
print ("Temperature: ", props)

naam = os.getenv('USER')
#naam = os.getenv(`indi_getprop -1 "OpenWeatherMap.WEATHER_STATUS.WEATHER_TEMPERATURE"`)
print ("The user is:", naam)




But i get the error:

TypeError: More items found in D-Bus signature than in Python arguments

I know how tho get the iface.getPropertyState but i want the data.
Last edit: 3 years 6 months ago by Joshua R.
3 years 6 months ago #59494

Please Log in or Create an account to join the conversation.

Are you writing a Python client for INDI? or you want to connect some some INDI server and change properties? Why are you using KStars DBus interface? Once you select an interface, better stick to using this one. For if you want to use indi_getprop then just use that (along with indi_setprop). For KStars DBus, just use that, do not intermix with INDI set/get props..etc
3 years 6 months ago #59495

Please Log in or Create an account to join the conversation.

  • Posts: 116
  • Thank you received: 2
I just want to build python code to display properties from CCD camera of focusser etc. and in the future maybe to change them.
Do you have an example?
Last edit: 3 years 6 months ago by Joshua R.
3 years 6 months ago #59497

Please Log in or Create an account to join the conversation.

3 years 6 months ago #59501

Please Log in or Create an account to join the conversation.

  • Posts: 116
  • Thank you received: 2
Thanx, i'm currently looking at it and try to get things running.
3 years 6 months ago #59503

Please Log in or Create an account to join the conversation.

Time to create page: 0.846 seconds