0.1.3 • Published 3 years ago

node-owlusb v0.1.3

Weekly downloads
28
License
MIT
Repository
github
Last release
3 years ago

Owl +USB Library for Node.JS

Node.JS library for communicating with Owl +USB CM160 energy monitoring and analysis devices. Live energy data is collected from the device (produced about once per minute) and converted to JSON.

This work is heavily influenced by Philippe Cornet's C library eagle-owl.

Driver

The OWL+USB uses a Silicon Labs CP210x USB to UART bridge that typically requires a kernel mode driver to interface with it, largely limiting options for linux. This library instead makes use of the libusb library and my fork of the cp2102 library, to interface with the device in user mode. This therefore does require some dependencies to be installed.

Linux

  • Install dependencies using a package manger e.g. sudo apt install libusb libusb-dev libudev-dev on Debian-based distros.
  • Add permissions to udev rules.
    • Create a new file such as /etc/udev/rules.d/50-owlusb.rules.
    • Add to this file - SUBSYSTEM=="usb", ATTRS{idVendor}=="0fde", ATTRS{idProduct}=="ca05", GROUP="<group>", MODE="0666" where <group> is the username or group of the user executing the application.
    • Reload udev rules - udevadm control --reload-rules

macOS

Install using a package manger e.g. Homebrew sudo brew install libusb or macports sudo port install libusb.

Windows

On Windows you must install libusb per device using Zadig.

WSL2

I have not had much success in installing libusb under Windows 10's WSL2. Hyper-V, WSL2's underlying hypervisor, lacks support for Host USB pass-through to VMs.

Purely speculating, you may be able to lash something together using USB/IP or Microsoft's VMConnect

Usage

  • Install libusb as described in the driver section.
  • Add node-owlusb to your dependencies in package.json
  • Run npm install
  • Use the following code snippet:
const OwlUSB = require('node-owlusb')

const owlUSB = new OwlUSB();
owlUSB.on('ready', () => console.log('connected'))
owlUSB.on('live', (record) => console.log(JSON.stringify(record)))

This should produce JSON similar to:

{"addr":0,"year":2021,"month":1,"day":17,"hour":10,"min":51,"cost":12.50,"amps":1.899,"watts":435,"ah":0.03,"wh":7.25,"isLiveData":true}
0.1.4-beta.3

3 years ago

0.1.4-beta.4

3 years ago

0.1.4-beta.5

3 years ago

0.1.4-beta.2

3 years ago

0.1.4-beta.1

3 years ago

0.1.4-beta.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago