BasicStation Remote Command and BasicStation Remote Shell features

How can I try BasicStation Remote Command and BasicStation Remote Shell new features?

In the latest release, you can use this by sending payloads to the ..../command/raw MQTT topic. The payload must be in the format as documented by the BasicStation documentation:

{
  "msgtype"  : "runcmd"
  "command"  : STRING,
  "arguments": [ STRING, ... ]
}

https://doc.sm.tc/station/tcproto.html#remote-command

The response is returned on the .../event/raw MQTT topic. Note that the payload you are sending is forwarded AS-IS over the WebSocket connection. In some cases you need to use JSON, in some cases it is a binary payload. See for example for the remote shell:

After the session is established, the input data towards the shell and the output data generated by the shell and its commands are tunneled through the websocket as binary records. The first byte of the binary record is the session index since Station can maintain multiple sessions. The remaining bytes of a binary record are the input/output data. The encoding is transparent to the websocket transport.

This is all documented in the BasicStation documentation :slight_smile:

1 Like

@brocaar

what is the use case of Remote Shell in basic station or LNS side?

So that you can open a remote shell on your gateway over websockets :slight_smile: Personally Iā€™m not sure if this is a good idea. E.g. when the Basic Station forwarder runs under its own user, it might not be able to execute the commands that you want to execute. This feature is Basic Station specific and I tried to support this in the most generic way.

2 Likes