×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Scripting with Indi

  • Posts: 62
  • Thank you received: 8

Scripting with Indi was created by Steve

Hi there,

I just received the DragonFly from Lunatico ans started playing with it. I connected a light and a little motor (an fan) to relays and a proximity sensor.

The Indi driver in Kstars let's you turn on/off the relays and the sensor works well also.

Now I'd like to control the relays programmatically. After some research on the Net, I found the pyindi-client , which I installed (I'm doing all my tests on Kubuntu in a virtual environment).
There is a testindiclient.py script included in the library that I'm trying to tweak with my limited Python skills.
I managed to get the states (not sure about the exact naming/nomenclature) of the relays, but I fail to change them.
I basically would like to turn on the light if it's off, and vice versa. Or turn the motor on when the sensor get's triggered by a magnet. Very basic things I guess.

The problem is that there is no real and complete documentation out there (or I didn't find it).

My questions are:

- is this the right approach for scripting?
- if yes, how can I change states in python so to switch things on/off?
- is there others docs than the examples provided in pyindi-client?

Thanks for any help!

steve
5 months 6 days ago #97306

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

  • Posts: 261
  • Thank you received: 66

Replied by Aaron Morris on topic Scripting with Indi

pyindi-client is probably the way to go, but as you have discovered, it has a bit of a learning curve. One of the challenges is pyindi-client is basically a thin C++ interface, so it can be somewhat "unpythonic" at times. You do not have full introspection capabilities, meaning you have to look at the indi library C++ documentation to know what properties and methods are available.

I have some basic INDI examples in the testing folder of indi-allsky.

This is the most basic and has examples of how to set number, text, and switch properties:
github.com/aaronwmorris/indi-allsky/blob...esting/indi_basic.py

This has many more helper functions to be able to set configuration values by name:
github.com/aaronwmorris/indi-allsky/blob...ting/exposureTest.py
The following user(s) said Thank You: Jasem Mutlaq
5 months 5 days ago #97321

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

Replied by Jasem Mutlaq on topic Scripting with Indi

There are generally two approaches:

1. Using indi_setprop and indi_getprop scripts from Bash (or other languages)
2. Using pyindi-client which offers a lot more capability than #1

pyindi-client could probably use better examples for beginners
The following user(s) said Thank You: Steve
5 months 5 days ago #97322

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

  • Posts: 62
  • Thank you received: 8

Replied by Steve on topic Scripting with Indi

Thanks Aaron, I'll have a look to the examples.
5 months 5 days ago #97323

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

Time to create page: 0.539 seconds