Open mat214 opened 2 years ago
Very nice idea... There is for sure a couple of ways to achieve this. Maybe as a first shot I will add some key commands to start and stop anchor watch. Then you can assign keys to this command (I will already add some defaults) and use the UDP receive function of the remote channel control to trigger. Drawback of this approach is that you still need a running(!) browser with AvNav open being connected to remote channel 0. But it's fairly easy to use it - and you could also use keys on a device to trigger this. A next/different approach would be to extend the plugin api to allow to set the anchor watch. This would give you the option to write some lines of python code that directly would be controlled by AvNav and call the API on whatever event you like. Advantage: No running browser needed as it runs totally on the server. I guess finally I will go for both. Anchor watch and MOB should be at the plugin api anyway together with some alarm handling stuff
Thank you for this return to my request.
For now, it's a bit obscure to me. I just discovered avnav.
I'm more of a handyman than a coder. But I manage to do things.
I saw that the alarm was triggered with a post http://avnav.local/viewer/avnav_navi.php?request=route&command=setleg and a json
Is it not possible to run a script that activates the alarm? Is it not possible to modify the radius afterwards?
With the current approach you can write a script that send a keycode command via UDP (e.g. using the nc command). It's still not perfect as I wrote - you just need a running browser with AvNav that is connected to remote channel 0. Assuming you have everything set up as default: (1) let your browser listen on remote channel 0 (the remote button will allow to set this - or in settings) (2) run on the pi:
echo 'K i' | nc -w0 -u localhost 34668
This sends the key "i" on AvNav's remote channel 0 - by default configured to switch on anchor watch at the current position.
Until now you cannot cange the radius afterwards. But with some simple steps it should be possible to do what you want: (1) on the navpage click on the lower left displays, that will bring up the additonal waypoint buttons. With anchor watch being active this is only anchor and center (2)click the center button (below anchor) - will center the map at the current anchor position (3) switch of anchor watch (4) switch on anchor watch - (maybe slightly moving the center before) - select the radius and whatever you need and click "center" - this will activate the anchor watch again at the current map center.
Not ideal until now - but was a fast solution. When a new plugin api will be available it's just about some lines of python code to do this. Maybe I will go for some extensions in the features of the UDP interface of the remote channels to also do some things on the server... Finally you may also want to get some response if the action was successful.
You should not try to use a post request as the one you saw - this is some internal API in AvNav and can easily change with some update.
Thanks again for the response. By doing tests and plugging an earphone on my rpi I don't have the sound of the alarms from the server. However the output works with: mpg123 /lib/avnav/sounds/anchorAlarm.mp3
Is it necessary to have a particular configuration to have the sound output of the alarms on the rpi?
Which installation do you use? Is it our headless image? And most probably you are running the latest daily?
I did the headless image install as explained on your site: https://www.free-x.de/raspbian/bullseye/
Ok, I see. I guess I already corrected this. Most probably a new daily will be there today in the evening - this should make the sound working again.
1st step implemented with release 20220421. Use the remote control feature... Next step will be a plugin API.
Hello, Is it possible to trigger anchor monitoring from a script on the position of the boat?
The idea is to trigger this monitoring by pressing a bluetooth remote control like this one: https://www.amazon.fr/gp/product/B07CXFX2HM/ref=crt_ewc_title_oth_1?ie=UTF8&psc=1&smid=A3KRSE5WB004NH
The method exists for signal k: https://github.com/meri-imperiumi/signalk-bluetooth-anchor-button
Thus the crew member who is at anchor presses the button at the right time.
Thanks for your help.