Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/niieani/illumination-control
Use JavaScript to control your Aukey Smart RGB Lamp running on Tuya IoT firmware
https://github.com/niieani/illumination-control
aukey iot smart-lamp tuya tuyapi
Last synced: 2 days ago
JSON representation
Use JavaScript to control your Aukey Smart RGB Lamp running on Tuya IoT firmware
- Host: GitHub
- URL: https://github.com/niieani/illumination-control
- Owner: niieani
- Created: 2021-04-09T08:09:35.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T02:39:54.000Z (11 months ago)
- Last Synced: 2024-10-11T20:17:54.320Z (27 days ago)
- Topics: aukey, iot, smart-lamp, tuya, tuyapi
- Language: JavaScript
- Homepage:
- Size: 98.6 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Aukey Illumination Control
Use JavaScript to control your [Aukey Smart RGB Lamp](https://www.amazon.com/gp/product/B08TM4DBRB/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1) running on Tuya IoT firmware.
The protocol for setting color and scenes was reverse engineered and you can use simple helper functions from this repo to set them. You can even make combinations that aren't possible with the UI (e.g. scenes that mix fades with non-fades).
The light is very responsive on a good WiFi network, so I'm trying to do some audio visualization with the lamp, but you can use it for your own needs. :)
## Setup
You'll need to create a Tuya IoT account: https://iot.tuya.com/index/
It's a long an annoying process that takes upto 24 hours (due to the wait for their apis to propagate). Instructions for that are [here](https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md).
Then clone this repo and create a file `src/devices.js`:
```js
module.exports = [
// copy the output of the 'tuya-cli wizard' command, or if you have an id/key for your device:
{
name: 'AUKEY Living Room',
id: 'my_api_id_here',
key: 'my_api_secret_here'
},
]
```## Running
```
yarn
yarn start
```This will open Electron and your light will start reacting to whather is coming from the default record device (by default likely your computer's microphone).
Do customize this behavior in `preload.js` to your liking.
## Usage
```js
const { device, ready } = require("./run");
const { getScene, schema } = require("./aukey-helpers");await ready;
device.set({
multiple: true,
data: {
[schema.mode]: "scene",
[schema.power]: true,
[schema.sceneDefinition]: getScene({
targetSlotNth: 4,
stages: [
{
crossfade: false,
holdMs: 1000,
hue: 10,
saturation: 1000,
lightness: 1000,
},
],
}),
},
});
```Check `aukey-helpers.js` for all supported options.
## Caveats
When using 'colour' mode, large changes (distant value from the previous one) can cause a timeout,
because the light fades to the other color and only then responds.
Workaround is to use the 'scene' mode with a single color and cross-fade disabled.