lari - @Scott Bender : In regards to signalk-n2...
@Scott Bender : In regards to signalk-n2k-switching-emulator plugin, am I able to control n2k switch with a PUT request against the signalk path, such as this (that comes via PGN 127501)? "electrical.switches.bank.1.1.state"
I'm asking because KIP doesn't seem to get a valid response, but instead: "Toggle Widget Switch Panel Label: Did not receive change confirmation"
64 Replies
ah okay so the response for put request is "PENDING"...
You don’t mean the emulator plugin, right? n2k-switching?
Do you have the latest KIP? I think there was a fix related to this.
I do think I have the latest KIP
maybe it's about my n2k device, lemme verify that first in node-red 😛
Which n2k adapter are you using? And make sure your Data Connection is using canboatjs, not canboat
I'm using canboatjs and receiving data just fine
n2k adaptor?
If I remember correctly, it's the one from Waveshare
2 channel, isolated
so must be with mcp2515 controller
Ok. That should work fine. (It’s what I use)
You’re not using the emulator plugin, right?
I'm trying to use the emulator, yes
I don’t think you want that
because without it, KIP informed that the path does not support PUT
You need signalk-n2k-switching
then I thought that maybe because it's a n2k-based path, it might not support put at all
The emulator emulates an n2k switching devices.
But you have real n2k switching hardware, right?
actually I was wrong about the plugin

yea so I've got a custom (rather experimental) n2k device listening to 127501
https://github.com/plektra/vega-n2k-node1/blob/main/src/main.cpp#L215-L232
After the plugin sends the request to switch, It waits to see a message from n2k device showing the new state
yea, seems that it's not receiving anything which could reflect the fact of a defect in my n2k device 😛
It’s just looking at the path in sk, so you can check by looking in data browser.
sure
it's sending data just fine
But when you switch on, does the state change to 1 there?
nope 😛
You code looks good at a high level, you send out the status after switching.
is there a way to track the individual request
You can get some more info by turning on debug for the that plugin.
You can also turn on debug for signalk-server:put
Yeah, so your device is not sending out an update showing the switch off
wait
That looks like it worked
The path does show that it is off
And SUCCESS
but I'm trying to turn 0 -> 1
Hmm. But you can see it’s sending “Off”
So why is KIP sending off?
Let me double check with KIP here…
well actually I was calling sk api directly with curl in this case
sending PUT with ....
-d '{"value": "1"}' "http://vuosaari:8080/signalk/v1/api/vessels/self/electrical.switches.bank.1.1.state"
Oh. Don’t put the 1 in quotes
doesn't help without
Let’s see the debug log without it
ok have to give some attention to the baby, BBL and thanks so far
Ok, so no update was sent by the device to confirm that it is on.
Oh. You’re not listening for the correct pgn on the device.
127502
Looks like you are listening for 127501
oh hmm
127502 for receiving, right?
Yes
ok cool, let's see if my OTA still works after years 🙂
topic for another thread btw, but running KIP in same browser session with Signal-K server admin console seems to mess up the session if I'm trying to stay logged in with
admin
user in sk-server and another user in KIP
signalk-server seems to think I'm logged in as kip user in the admin console tooYes, they use the same auth info. It’s a COOKIE.
sure
There may be a way to deal with it in Kip, but I doubt it. You might want to ask on #kip
what was the format of the payload for sending nmea2000 messages in node-red? Mind sharing an example as I've lost my notes... :/
It’s the canboat json format
You trying to send 127502? I can give you an example
well I've got a pgn for triggering a reboot on the node/device for OTA update
an empty message to 61200 should be fine
there's no support for 61200 in canboat
this might work:
oh hmm, it's been a few years and can't remember how did I send the message then other than from node-red using the embedded stuff
maybe from command line then
2018-05-03T19:00:00.526Z,7,61200,4,255,8,ff,ff,ff,ff,ff,ff,ff,ff
where 255 is the device src/idumm stupid question, but can I use canboatjs to send that over to the bus?
never actually sent raw messages
Use can use node-red, or if you have the 2.9.0+ of the server, you can send it in the Data Fidler
ah nice
njah, probably misconfigured wifi credentials on the device EEPROM, as OTA update doesn't work anymore ;_;
well anyways I think I know what to do next, so thanks a lot Scott!
Welcome
I can't find anywhere an example of a node-red canboat json formatted payload for sending nmea2000 sentences, any tips?
You can send a string like I pasted above
or for known pgns
you can see lots of examples here: https://github.com/canboat/canboatjs/tree/master/test/pgns
GitHub
canboatjs/test/pgns at master · canboat/canboatjs
Native javascript NMEA 2000 decoder and encoder. Contribute to canboat/canboatjs development by creating an account on GitHub.
cool thanks
Details of all the pgns here: https://canboat.github.io/canboat/canboat.html
yea ofc the pgn needs to be configured in canboat in order to use the json format
yep
the string format can be used otherwise
2018-05-03T19:00:00.526Z,7,61200,4,255,8,ff,ff,ff,ff,ff,ff,ff,ff
been a while, but I think I added some custom code for that earlier for my custom pgn but can't find it anywhere anymore
FYI I was able to change the switch state from Off to On using 127501 due to my bug in the node config (listening to 127501 for changes) so it's somewhat working
I'm just not able to update the code on the esp32 OTA right now so need to go on site to fix it
You could implement a put in node-red with a different path. Then that would work in Kip.
not worth it I guess
Highly leaning towards setting up any new custom devices with n2k but instead with wifi + signalk communication
I mean NOT setting up n2k devices
I would do the same
my only worry has been wifi so I just need to get over it
the thought has been strong about having everything in copper in order to provide stability