×

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

Bi-monthly release with minor bug fixes and improvements

MQTT publisher for INDI

  • Posts: 64
  • Thank you received: 9

Replied by Ray on topic MQTT publisher for INDI

Thank Yo Kaczorek, I was running pyindi-client 0.2.3 after upgrading to 0.2.4 mqtt broadcast installs and runs as expected. Thanks again.
4 years 3 months ago #46949

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

  • Posts: 41
  • Thank you received: 2

Replied by Arnaud on topic MQTT publisher for INDI

Thanks Radek for this job for the community.
I'm working on raspbian.
I tried to install indi-mqtt as explained...passed each steps...but the two last ...the indi-mqtt.service don't start correctly.
Status command gives :
sudo systemctl status indi-mqtt.service
indi-mqtt.service - INDI MQTT
   Loaded: loaded (/etc/systemd/system/indi-mqtt.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sun 2023-11-12 23:13:17 CET; 8s ago
  Process: 15871 ExecStart=/usr/bin/python3 /usr/bin/indi-mqtt.py (code=exited, status=1/FAILURE)
 Main PID: 15871 (code=exited, status=1/FAILURE)

No errors displayed on previous command...
Any idea ?

Thanks for your help.

Edit : after reinstall restart etc ....new kind of errpr
sudo systemctl status indi-mqtt.service
indi-mqtt.service - INDI MQTT
   Loaded: loaded (/etc/systemd/system/indi-mqtt.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: signal) since Sun 2023-11-12 23:39:35 CET; 3s ago
  Process: 23985 ExecStart=/usr/bin/python3 /usr/bin/indi-mqtt.py (code=killed, signal=SEGV)
 Main PID: 23985 (code=killed, signal=SEGV)


Edit2 : another try :
sudo python3 indi-mqtt.py -l
indi-mqtt: Using configuration from /etc/indi-mqtt.conf
indi-mqtt: Starting in auto refresh mode in every 10 seconds.
indi-mqtt: Creating an instance of INDI client
indi-mqtt: Connected to MQTT server ether:1883
INDI::BaseClient::connectServer: creating new connection...
INDI::BaseClient::connectServer: Already connected.
indi-mqtt: Subscribed to observatory/poll topic at MQTT server ether:1883
indi-mqtt: Connected to INDI server ether:7624
malloc(): unsorted double linked list corrupted
Abandon
Last edit: 4 months 2 weeks ago by Arnaud.
4 months 2 weeks ago #97118

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

  • Posts: 41
  • Thank you received: 2

Replied by Arnaud on topic MQTT publisher for INDI

i understand a little bit better what's happening, indi-mqtt seems to crash when it starts to communicate with my indiserver, which is not running on localhost, but on another host (i tried hostname, IP...)....
is there a way to know what make indi-mqtt crash, to have some logs or kind of heap ....?
Last edit: 4 months 1 week ago by Arnaud.
4 months 2 weeks ago #97143

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

  • Posts: 41
  • Thank you received: 2

Replied by Arnaud on topic MQTT publisher for INDI

Hi all, still digging ....
I checked my indiserver is working correctly with telnet ...it works ...

Then with adding some trace and executing this command :
sudo python3 /usr/bin/indi-mqtt.py -l
indi-mqtt: Using configuration from /etc/indi-mqtt.conf
indi-mqtt: Starting in auto refresh mode in every 10 seconds.
indi-mqtt: Creating an instance of MQTT client
indi-mqtt: AD - LOOP END
indi-mqtt: Creating an instance of INDI client
indi-mqtt: Connected to MQTT server localhost:1883
indi-mqtt: AD - instance indiclient
indi-mqtt: AD - befor the loop
indi-mqtt: Subscribed to observatory/poll topic at MQTT server localhost:1883
INDI::BaseClient::connectServer: creating new connection...
INDI::BaseClient::connectServer: Already connected.
indi-mqtt: Connected to INDI server hecate:7624
indi-mqtt: AD - DEVICES
indi-mqtt: AD - observatory_json
indi-mqtt: AD - 33792
indi-mqtt: AD - device_nameLIGHT_PANEL_SIMULATOR
indi-mqtt: AD - device_name_json{}
indi-mqtt: AD - properties<PyIndi.Properties; proxy of <Swig Object of type 'INDI::BaseDevice::Properties *' at 0x74da1da0> >
malloc(): unsorted double linked list corrupted
Abandon

seems something is wrong with the Properties attributes ...Should I rebuild my pyindi-client ?
4 months 1 week ago #97169

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

  • Posts: 255
  • Thank you received: 65
I have not looked at the code myself, but since indi-mqtt is based on python, the [indi-mqtt] codebase has probably not been updated for the new property changes that occurred with INDI 2.0.0.

github.com/indilib/pyindi-client/issues/32
4 months 1 week ago #97171

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

  • Posts: 41
  • 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.
4 months 1 week ago #97200

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

  • Posts: 255
  • Thank you received: 65

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
4 months 1 week ago #97228

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

  • Posts: 41
  • 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: 4 months 1 week ago by Arnaud.
4 months 1 week ago #97238

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

  • Posts: 41
  • 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'
4 months 1 week ago #97270

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

  • Posts: 255
  • Thank you received: 65
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: 4 months 1 week ago by Aaron Morris.
4 months 1 week ago #97281

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

  • Posts: 41
  • 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: 4 months 1 week ago by Arnaud.
4 months 1 week ago #97285

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

  • Posts: 255
  • Thank you received: 65

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.
4 months 1 week ago #97286

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

Moderators: Radek Kaczorek
Time to create page: 0.830 seconds