Enzo created a new topic ' I want help to build an Indi client.' in the forum. 4 months ago

Hello astronomers,
I'm currently building an Indi client.

I need to use Node.js to connect to the Indi server, and I use the indi-client library ( www.npmjs.com/package/indi-client ), but nothing works.

Can someone help me ?

Here is my code :

const { newSwitchVector, INDIClient } = require("indi-client");

const indiHost = process.env.INDI_HOST || "127.0.0.1";
const indiPort = process.env.INDI_PORT ? parseInt(process.env.INDI_PORT) : 7624;

const indiClient = new INDIClient(indiHost, indiPort);

indiClient.on("connect", () => {
  console.log("indi connection connected");

  // You may need to adjust the target coordinates
  const targetRA = 11.04; // Replace with your desired RA coordinate
  const targetDec = 79.678; // Replace with your desired Dec coordinate

  // Create a newNumberVector object for the telescope coordinates
  const slewCommand = new newSwitchVector(
    "ASCOM OnStep Telescope",
    "TELESCOPE_MOTION_NS",
    new Date(),
    [
      {
        name: "MOTION_NORTH",
        value: "On",
      },
      {
        name: "MOTION_SOUTH",
        value: "Off",
      },
    ]
  );

  console.log(slewCommand);

  // Send the slew command to the telescope
  indiClient.send(slewCommand);
});

indiClient.on("close", () => {
  console.log("indi connection closed");
});

indiClient.connect();

It starts as expected, and send a command to the server, but my mount isn't moving. I don't know what to do…
Here is what i get in the wINDI console :
I run my Indi server on Windows using wINDI, and I tested the server with Stellarium and everything is working perfectly, my mount is moving as expected.

Thank you per advice,
Astronomically,

Zoliex :)

Read More...