Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/birkir/ovms-client
OVMS client written in TypeScript
https://github.com/birkir/ovms-client
client obdii ovms typescript
Last synced: about 2 months ago
JSON representation
OVMS client written in TypeScript
- Host: GitHub
- URL: https://github.com/birkir/ovms-client
- Owner: birkir
- License: mit
- Created: 2019-12-16T17:08:40.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-09-11T10:19:33.000Z (over 1 year ago)
- Last Synced: 2023-09-11T11:35:11.235Z (over 1 year ago)
- Topics: client, obdii, ovms, typescript
- Language: TypeScript
- Size: 1.77 MB
- Stars: 2
- Watchers: 3
- Forks: 3
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OVMS Client
This is a simple OVMS client written for NodeJS.
## Usage
```js
const { OVMSClient } = require('ovms-client');// host, port, vehicle id, password
const client = new OVMSClient('api.openvehicles.com', 6867, 'DEMO', 'DEMO');
// Note: commands won't work with the DEMO vehicle// connect
client.connect();// subscribe to specific messages:
// status,location,firmware,environment,tpms
// serverAck,commandReceived,pushNotification
// carsConnected,lastUpdated
client.on('status', status => {
console.log('status', status);
});// raw messages
client.on('raw', msg => {
console.log('raw message', msg);
})// command responses:
client.on('commandReceived', response => {
// see https://docs.openvehicles.com/en/latest/protocol_v2/messages.html#command-response-0x63-c
let [ command, result, message ] = response.split(',');
console.log('command', command, 'result', result);
if (message) {
console.log(message.replace(/\r/g, String.fromCharCode(10)));
}
});// wait for connection:
client.on('connected', callback => {// Send a ping
// (see https://docs.openvehicles.com/en/latest/protocol_v2/messages.html)
client.sendRaw('MP-0 A');// Send a shell command
// (see https://docs.openvehicles.com/en/latest/protocol_v2/commands.html)
client.send('7,stat');// Send a lock command using PIN 1234
client.send('20,1234');});
```## Contribute
Feel free to send pull-requests
## License
MIT