Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 1.72 KB

README.md

File metadata and controls

62 lines (42 loc) · 1.72 KB

elero-usb-transmitter-client

npm version build status

Elero USB Transmitter Client for node.js to send commands to Elero USB Stick and receive information. This libaray needs Elero Transmitter Stick (https://www.der-sonnenschutz-shop.de/elero-221250001-centero-transmitter-stick.html).

Features

  • send commands to control shutters
  • get current state of shutters

Installing

Using npm:

$ npm install elero-usb-transmitter-client

Example

Initialize

import { UsbTransmitterClient } from 'elero-usb-transmitter-client'

const client = new UsbTransmitterClient('/dev/ttyUSB0')

Creats a new client object. You have to use the path to the device as a parameter. Type npx @serialport/list in command line to get a list of serial devices.

Get information

import { UsbTransmitterClient } from "../src/UsbTransmitterClient"

//open connection to device
await client.open()
//get info of channel 1
const response = await client.getInfo(1)
console.log(response)
//close connection if it is not needed anymore
await client.close()

Writable properties of device

import { UsbTransmitterClient } from "../src/UsbTransmitterClient"
import { ControlCommand } from "../src/domain/enums"

await client.open()
//move shutters on channel 1 down
const response = await client.sendControlCommand(1, ControlCommand.down)
console.log(response)
await client.close()

License

MIT