Skybolt - @Scott Bender Your Switching Emulator...
@Scott Bender Your N2K Switching Emulator does seem to work (kind of) for what we were discussing in my other thread. Any chance of supporting momentary switches? Meaning toggle the on/off based on a 1 being received and ignoring the 0.
25 Replies
I don’t see how that plugin relates to the other thread?
I am trying to get the Maretron VMM6 (momentary switches) to work with NMEA2000 standard digital switching. It operates by using PGN 127501. It uses two status channels per switch and toggles the status bits of two channels. Meaning status bits 1 and 2 are used for switch one, values of 0,1 when off. When pressed (or on) the values go to 1,0 of the status bits in the 127501 PGN. So a switch bank of 6 switches will use the first 12 status bytes of PGN 127501. That is what the other thread is ultimately about. You had mentioned that there are plugin's that will handle this already. You were correct, your N2K Switching Emulator works, kind of, but it resets when the status PGN resets.
As you know, N2K switching needs to have momentary switches or devices cannot be turned off/on from multiple locations.
Ok, so you would create a “virtual” switch with the plugin that maps to the real n2k switch, when the virtual switch sees that switch go to 1 , the plugin should look at the current value of the real switch and toggle it on or off?
why did they use 2 bits for this?
Oh man, Maretron seems to do as they like with things. I believe it is there attempt to prioritize their switching system. I couldn't get an answer from Joe Winn on that. But that's how this product works. The VMM6 is quite inexpensive, considering the cost of N2K things, and is the only carling replacement as well as semi programable. With a Maretron USB100 or IPG100 you can configure the VMM6.
So I did create a virtual switch with your plugin and it worked, but resets after it receives the status update from the VMM6. To support momentary switches, you would have to store the value when it becomes 1 and then toggle the 127502 state of the device controlling the actual light (or what ever is being turned on/off).

The above pic is how the emulator is configured. The Maretron VMM6 device is set to an instance of 14. But the switches on the VMM6 are set to 12.x (1-6). The status PGN 127501 is for the VMM6 device instance 14, the instance of the physical VMM6, that controls a standard N2K switching device set to instance 12. Currently the VMM6 only works with Maretron switching. I want to get a plugin to be able to translate what it is doing to be able to use it on a standard N2K switching device. I am currently using an Oceanic Systems 8 channel controller (3478).
The "Other Thread" is my attempt to start writing a plugin for this. Which is sunder way.
So when the emulator gets a message for bank 12 to turn On. It should look at the current value and toggle the switch on 14?
Nope backwards. Instance 12 is the actual switching bank that turns things on/off with PGN127502. The VMM6 is the funky one with double instance(s) and instance 14.

It you have the switching emulator configured as bank 12
I think the second indicator can be ignored. And only the value of the first indicator pair be used. So only toggle on a "On".
That means you have two devices configured as bank 12
I have the emulator configured as the pic above.
It’s emulating bank 12
That means it is sending updates and listening to changes for bank 12
The actual Ocianic Switching device is set to 12. The VMM6 switches are set to respond to instance 12.
I think you are misunderstanding what the emulator does
Your emulator as it stands right now, is responding to the VMM6 instance (14) or path in SK.
It is publish instance 12 changes.
The actual switches of the VMM6 are set to respond to instance 12. When a switch is pressed on th eVMM6, it sends a 127501 for instance 14.
You now have two devices configured as bank 12
Sk is pretending to be a n2k switching device at bank 12
Yes, this is as confusing as it gets. But I am a controls SW engineer and write code for a living. I know how to debug and view this stuff and I couldn't wrap my head around how they did this at first either.
regarding hte emulator - Yes exactly how it should be. But it is also responding to the SK path of 14.x.
Definitely not what the emulator was intended for
Maybe not, but it seems to work that way but doesn't support momentary swtiches.
You can fork that and make it do what you want
I had to try, I knew it was a long shot. I am going to continue on with what I started. I don't want to mess with your code. Might take a look at it, but I will end up with an original PI for SK. If I have the time.
Again, thanks for all of your support and great plugin's. You really have changed how useful SK is for me.
Welcome!
Oh, wanted to mention the path-mapper plugin. Did you see that? You can rename the paths for your banks/switches. Makes them much more readable.
I'll have to check that out. Curious how that works now. Thanks!