elero-usb-transmitter-client
v1.2.0
Published
[](https://www.npmjs.com/package/elero-usb-transmitter-client) [.
Features
- send commands to control shutters
- get current state of shutters
Installing
Using npm:
$ npm install elero-usb-transmitter-clientCLI Usage
You can use the interactive CLI to control the transmitter directly.
Installation
Globally (if published to npm):
npm install -g elero-usb-transmitter-client
elero-cliVia npx (if published to npm):
npx elero-usb-transmitter-clientFrom Source (Development):
- Clone the repository
- Install dependencies:
npm install - Build the project:
npm run build - Link command:
npm link - Run:
elero-cli
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()Changelog
1.2.0
- Major update of dependencies (TypeScript 5.x, Jest 29.x, ESLint 9.x)
- Switched to ESLint flat config (
eslint.config.mjs) - Moved to
prettier3.x
1.1.4
- Added
prepublishOnlyscript to ensure fresh build before publish - Explicitly added
disttofileslist inpackage.json
1.1.3
- Moved
commanderandinquirertodependencies(fix runtime error)
1.1.2
- Fix CLI entry point name in
package.json
1.1.1
- Fixed
responseBytes are nullerror by handling fragmented serial packets - Added detailed unit tests with mocks
1.1.0
- Added interactive CLI (
elero-cli) - Added
inquirerandcommanderdependencies
1.0.6
- Updated
serialportdependency - Fixed errors in response handling
1.0.5
- Improved mutex handling (release added)
1.0.4
- Fixed promise rejection logic
- Added null checks for response bytes
1.0.0
- Initial release with
getInfo,sendControlCommand, andcheckChannels - Implemented
UsbTransmitterClient
