@adeunis/codecs
TypeScript icon, indicating that this package has built-in type declarations

1.7.1 • Public • Published

Adeunis codecs

JavaScript/Node.js library of Adeunis codecs to decode/encode Adeunis products data frames.

Install

npm i @adeunis/codecs
npm i --save-dev @types/node

Basic usage

const codec = require('@adeunis/codecs');

// All product types are defined in DecoderProducts enum (src/shared/product.enum.ts)
const productType = 'analog';
const payloadValue = '42500110000002100000';
let payloadResult;

console.log(`Decoding ${productType} frame => ${payloadValue}`);

const decoder = new codec.Decoder();

// Configure the decoder for the appropriate device 
decoder.setDeviceType(productType);

// Decode the given payload
let parserResult = decoder.decode(payloadValue);

// Incompatible frame and product
if (parserResult.error) {
    payloadResult = 'decoding issue';
} else {
    // Display result
    payloadResult = JSON.stringify(parserResult, null, 2);
}

console.log(payloadResult);

CLI

Executables for Windows, Linux and MacOS can be built from the sources using the following commands at the root folder:

  • npm run start

And one of :

  • npm run pack:exe
  • npm run pack:linux
  • npm run pack:mac

Usage with node: node bin/codec.js <command> [<args> ...] [-- <options>] Usage with executable: codec <command> [<args> ...] [-- <options>]

Available commands:

  • decode: Decode frame
  • encode: Encode frame
  • help: Show help

Available options:

  • -v, --version: Print version
  • ...: Command specific options

Decoder

Usage: codec decode <frame1> [<frame2> ...] [--deviceType <device_type>] [--network lora868|sigfox] [--csv] [--json]

Encoder

Usage: codec encode <device_type> <frame_code> [--network lora868|sigfox] [-- <encode_options>]

Demonstration (HTML pages)

Basic demo pages are available in generic\src\demo\ directory

You can also visit the demonstration web page

Product / Codec type association table

Product Reference APP FW version Min codecs lib Codec type to select
Analog / Analog PWR 8180BA, 8181BA, ARF8201AA, ARF8200AA 1.3.x 1.3.0 analog
Analog2 / Analog2 PWR 8180BA, 8181BA, ARF8201AA, ARF8200AA 2.1.x 1.7.1 analog2
Breath 8377AA, 8377CA 2.4.x 1.6.0 breath
Comfort 8275AA, 8275CA < 2.1.0 0.4.2 comfort
Comfort2 8275AA, 8275CA >= 2.1.x 1.4.0 comfort2
Comfort CO2 8373AA, 8373CA 2.2.x 1.5.0 comfortCo2
Comfort Serenity 8373[A/B/C/D/I/J/K/L]R 1.1.x 1.7.1 comfortSerenity
Dry Contacts 8170BA, 8171BA 1.3.x 0.4.2 dc or drycontacts (since lib 1.4.0)
Dry Contacts 2 8170BA, 8171BA 2.1.x 1.4.0 drycontacts2
DeltaP 8283AA, 8283CA 1.5.x or 2.0.x 1.0.0 deltap
Modbus 8240AA, 8240BA, 8240CA 2.x.x 1.7.1 modbus
Motion 8276AA, 8276CA 1.5.x 1.0.0 motion
Motion 2 8276AA, 8276CA 2.0.x 1.2.0 motion
Pulse / Pulse ATEX 8230AA, 8230CA, 8230GA, 8230HA 1.2.x 0.4.2 pulse
Pulse 3 / Pulse 3 ATEX 8230AA, 8230CA, 8230GA, 8230HA 2.0.x 1.1.0 pulse3
Pulse 4 / Pulse 4 ATEX 8230AA, 8230CA, 8230GA, 8230HA 2.1.x 1.4.0 pulse4
Pulse 4 NB-IoT 8335AA 2.0.x 0.4.2 pulse4nbiot
Repeater Sigfox 8168AA 2.x.x 0.4.2 repeater
Temp / Temp 2S 8180BA, 8181BA, 8180BA2, 8181BA2 1.3.x 0.4.2 temp
Temp 3 / Temp 2S 3 8180BA, 8181BA 8180BA2, 8181BA2 2.0.x 1.1.0 temp3
Temp 4 / Temp 2S 4 8180BA, 8181BA, 8180BA2, 8181BA2 2.1.x 1.4.0 temp4
Temp 4 / Temp 2S 4 IP68 8180BCA, 8181BCA, 8180BCB, 8181BCB 2.1.x 1.4.0 temp4
TIC CBE/LINKY MONO 8250AA 1.4.x 1.3.0 ticCbeLinkyMono
TIC CBE/LINKY TRI 8250AA 1.4.x 1.3.0 ticCbeLinkyTri
TIC PME-PMI 8250AA 1.4.x 1.4.0 ticPmePmi

Please note that :

  • RTU firmware version has no impact on the codec type to select
  • Bundles use the same type than the standard product

Dependencies (4)

Dev Dependencies (20)

Package Sidebar

Install

npm i @adeunis/codecs

Weekly Downloads

554

Version

1.7.1

License

MIT

Unpacked Size

1.89 MB

Total Files

453

Last publish

Collaborators

  • a.deyres