×

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

Bi-monthly release with minor bug fixes and improvements

MQTT publisher for INDI

  • Posts: 43
  • Thank you received: 2

Replied by Arnaud on topic MQTT publisher for INDI

Hi,
good point.
I did a first check ...update some methods ...
The Devices list is correct but the device.getProperties() seems not working properly, data look corrupted ....

Still digging.
5 months 1 week ago #97200

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

  • Posts: 262
  • Thank you received: 66

This is some test code I have in indi-allsky which properly returns data...
    def getDeviceProperties(self, device):
        properties = dict()
 
        for p in device.getProperties():
            name = p.getName()
            properties[name] = dict()
 
            if p.getType() == PyIndi.INDI_TEXT:
                for t in p.getText():
                    properties[name][t.getName()] = t.getText()
            elif p.getType() == PyIndi.INDI_NUMBER:
                for t in p.getNumber():
                    properties[name][t.getName()] = t.getValue()
            elif p.getType() == PyIndi.INDI_SWITCH:
                for t in p.getSwitch():
                    properties[name][t.getName()] = self.__state_to_str_s[t.getState()]
            elif p.getType() == PyIndi.INDI_LIGHT:
                for t in p.getLight():
                    properties[name][t.getName()] = self.__state_to_str_p[t.getState()]
            elif p.getType() == PyIndi.INDI_BLOB:
                pass
                #for t in p.getBLOB():
                #    logger.info("       %s(%s) = %d bytes", t.name, t.label, t.size)
 
        logger.warning('%s', pformat(properties))
 
        return properties
5 months 1 week ago #97228

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

  • Posts: 43
  • Thank you received: 2

Replied by Arnaud on topic MQTT publisher for INDI

Hi,
thanks for the help.
I used your function to extract properties... but.. it's crashing still on <code>device.getProperties()</code> ...but it evolved ...now it's a segmentation fault...

Is it possible that the Raspberry Pi3+ don't have enough memory ...

for information i extracted using commands (hecate is my remote server executing indiserver) :
telnet hecate 7624
then
<getProperties version="1.7"/>
<defSwitchVector device="Telescope Simulator" name="ON_COORD_SET" label="On Set" group="Main Control" state="Idle" perm="rw" rule="OneOfMany" timeout="60" timestamp="2023-11-18T09:30:53">
    <defSwitch name="TRACK" label="Track">
On
    </defSwitch>
    <defSwitch name="SLEW" label="Slew">
Off
    </defSwitch>
    <defSwitch name="SYNC" label="Sync">
Off
    </defSwitch>
</defSwitchVector>
<defNumberVector device="Telescope Simulator" name="EQUATORIAL_EOD_COORD" label="Eq. Coordinates" group="Main Control" state="Idle" perm="rw" timeout="60" timestamp="2023-11-18T09:30:53">
    <defNumber name="RA" label="RA (hh:mm:ss)" format="%010.6m" min="0" max="24" step="0">
7.4151005755258916352
    </defNumber>
    <defNumber name="DEC" label="DEC (dd:mm:ss)" format="%010.6m" min="-90" max="90" step="0">
90
    </defNumber>
</defNumberVector>
<defSwitchVector device="Telescope Simulator" name="TELESCOPE_ABORT_MOTION" label="Abort Motion" group="Main Control" state="Idle" perm="rw" rule="AtMostOne" timeout="60" timestamp="2023-11-18T09:30:53">
    <defSwitch name="ABORT" label="Abort">
Off
    </defSwitch>
</defSwitchVector>
<defSwitchVector device="Telescope Simulator" name="TELESCOPE_TRACK_MODE" label="Track Mode" group="Main Control" state="Ok" perm="rw" rule="OneOfMany" timeout="0" timestamp="2023-11-18T09:30:53">
    <defSwitch name="TRACK_SIDEREAL" label="Sidereal">
On
    </defSwitch>
    <defSwitch name="TRACK_SOLAR" label="Solar">
Off
    </defSwitch>
    <defSwitch name="TRACK_LUNAR" label="Lunar">
Off
    </defSwitch>
    <defSwitch name="TRACK_CUSTOM" label="Custom">
Off
    </defSwitch>
</defSwitchVector>
<defSwitchVector device="Telescope Simulator" name="TELESCOPE_TRACK_STATE" label="Tracking" group="Main Control" state="Idle" perm="rw" rule="OneOfMany" timeout="0" timestamp="2023-11-18T09:30:53">
    <defSwitch name="TRACK_ON" label="On">
Off
    </defSwitch>
    <defSwitch name="TRACK_OFF" label="Off">
On
    </defSwitch>
</defSwitchVector>
<defNumberVector device="Telescope Simulator" name="TELESCOPE_TRACK_RATE" label="Track Rates" group="Main Control" state="Ok" perm="rw" timeout="60" timestamp="2023-11-18T09:30:53">
    <defNumber name="TRACK_RATE_RA" label="RA (arcsecs/s)" format="%.6f" min="-16384" max="16384" step="9.9999999999999995475e-07">
