knx-datapoints

Decode and encode knx datapoint according to the knx datapoint types standard 2.1

Usage no npm install needed!

<script type="module">
  import knxDatapoints from 'https://cdn.skypack.dev/knx-datapoints';
</script>

README

knx-datapoints

NPM version NPM downloads per month NPM downloads total MIT License JavaScript Style Guide

A library to encode and decode knx datapoint types as described in the KNX Specifications v2.1

So far not all but the most common datapoint types are supported.
The supported datapoint types are documented in the dpt overview table.

Changelog

Usage

npm install --save knx-datapoints
const knxDatapoints = require('knx-datapoints')

// Encode a value
knxDatapoints.encode('1.001', true) // Buffer[01]

// Decode a buffer
knxDatapoints.decode('1.001', Buffer.from('01', 'hex')) // true

// Check if a dpt is valid
knxDatapoints.isValid('1.001') // true
knxDatapoints.isValid('255.000') // false

// Check if a dpt is supported
knxDatapoints.isSupported('1.001') // true
knxDatapoints.isSupported('241.800') // false

You can read further information in the usage documentation.

Contribute

  • Always write tests and make sure all tests run fine
  • Always lint
  • Try to cover all of your code in tests
npm install

# testing
npm test

# linting
npm run lint

# check coverage
npm run coverage

License

knx-datapoints is freely distributable under the terms of the MIT license.