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).
- send commands to control shutters
- get current state of shutters
Using npm:
$ npm install elero-usb-transmitter-client
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.
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()
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()