15.04106717867020393
    </defNumber>
    <defNumber name="TRACK_RATE_DE" label="DE (arcsecs/s)" format="%.6f" min="-16384" max="16384" step="9.9999999999999995475e-07">
0
    </defNumber>
</defNumberVector>
<defSwitchVector device="Telescope Simulator" name="TELESCOPE_MOTION_NS" label="Motion N/S" group="Motion Control" state="Idle" perm="rw" rule="AtMostOne" timeout="60" timestamp="2023-11-18T09:30:53">
    <defSwitch name="MOTION_NORTH" label="North">
Off
    </defSwitch>
    <defSwitch name="MOTION_SOUTH" label="South">
Off
    </defSwitch>
</defSwitchVector>
it looks good...

I will try to use a debugger to find root cause of this segfault...
Last edit: 5 months 1 week ago by Arnaud.
5 months 1 week ago #97238

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

  • Posts: 43
  • Thank you received: 2

Replied by Arnaud on topic MQTT publisher for INDI

Ok i give up. Anyway .... I share all information.

Aaron i tried, your code, but the problem is the same about getProperties() function.

I use pdb to debug a little bit more....not too much more information :
indi-mqtt: AD - getDeviceProperties
Fatal Python error: Segmentation fault
 
Thread 0x74b9e440 (most recent call first):
  File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 1150 in _loop
  File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 1756 in loop_forever
  File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 3591 in _thread_main
  File "/usr/lib/python3.7/threading.py", line 865 in run
  File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap
 
Current thread 0x76effb40 (most recent call first):
  File "/home/pi/.local/lib/python3.7/site-packages/PyIndi.py", line 1279 in getProperties
  File "indi-mqtt.py", line 319 in getJSON
  File "indi-mqtt.py", line 523 in <module>
Erreur de segmentation
(you recognize segmentation fault, in french)

line 1279 of PyIndi is ...
def getProperties(self, *args):
        return _PyIndi.BaseDevice_getProperties(self, *args)

I also tried the example here in Getting Started (github.com/indilib/pyindi-client)
I use indiserver with simulators (telescope, ccd, guide, ...) . And it works ... but don't likes the telescope simultator property, next after GUIDE_RATE...
I don't understand why.
2023-11-19 14:01:22,733 new property TELESCOPE_TIMED_GUIDE_NS as INDI_NUMBER for device Telescope Simulator
2023-11-19 14:01:22,734 new property TELESCOPE_TIMED_GUIDE_WE as INDI_NUMBER for device Telescope Simulator
2023-11-19 14:01:22,734 new property GUIDE_RATE as INDI_NUMBER for device Telescope Simulator
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/PyIndi.py", line 1093, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, BaseClient, name)
  File "/home/pi/.local/lib/python3.7/site-packages/PyIndi.py", line 80, in _swig_getattr
    raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
AttributeError: 'BaseClient' object has no attribute 'newText'
5 months 1 week ago #97270

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

  • Posts: 262
  • Thank you received: 66
Well, I did strip out a comment from my code...
### Causing a segfault as of 8/25/22


I do not recall which version of indi I was running, probably 1.9.8. What version of INDI do have have installed?
Last edit: 5 months 1 week ago by Aaron Morris.
5 months 1 week ago #97281

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

  • Posts: 43
  • Thank you received: 2

Replied by Arnaud on topic MQTT publisher for INDI

Good comment :-)

Seems i use version 1.9.7
Checking why i'm using so old release...why it didn't upade...

edit : it's the last version available on raspbian buster
Last edit: 5 months 1 week ago by Arnaud.
5 months 1 week ago #97285

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

  • Posts: 262
  • Thank you received: 66

My guess is you are using Astroberry. Unfortunately, Astroberry is not currently maintained and is stuck on a very old release of INDI.

I pulled down indi-mqtt and tested it on INDI 2.0.4 and it seemed to run fine. The code is in need of some maintenance and updates, though. I may consider trying to maintain my own fork.
5 months 1 week ago #97286

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

  • Posts: 43
  • Thank you received: 2

Replied by Arnaud on topic MQTT publisher for INDI

ok. thanks.
so this evening i will try to install by myself the 2.0.4, then retry.
5 months 1 week ago #97287

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

  • Posts: 43
  • Thank you received: 2

Replied by Arnaud on topic MQTT publisher for INDI

Hi,
compilation 2.0.4 is not working :-/
So i gave up the installation on rapsbian...and used another computer under Ubuntu...and indi-mqtt works perfectly ...
So the problem was the version of indilib...
Thanks for your help.
5 months 6 days ago #97309

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

Moderators: Radek Kaczorek
Time to create page: 0.507 seconds