All Projects β†’ eltonvs β†’ Kotlin Obd Api

eltonvs / Kotlin Obd Api

Licence: apache-2.0
πŸš™ A Kotlin OBD-II API for reading engine data

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Kotlin Obd Api

Awesome Home Assistant
A curated list of amazingly awesome Home Assistant resources.
Stars: ✭ 3,487 (+3731.87%)
Mutual labels:  hacktoberfest, iot
Freedomotic
Open IoT Framework
Stars: ✭ 354 (+289.01%)
Mutual labels:  hacktoberfest, iot
Esphome
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Stars: ✭ 4,324 (+4651.65%)
Mutual labels:  hacktoberfest, iot
Naomi
The Naomi Project is an open source, technology agnostic platform for developing always-on, voice-controlled applications!
Stars: ✭ 171 (+87.91%)
Mutual labels:  hacktoberfest, iot
Cbj smart Home
If you are searching for an easy way to deploy a smart home 🏑 by yourself CyBear Jinni πŸ¦ΎπŸ»πŸ§žβ€β™‚οΈ is here for you. Join the community and make your home smarter than yesterday.
Stars: ✭ 37 (-59.34%)
Mutual labels:  hacktoberfest, iot
Openthread
OpenThread released by Google is an open-source implementation of the Thread networking protocol
Stars: ✭ 2,643 (+2804.4%)
Mutual labels:  hacktoberfest, iot
Zwave2mqtt
Fully configurable Zwave to MQTT gateway and Control Panel using NodeJS and Vue
Stars: ✭ 352 (+286.81%)
Mutual labels:  hacktoberfest, iot
Core
🏑 Open source home automation that puts local control and privacy first.
Stars: ✭ 48,265 (+52938.46%)
Mutual labels:  hacktoberfest, iot
Shellhub
πŸ’» ShellHub enables teams to easily access any Linux device behind firewall and NAT.
Stars: ✭ 686 (+653.85%)
Mutual labels:  hacktoberfest, iot
Addons
βž• Docker add-ons for Home Assistant
Stars: ✭ 548 (+502.2%)
Mutual labels:  hacktoberfest, iot
Astarte
Core Astarte Repository
Stars: ✭ 148 (+62.64%)
Mutual labels:  hacktoberfest, iot
Petnet Feeder Service
The Petnet v2 feeder has been hacked!
Stars: ✭ 63 (-30.77%)
Mutual labels:  hacktoberfest, iot
Water Monitoring System
Water Monitoring System is an IOT based Liquid Level Monitoring system that has mechanisms to keep the user alerted in case of liquid overflow or when tank depletes.
Stars: ✭ 122 (+34.07%)
Mutual labels:  hacktoberfest, iot
Industrial Iot
Azure Industrial IoT Platform
Stars: ✭ 256 (+181.32%)
Mutual labels:  hacktoberfest, iot
Samples
🍬 Code samples from the nanoFramework team used in testing, proof of concepts and other explorational endeavours
Stars: ✭ 108 (+18.68%)
Mutual labels:  hacktoberfest, iot
Home Assistantconfig
🏠 Home Assistant configuration & Documentation for my Smart House. Write-ups, videos, part lists, and links throughout. Be sure to ⭐ it. Updated FREQUENTLY!
Stars: ✭ 3,687 (+3951.65%)
Mutual labels:  hacktoberfest, iot
Tesla Api
🚘 A Ruby gem and unofficial documentation of Tesla's JSON API for the Model S, 3, X, and Y.
Stars: ✭ 1,317 (+1347.25%)
Mutual labels:  car, iot
Operating System
πŸ”° Home Assistant Operating System
Stars: ✭ 1,920 (+2009.89%)
Mutual labels:  hacktoberfest, iot
Riot
RIOT - The friendly OS for IoT
Stars: ✭ 4,029 (+4327.47%)
Mutual labels:  hacktoberfest, iot
Nextcloud Snap
β˜οΈπŸ“¦ Nextcloud packaged as a snap
Stars: ✭ 1,088 (+1095.6%)
Mutual labels:  hacktoberfest, iot

