Trigger an n2k switch via a url?
Is there any way to trigger a switch via a url?
I have terminal only access to the n2k server as I shut my router down by accident. Is there a way I can send PGN 126208? By hitting a SignalK url or the likes?
10 Replies
So you can’t bring up the sk admin console?
I am getting in via peplink in touch on another router that is connecting into the WiFi. For whatever reason the admin console doesn’t render too well and the data browser is blank.
I tried via chrome, still no great control panel, but I do get the data fiddler to show up, but not sure if it’s functional.
You can send a PUT request or n2k via Data Fidler
You can also send a PUT from the command line
curl -X PUT \
http://localhost:3000/signalk/v1/api/vessels/self/steering/autopilot/targetHeadingMagnetic \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-d '{
"value": 1.5708
}'
value would be 1 for a switch
To get a Bearer token: https://demo.signalk.org/documentation/setup/generating_tokens.html
Generating tokens - Signal K Server Documentation
A Guide for users and developers.
(That of course assumes you have n2k switching plugin on and working)
Bank 11 switch 4 would be something like this? http://localhost:3000/signalk/v1/api/vessels/self/electrical/switches/bank/11/4 ?
Yes, but add /state
"PUT not supported for electrical.switches.bank.11.4.state” 😦
Would happen when the n2k switching plugin is not running
I’ll have to take a look at that when I drive out since that sounds like the path now 🙂