Community discussions

MikroTik App
 
diablonet
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 67
Joined: Wed Jan 05, 2011 3:33 am

Mikrotik Starlink Stow button action

Fri Jun 02, 2023 11:06 pm

Hello, I own a Mikrotik Router (with MODE button), I use it with a starlink in ethernet bypass mode, so I want to make a script to STOW the antenna with a script or pressing the MODE button, any suggestion on how to make this? thank you in advance.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Mikrotik Starlink Stow button action

Fri Jun 02, 2023 11:30 pm

Theoretically possible... But the issue is that Starlink uses https://grpc.io instead of more normal REST API. gRPC to starlink uses these binary blobs called protocol buffers so not easy as it might sound to call /tool/fetch to do this. Be useful. It works from from a real OS with some libraries, so if you have a container support, but again not a direct path either.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Mikrotik Starlink Stow button action

Fri Jun 02, 2023 11:43 pm

Sorry, I don't know Starlink, but the command is for ROTATE the antenna or for CLOSE the antenna, or for FOLD UP the antenna?
Or for STOW the antenna, what really is mean?
Thank you.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Mikrotik Starlink Stow button action

Fri Jun 02, 2023 11:52 pm

Normally the dish points to the north at ~45º to the mount. Since the head on the dish/pole moves, you can move to ~15% so it fits in the box (or drop snow/debree from the dish since it can become almost flat). That action is called "stow" – actually a common term for satellites.

But the binary protbufs in gRPC are the issue – not as hard as SMS PDUs but not one-line. ;)

There's libraries for various languages like Go, Node, etc for gRPC – but in RouterOS not so lucky...
Last edited by Amm0 on Fri Jun 02, 2023 11:54 pm, edited 1 time in total.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Mikrotik Starlink Stow button action

Fri Jun 02, 2023 11:54 pm

Thanks for the info, I do not have Starlink, I'm the WISP of myself :lol: :lol: :lol:
Had it, I would have tried something with containers indeed...
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Mikrotik Starlink Stow button action

Sat Jun 03, 2023 12:21 am

Thanks for the info, I do not have Starlink, I'm the WISP of myself :lol: :lol: :lol:
Had it, I would have tried something with containers indeed...
Yup. I use a container to pull signal data from them, but I've never tried any operations.

All of the ones I manage are remote, so the "stow" will lose the signal – so not easy to test even ;).
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Mikrotik Starlink Stow button action

Sat Jun 03, 2023 12:36 am

So in places closer to the equator do storks nest on top of it? :lol: :lol: :lol:
 
diablonet
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 67
Joined: Wed Jan 05, 2011 3:33 am

Re: Mikrotik Starlink Stow button action  [SOLVED]

Sat Jun 03, 2023 1:29 am

thank you for the help, I managed to make it with the following settings:

-The Mikrotik/Starlink connects to my L2TP main connection on fixed VPN IP address, I own also a linux box with apache/PHP.

So I made a PHP with the following code:
<?php
$cmd = $_GET['cmd'];

if ($cmd == "stow") {
#   echo "ok";
   shell_exec('grpcurl -plaintext -d {\"dish_stow\":{}} starlinkipvial2tp:9200 SpaceX.API.Device.Device/Handle');
} else {
#    echo "error";
    }
?>
Note that I am using grpcurl, you can download it somewhere, also, pre compiled versions.

On the Mikrotik / starlink side, I have the following setting:
/ip firewall nat add action=dst-nat chain=dstnat comment="Stow via VPN" dst-port=9200 in-interface=L2TP-VPN protocol=tcp to-addresses=192.168.100.1 to-ports=9200
/system routerboard mode-button set enabled=yes on-event="/log error \"Mode button pressed, executing Stow...\"\r\
    \n/tool fetch url=\"http://linux-ip/sl.php\?cmd=stow\""
It works that way but maybe there is a simpler way to archive this, thank you again
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3169
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Mikrotik Starlink Stow button action

Sat Jun 03, 2023 5:15 pm

Note that I am using grpcurl, you can download it somewhere, also, pre compiled versions.
Yeah I use "grpcurl" too. https://github.com/fullstorydev/grpcurl
It works that way but maybe there is a simpler way to archive this, thank you again
I think that's best you can do. While I use container, that part isn't important. I also do NAT'ing to 192.168.100.1 to get them remotely (and since I have multiple starlinks give each different IP within mgmt IP subnet).

In my case, the only downside to "grpcurl" is that make a >30Mb container. With Go language... could theoritically compile just the starlink gRPC bindings (not all of grpcurl) with the Go https server into a container – that be smaller. But I just accepted a bigger container to do this. There is also another container https://github.com/danopstech/starlink_exporter that does monitoring to Promethesis – that could be adapted to support "stow" since they run a web server.

But as for a "mode button to stow", I think that's about as simple as you could make, given spacex [dumb] usage of gRPCs. Also pretty nifty since you need to stow to move it & using the app isn't as easy as "one touch" on the Mikrotik.
 
diablonet
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 67
Joined: Wed Jan 05, 2011 3:33 am

Re: Mikrotik Starlink Stow button action

Sat Jun 03, 2023 8:37 pm

Thank you Amm0 for your help and suggestions, at least it works on a "tricky" way, greetings

Who is online

Users browsing this forum: Rhydu and 17 guests