Kotlin OBD API

GitHub version CI Status Maintainability codebeat badge GitHub license Open Source

A lightweight and developer-driven API to query and parse OBD commands.

Written in pure Kotlin and platform agnostic with a simple and easy to use interface, so you can hack your car without any hassle. πŸš™

This is a flexible API that allows developers to plug-in to any connection interface (Bluetooth, Wifi, USB...). By default we use an ObdDeviceConnection that receives an InputStream and an OutputStream as parameters (so if you can get this from your connection interface, you're good to go πŸ‘).

Installation

You can download a jar from GitHub's releases page.

Or use Gradle:

dependencies {
  ...

  // Kolin OBD API
  implementation 'com.github.eltonvs:kotlin-obd-api:1.1.1'
}

Or Maven:

<dependency>
  <groupId>com.github.eltonvs</groupId>
  <artifactId>kotlin-obd-api</artifactId>
  <version>1.1.1</version>
</dependency>

Basic Usage

Get an InputStream and an OutputStream from your connection interface and create an ObdDeviceConnection instance.

// Create ObdDeviceConnection instance
val obdConnection = ObdDeviceConnection(inputStream, outputStream)

With this, you're ready to run any command you want, just pass the command instance to the .run method. This command accepts 3 parameters: command, useCache (default = false) and delayTime (default = 0).

// Retrieving OBD Speed Command
val response = obdConnection.run(SpeedCommand())

// Using cache (use with caution)
val cachedResponse = obdConnection.run(VINCommand(), useCache = true)

// With a delay time - with this, the API will wait 500ms after executing the command
val delayedResponse = obdConnection(RPMCommand(), delayTime = 500L)

The retuned object is a ObdResponse and has the following attributes:

Attribute Type Description
command ObdCommand The command passed to the run method
rawResponse ObdRawResponse This class holds the raw data returned from the car
value String The parsed value
unit String The unit from the parsed value (e.g.: Km/h, RPM, ...

The ObdRawResponse has the following attributes:

Attribute Type Description
value String The raw value (hex)
elapsedTime Long The elapsed time (in milliseconds) to run the command
processedValue String The raw (hex) value without whitespaces, colons or any other "noise"
bufferedValue IntArray The raw (hex) value as a IntArray

Extending the library

It's easy to add a custom command using this library, all you need to do is create a class extending the ObdCommand class and overriding the following methods:

class CustomCommand : ObdCommand() {
    // Required
    override val tag = "CUSTOM_COMMAND"
    override val name "Custom Command"
    override val mode = "01"
    override val pid = "FF"

    // Optional
    override val defaultUnit = ""
    override val handler = { it: ObdRawResponse -> "Calculations to parse value from ${it.processedValue}" }
}

Commands

Here are a handul list of the main supported commands (sensors). For a full list, see here.

  • Available Commands
  • Vehicle Speed
  • Engine RPM
  • DTC Number
  • Trouble Codes (Current, Pending and Permanent)
  • Throttle Position
  • Fuel Pressure
  • Timing Advance
  • Intake Air Temperature
  • Mass Air Flow Rate (MAF)
  • Engine Run Time
  • Fuel Level Input
  • MIL ON/OFF
  • Vehicle Identification Number (VIN)

NOTE: Support for those commands will vary from car to car.

Contributing

Want to help or have something to add to the repo? problem on a specific feature?

  • Open an issue to explain the issue you want to solve Open an issue
  • After discussion to validate your ideas, you can open a PR or even a draft PR if the contribution is a big one Current PRs

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Elton Viana - Initial work - Also created the java-obd-api

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache 2.0 License - See the LICENCE file for more details.

Acknowledgments

  • Paulo Pires - Creator of the obd-java-api, on which the initial steps were based.
  • SmartMetropolis Project (Digital Metropolis Institute - UFRN, Brazil) - Backed and sponsored the project development during the initial steps.
  • Ivanovitch Silva - Helped a lot during the initial steps and with the OBD research.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].