0.0.3 • Published 4 years ago

@e53e04ac/node-omron-2jcie-bu v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

node-omron-2jcie-bu

npm version Build Status Coverage Status Codacy Badge dependencies Status devDependencies Status License: MIT

OMRON 2JCIE-BU Controller for Node.js (UNOFFICIAL)


Requirements


Installation

run the command:

npm install @e53e04ac/node-omron-2jcie-bu

Examples

Set LED light color

  1. save a file: example-set-led-light-color.js

    const omron2jciebu = require('@e53e04ac/node-omron-2jcie-bu');
    
    (async () => {
    
        const controller = omron2jciebu({ path: '/dev/ttyUSB0' });
    
        await controller.open();
    
        await controller.ledSettingNormalState.write({
            displayRuleNormalState: 0x0001,
            intensityOfLedRed: 0,
            intensityOfLedGreen: 255,
            intensityOfLedBlue: 0,
        });
    
        await controller.close();
    
    })();
  2. execute commands and the script

    sudo modprobe ftdi_sio
    sudo chmod 777 /sys/bus/usb-serial/drivers/ftdi_sio/new_id
    sudo echo 0590 00d4 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id
    
    node example-set-led-light-color.js

    the LED light will turn green.

Get sensor data

  1. save a file: example-get-sensor-data.js

    const omron2jciebu = require('@e53e04ac/node-omron-2jcie-bu');
    
    (async () => {
    
        const controller = omron2jciebu({ path: '/dev/ttyUSB0' });
    
        await controller.open();
    
        const latestData = await controller.latestDataLong.read({});
    
        console.log(latestData);
    
        await controller.close();
    
    })();
  2. execute commands and the script

    sudo modprobe ftdi_sio
    sudo chmod 777 /sys/bus/usb-serial/drivers/ftdi_sio/new_id
    sudo echo 0590 00d4 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id
    
    node example-get-sensor-data.js

    you will get a sensor data, like this:

    {
        sequenceNumber: 77,
        temperature: { raw: 3172, value: 31.720000000000002, unit: 'degC' },
        relativeHumidity: { raw: 4418, value: 44.18, unit: '%RH' },
        ambientLight: { raw: 219, value: 219, unit: 'lx' },
        barometricPressure: { raw: 1009238, value: 1009.238, unit: 'hPa' },
        soundNoise: { raw: 6503, value: 65.03, unit: 'dB' },
        etvoc: { raw: 168, value: 168, unit: 'ppb' },
        eco2: { raw: 1494, value: 1494, unit: 'ppm' },
        discomfortIndex: { raw: 7954, value: 79.54, unit: null },
        heatStroke: { raw: 2623, value: 26.23, unit: 'degC' },
        vibrationInformation: { raw: 0, value: 'none' },
        siValue: { raw: 0, value: 0, unit: 'kine' },
        pga: { raw: 0, value: 0, unit: 'gal' },
        seismicIntensity: { raw: 0, value: 0, unit: null },
        temperatureFlag: 0,
        relativeHumidityFlag: 0,
        ambientLightFlag: 0,
        barometricPressureFlag: 0,
        soundNoiseFlag: 0,
        etvocFlag: 0,
        eco2Flag: 0,
        discomfortIndexFlag: 0,
        heatStrokeFlag: 0,
        siValueFlag: 0,
        pgaFlag: 0,
        seismicIntensityFlag: 0
    }

Documentation


License


0.0.3

4 years ago

0.0.2

4 years ago