Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add ability to put starlink status over NMEA 2000 as a switch. #1

Open
netgoof opened this issue Jul 15, 2024 · 1 comment

Comments

@netgoof
Copy link

netgoof commented Jul 15, 2024

I took a copy of your plugin a long while back and added the ability to send the status of the dish as a switch (on/off). That way we could see the status as green/red on our maretron screen. Would you be opposed to adding it to the main branch?

It would be something like below. The code sends it out for switch instance 2. That should probably be configurable.

const SWITCHORDER = 'electrical.switches.bank.2.1.order'
const SWITCHSTATE = 'electrical.switches.bank.2.1.state':

function sendState() {
    //send status update 127501
    const pgn = {
        pgn: 127501,
        "Instance": 2
    }

    pgn[`Indicator${1}`] = dishyStatus === "online" ? 'On' : 'Off'

    app.debug('sending pgn %j', pgn)
    app.emit('nmea2000JsonOut', pgn)

    let values;

    values = [
        {
            path: `${SWITCHORDER}`,
            value: 1
        },
        {
            path: `${SWITCHSTATE}`,
            value: dishyStatus === "online" ? 1 : 0
        }
    ];

    app.handleMessage('signalk-starlink', {
        updates: [
            {
                values: values
            }
        ]
    });

}

Maretron

@itemir
Copy link
Owner

itemir commented Jul 16, 2024

Hi, thanks for the note. PGN 127501 seems generic enough and using it to indicate status of Starlink makes sense to me. It should be optional though and enabled from the plugin settings with a configurable instance ID as you point out. Feel free to submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants