node-omron-2jcie-bu
v0.1.1
Published
OMRON 2JCIE-BU Controller for Node.js (UNOFFICIAL)
Downloads
1
Readme
node-omron-2jcie-bu
This repository was forked from https://github.com/e53e04ac/node-omron-2jcie-bu for updating package version.
OMRON 2JCIE-BU Controller for Node.js (UNOFFICIAL)
Requirements
Node.js (v14, v15)
Installation
npm install node-omron-2jcie-bu
Examples
Set LED light color
save a file:
example-set-led-light-color.js
const omron2jciebu = require('node-omron-2jcie-bu'); (async () => { const controller = omron2jciebu.Controller({ path: '/dev/ttyUSB0' }); await controller.open(); await controller.ledSettingNormalState.write({ displayRuleNormalState: 0x0001, intensityOfLedRed: 0, intensityOfLedGreen: 255, intensityOfLedBlue: 0, }); await controller.close(); })();
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
save a file:
example-get-sensor-data.js
const omron2jciebu = require('node-omron-2jcie-bu'); (async () => { const controller = omron2jciebu.Controller({ path: '/dev/ttyUSB0' }); await controller.open(); const latestData = await controller.latestDataLong.read({}); console.log(latestData); await controller.close(); })();
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 }