Replies: 8 comments 4 replies
-
You could write a quick script to change the value in the config file and restart signalk when dhcp connects to a network. Have any experience with shell scripting? Brad Harley. — Sent from my iPhoneOn Sep 20, 2024, at 13:57, jimseng ***@***.***> wrote:
Hello. I suspect this is going to need user intervention but I thought I would ask about an issue I have with my setup. I am using a Pi 5 and for me I find it better to use my phone as a hotspot and connect my Pi5/signalK system to it as I can maintain data connectivity on the phone and receive AIS/nmea/Seatalk over UDP from signalK at the same time. Basically it means I can still watch cat videos and keep an eye out for vessels on AIS with Navionics at the same time. The trouble is Google, in its infinite wisdom-may peace be forever upon it, has decided not to allow users to set the ip address range served by the hotspot and further more has decided that what we all really want is for the subnet to change on a regular basis. This means that I have to set the broadcastAddress setting when I notice that the Pi has picked up the new subnet when connecting to the hotspot. (Or change the paired device setting in Navionics). It isn't a big deal but it is annoying and I wondered if anyone had any thoughts. The drop down broadcastAddress option shows the detected subnet, might there be a way of manually editing that, or tying it to a particular interface (wlan0)?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Well I am answering my own questions here, but that's ok, maybe someone will find it interesting. So maybe I can do it with a post URL. With curl from the command line this works (I am absolutely at the limit of my understanding and capabilities here, it's a good job I am on dry land with a dummy setup): curl 'http://192.168.32.5:3000/skServer/plugins/udp-nmea-sender/config' -H 'Accept: /' -H 'Accept-Language: en-US,en;q=0.9' -H 'Connection: keep-alive' -H 'Cookie: JAUTHENTICATION=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImFkbWluIiwiaWF0IjoxNzI2ODcxNjk1fQ.jy5KT2gzgZN0mxqev48h8f5SXC8ukXuCF6MgDoiISz8' -H 'Origin: http://192.168.32.5:3000' -H 'Referer: http://192.168.32.5:3000/admin/' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36' -H 'content-type: application/json' --data-raw '{"configuration":{"destinations":[{"broadcastAddress":"192.168.1.255","port":2000,"nmea0183":true,"nmea0183out":false,"lineDelimiter":"None"}]},"enabled":true}' --insecure So I guess I will have to try and run a script that fetches the subnet and passes this information with a post request. It might be easier to earn enough money to buy google and tell them to change their ways. |
Beta Was this translation helpful? Give feedback.
-
Depending on which version of dhcp you have running, there is an ability to run a script at in new network. Iirc it’s dhcpcd. If you auto hop to a new network like your phone hotspot I don’t think that’s an ifup…. I can look at my system when I get home as I used to do similar things prior to Starlink. If you change the configuration file, you will want to restart signalk with systemctl. Brad Harley. — Sent from my iPhoneOn Sep 20, 2024, at 16:40, jimseng ***@***.***> wrote:
Well I am answering my own questions here, but that's ok, maybe someone will find it interesting. So maybe I can do it with a post URL. With curl from the command line this works (I am absolutely at the limit of my understanding and capabilities here, it's a good job I am on dry land with a dummy setup):
curl 'http://192.168.32.5:3000/skServer/plugins/udp-nmea-sender/config' -H 'Accept: /' -H 'Accept-Language: en-US,en;q=0.9' -H 'Connection: keep-alive' -H 'Cookie: JAUTHENTICATION=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImFkbWluIiwiaWF0IjoxNzI2ODcxNjk1fQ.jy5KT2gzgZN0mxqev48h8f5SXC8ukXuCF6MgDoiISz8' -H 'Origin: http://192.168.32.5:3000' -H 'Referer: http://192.168.32.5:3000/admin/' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36' -H 'content-type: application/json' --data-raw '{"enabled":false}' --insecure
So I guess I will have to try and run a script that fetches the subnet and passes this information with a post request. It might be easier to earn enough money to buy google and tell them to change their ways.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Well so far I have got as far as putting a bash script in /etc/network/if-up.d:
This gets called whenever I plug in an ethernet cable or connect to wifi so I am thinking I could run a python script to update the config file. If there is a better method I would love to know because I am very much feeling my way,
This updates signalK without the need to restart using systemctl (accorording to my tests anyway) although I don't know if the authentication is persistent. I don't know if this is going to work but it would be one less thing to be grumpy about if it does. |
Beta Was this translation helpful? Give feedback.
-
I used dhcpcd hooks on a previous system to launch scripts. I 'believe' but have not tested that if you have wifi enabled and searching for a network using the standard wpa_supplicant config files, when it sees the network it will join and ifup does not get executed as the network is up all the time, just disconnected. I'm not sure how you're connecting though. Regardless, the hooks should work in any network circumstance when it joins a specific hotspot. https://manpages.ubuntu.com/manpages/trusty/man8/dhcpcd-run-hooks.8.html
Your connecting to the server is more graceful than my idea of just changing the config file natively in the filesystem and restarting signalk. Your question about cookie life is a good one, and I have no idea on that. I bet the developers will know though....
Good luck and have fun.
On Sat, Sep 21, 2024, at 12:22 AM, jimseng wrote:
Well so far I have got as far as putting a bash script in /etc/network/if-up.d:
`#!/bin/sh
echo "wifiup" $0 >> /home/pi/testupdown.txt
`
…
This gets called whenever I plug in an ethernet cable or connect to wifi so I am thinking I could run a python script to update the config file. If there is a better method I would love to know because I am very much feeling my way,
I have also tested updating the config file (udp-nmea-sender.json) with the URL :
`$curl 'http://127.0.0.1:3000/skServer/plugins/udp-nmea-sender/config' -H 'Cookie:JAUTHENTICATION=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImFkbWluIiwiaWF0IjoxNzI2ODcxNjk1fQ.jy5KT2gzgZN0mxqev48h8f5SXC8ukXuCF6MgDoiISz8' -H 'content-type: application/json' --data-raw '{"configuration":{"destinations":[{"broadcastAddress":"192.168.1.255","port":2000,"nmea0183":true,"nmea0183out":false,"lineDelimiter":"None"}]},"enabled":false}' --insecure`
This updates signalK without the need to restart using systemctl (accorording to my tests anyway) although I don't know if the authentication is persistent. I don't know if this is going to work but it would be one less thing to be grumpy about if it does.
—
Reply to this email directly, view it on GitHub <#136 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAEHFXGCR5KUMTVRAXFMHOTZXUNERAVCNFSM6AAAAABOS24MKGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANZRGE2DCNY>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thanks. I'll take a look at dhcp hooks. I have managed to create a python script that fetches the wlan0 interface ip address and calls the signalK server with an update for the broadcast address for the nmea UDP plugin. I will try and test it tomorrow. |
Beta Was this translation helpful? Give feedback.
-
The plugin could probably do all this: detect network changes by simply polling and just send to broadcast addresses of all interfaces. |
Beta Was this translation helpful? Give feedback.
-
So for now I think I have attached a temporary solution until an update to the plugin arrives, in case anybody is interested. (python script with .txt extension). |
Beta Was this translation helpful? Give feedback.
-
Hello. I suspect this is going to need user intervention but I thought I would ask about an issue I have with my setup. I am using a Pi 5 and for me I find it better to use my phone as a hotspot and connect my Pi5/signalK system to it as I can maintain data connectivity on the phone and receive AIS/nmea/Seatalk over UDP from signalK at the same time. Basically it means I can still watch cat videos and keep an eye out for vessels on AIS with Navionics at the same time. The trouble is Google, in its infinite wisdom-may peace be forever upon it, has decided not to allow users to set the ip address range served by the hotspot and further more has decided that what we all really want is for the subnet to change on a regular basis. This means that I have to set the broadcastAddress setting when I notice that the Pi has picked up the new subnet when connecting to the hotspot. (Or change the paired device setting in Navionics). It isn't a big deal but it is annoying and I wondered if anyone had any thoughts. The drop down broadcastAddress option shows the detected subnet, might there be a way of manually editing that, or tying it to a particular interface (wlan0)?
Beta Was this translation helpful? Give feedback.
All reactions