Skip to content

Fix usage example & extend by example command response handler#14

Open
dexterbg wants to merge 3 commits intobirkir:masterfrom
dexterbg:master
Open

Fix usage example & extend by example command response handler#14
dexterbg wants to merge 3 commits intobirkir:masterfrom
dexterbg:master

Conversation

@dexterbg
Copy link
Copy Markdown

@dexterbg dexterbg commented Aug 6, 2022

Birkir,

thanks for contributing this NodeJS client implementation, we didn't know about it until now, or we would have added a fork to the OVMS account earlier. Two guys, Gregg Hansen & Pablo Cabrera, are currently using your module to implement a react native app, you're welcome to join the discussion on the developer mailing list:

I found an error in your usage example, also receiving the command results wasn't clear for Gregg & Pablo, so this is the PR to fix that.

It would also be nice if the module would support TLS connections. Possibly Gregg & Pablo can take care of that.

Regards,
Michael

@yusijs
Copy link
Copy Markdown
Contributor

yusijs commented Aug 20, 2022

@dexterbg I was looking into this library, but I'm not able to use it with dexters-web server; is this due to no token authentication on this server?

@dexterbg
Copy link
Copy Markdown
Author

No, the library uses the MP API, not the REST API. It works perfectly with my server, so you probably have an error in your configuration. Maybe you tried connecting to the TLS port? That's not supported by this library yet.

Your client creation should look like this:

const client = new OVMSClient('ovms.dexters-web.de', 6867, 'vehicleid', 'vehiclepassword');

Regards,
Michael

@yusijs
Copy link
Copy Markdown
Contributor

yusijs commented Aug 20, 2022

Edit:

Just as I posted this comment, I got it working. I had to downgrade to node16 for some reason

Original comment No, the creation looks precisely like that (although I did try using TLS first).

Just to keep it as simple as possible I tried this:

client.on('connected', callback => {

console.log('Connected')
    // Send a ping
    // (see https://docs.openvehicles.com/en/latest/protocol_v2/messages.html)
    client.sendRaw('MP-0 A');
});

// connect
client.connect(); // Tried with this both at the start and end

But 'Connected' never gets printed out - the process just terminates without any output. I've tried multiple listeners with the same result (essentially copied the example from this PR), and I get the same result:

[nodemon] restarting due to changes...
[nodemon] starting `ts-node index.ts`
[nodemon] clean exit - waiting for changes before restart

@birkir
Copy link
Copy Markdown
Owner

birkir commented Nov 6, 2023

Dupe of #19 right?

@yusijs
Copy link
Copy Markdown
Contributor

yusijs commented Nov 6, 2023

Yes, I took in these changes as well in #19

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

Successfully merging this pull request may close these issues.

3 participants