Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/opentmi/ykushjs
Yepkit Ykush module
https://github.com/opentmi/ykushjs
test-automation usb-devices usb-switch yepkit ykush
Last synced: about 1 month ago
JSON representation
Yepkit Ykush module
- Host: GitHub
- URL: https://github.com/opentmi/ykushjs
- Owner: OpenTMI
- Created: 2019-10-06T11:05:23.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T19:15:50.000Z (almost 2 years ago)
- Last Synced: 2024-04-27T04:41:41.880Z (8 months ago)
- Topics: test-automation, usb-devices, usb-switch, yepkit, ykush
- Language: JavaScript
- Homepage:
- Size: 775 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ykushjs
Node.js module for [Yepkit Ykush USB switch](https://www.yepkit.com/products/ykush).
Based on [ykushcmd](https://github.com/Yepkit/ykush).## Supported modules
* [ykush](https://www.yepkit.com/products/ykush)
* [ykushxs](https://www.yepkit.com/product/300115/YKUSHXS)
* [ykush3](https://www.yepkit.com/product/300110/YKUSH3)## Requirements
* linux, win64 or macos
* node 10 or 12**linux**
* libusb: `sudo apt install -y libusb-1.0-0`
* udev rules to be able to use ykush without root access[Here](bin/linux/install_udev.sh) is simple udev rule installation script. To install it just run:
```
curl -sL https://github.com/OpenTMI/ykushjs/raw/master/bin/linux/install_udev.sh | sudo bash -
```## API
```js
(() => async function() {
const {Ykush, Ykushxs} = require('Ykush');
// ykush
let listOfSerialNumbers = await Ykush.list();
const ykush = new Ykush(listOfSerialNumbers[0]);
await ykush.powerOn({channel: 1});
await ykush.powerOff({channel: 1});
await ykush.powerAllOn();
await ykush.powerAllOff();
console.log(ykush.serialNumber);
// ykushxs
listOfSerialNumbers = await Ykushxs.list();
const ykushxs = new Ykushxs(listOfSerialNumbers[0]);
await ykushxs.powerOn();
await ykushxs.powerOff();
// ykush3
listOfSerialNumbers = await Ykush3.list();
const ykush3 = new Ykushxs(listOfSerialNumbers[0]);
await ykush3.powerOn({channel: 1});
await ykush3.powerOff({channel: 1});
await ykush3.reset();
await ykush3.switchOn5V()
await ykush3.switchOff5V()
await ykush3.writeGPIO({gpio: 1, state: 0})
await ykush3.writeGPIO({gpio: 1, state: 1})})();
```