Pull WLED state from device; add Sunrise preset and presets docs
- wled_pull: update full.json, state.json, info.json from device - Add wled_config/presets/sunrise.json (psave payload for preset 1) - README: document defining and pushing presets Made-with: Cursor
This commit is contained in:
@@ -32,13 +32,37 @@ python wled_push.py --bri 128
|
|||||||
python wled_push.py --preset 1
|
python wled_push.py --preset 1
|
||||||
python wled_push.py --file wled_config/state.json
|
python wled_push.py --file wled_config/state.json
|
||||||
python wled_push.py --file wled_config/sunrise_8am.json
|
python wled_push.py --file wled_config/sunrise_8am.json
|
||||||
|
python wled_push.py --file wled_config/presets/sunrise.json # save preset to device (psave)
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `--host` to override the default `192.168.240.30`.
|
Use `--host` to override the default `192.168.240.30`.
|
||||||
|
|
||||||
|
### Brightness and white channel
|
||||||
|
|
||||||
|
WLED has three separate level-style controls:
|
||||||
|
|
||||||
|
| Control | JSON | Description |
|
||||||
|
|--------|------|--------------|
|
||||||
|
| **Global brightness** | `state.bri` | Main dimmer for the whole light (0–255). When off, this is the brightness used when you turn on. |
|
||||||
|
| **Segment brightness** | `state.seg[].bri` | Per-segment brightness (0–255). Multiplies with the segment’s color/effect. |
|
||||||
|
| **White channel** | `state.seg[].col[0][3]` | The W in RGBW: primary color is `[R, G, B, W]`. White channel 0–255 (how much dedicated white is mixed in). |
|
||||||
|
|
||||||
|
**CLI:**
|
||||||
|
|
||||||
|
- `--bri N` — global brightness.
|
||||||
|
- `--seg-bri N` — segment 0 brightness.
|
||||||
|
- `--white N` — segment 0 primary color’s white channel (0–255). Use with Solid effect for predictable results.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python wled_push.py --on --bri 200 # global only
|
||||||
|
python wled_push.py --seg-bri 128 # dim segment 0 only
|
||||||
|
python wled_push.py --white 255 # full white channel (segment 0)
|
||||||
|
python wled_push.py --bri 255 --seg-bri 255 --white 255 # all full
|
||||||
|
```
|
||||||
|
|
||||||
### White vs warm light (CCT)
|
### White vs warm light (CCT)
|
||||||
|
|
||||||
Your WLED device (**WLED-Gledopto** at `192.168.240.30`) supports **CCT** (color temperature). In the API, segment `cct` uses a relative scale:
|
Your WLED device (**WLED-Gledopto** at `192.168.240.30`) supports **CCT** (color temperature). This controls the **warm vs cool** blend of the white output; the **white channel** (`--white`) controls how much white is mixed in (e.g. with RGB). In the API, segment `cct` uses a relative scale:
|
||||||
|
|
||||||
- **`cct: 0`** → warmest (warm white, ~2700 K)
|
- **`cct: 0`** → warmest (warm white, ~2700 K)
|
||||||
- **`cct: 255`** → coolest (cool white, ~6500 K)
|
- **`cct: 255`** → coolest (cool white, ~6500 K)
|
||||||
@@ -72,6 +96,21 @@ python wled_push.py --cct 0 # switch to warm
|
|||||||
|
|
||||||
`wled_config/` holds JSON pulled from the device: `full.json`, `state.json`, `info.json`. Use `wled_push.py --file wled_config/state.json` to restore state.
|
`wled_config/` holds JSON pulled from the device: `full.json`, `state.json`, `info.json`. Use `wled_push.py --file wled_config/state.json` to restore state.
|
||||||
|
|
||||||
|
### Presets (define in JSON, push to device)
|
||||||
|
|
||||||
|
Presets are stored on the WLED device; you can **define** them in JSON and **push** once to create/update them. Use the WLED `psave` API: include `psave` (preset slot 1–250), optional `n` (name), `ib` (include brightness), and the state you want saved.
|
||||||
|
|
||||||
|
**Example — Sunrise preset** (warm white, Solid, for the 8am alarm):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python wled_push.py --file wled_config/presets/sunrise.json
|
||||||
|
```
|
||||||
|
|
||||||
|
That sends the payload in `wled_config/presets/sunrise.json` to the device. The device saves it as preset ID 1 named "Sunrise". Home Assistant can then use `select.wled_gledopto_preset` with option "Sunrise" in the sunrise alarm script.
|
||||||
|
|
||||||
|
- **full.json** is a snapshot from **pull** (state + info + effects + palettes). It does not define presets; use `wled_config/presets/*.json` for that.
|
||||||
|
- To add more presets: create a new JSON file with `psave`, `n`, and state, then run `wled_push.py --file path/to/preset.json`.
|
||||||
|
|
||||||
## Sunrise alarm
|
## Sunrise alarm
|
||||||
|
|
||||||
`wled_config/sunrise_8am.json` starts a 30-minute sunrise that finishes at `08:00`.
|
`wled_config/sunrise_8am.json` starts a 30-minute sunrise that finishes at `08:00`.
|
||||||
|
|||||||
+11
-11
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"state": {
|
"state": {
|
||||||
"on": true,
|
"on": true,
|
||||||
"bri": 128,
|
"bri": 255,
|
||||||
"transition": 0,
|
"transition": 0,
|
||||||
"ps": -1,
|
"ps": 1,
|
||||||
"pl": -1,
|
"pl": -1,
|
||||||
"ledmap": 0,
|
"ledmap": 0,
|
||||||
"AudioReactive": {
|
"AudioReactive": {
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
"liveseg": -1,
|
"liveseg": -1,
|
||||||
"lm": "",
|
"lm": "",
|
||||||
"lip": "",
|
"lip": "",
|
||||||
"ws": 3,
|
"ws": 4,
|
||||||
"fxcount": 187,
|
"fxcount": 187,
|
||||||
"palcount": 71,
|
"palcount": 71,
|
||||||
"cpalcount": 0,
|
"cpalcount": 0,
|
||||||
@@ -115,15 +115,15 @@
|
|||||||
],
|
],
|
||||||
"wifi": {
|
"wifi": {
|
||||||
"bssid": "A4:A9:30:F9:4D:96",
|
"bssid": "A4:A9:30:F9:4D:96",
|
||||||
"rssi": -42,
|
"rssi": -41,
|
||||||
"signal": 100,
|
"signal": 100,
|
||||||
"channel": 1,
|
"channel": 1,
|
||||||
"ap": false
|
"ap": false
|
||||||
},
|
},
|
||||||
"fs": {
|
"fs": {
|
||||||
"u": 8,
|
"u": 12,
|
||||||
"t": 983,
|
"t": 983,
|
||||||
"pmt": 1772891797
|
"pmt": 1772989317
|
||||||
},
|
},
|
||||||
"ndc": 0,
|
"ndc": 0,
|
||||||
"arch": "esp32",
|
"arch": "esp32",
|
||||||
@@ -131,9 +131,9 @@
|
|||||||
"clock": 240,
|
"clock": 240,
|
||||||
"flash": 4,
|
"flash": 4,
|
||||||
"lwip": 0,
|
"lwip": 0,
|
||||||
"freeheap": 166196,
|
"freeheap": 165576,
|
||||||
"uptime": 97381,
|
"uptime": 97889,
|
||||||
"time": "2026-3-8, 16:54:44",
|
"time": "2026-3-8, 17:03:11",
|
||||||
"u": {
|
"u": {
|
||||||
"AudioReactive": [
|
"AudioReactive": [
|
||||||
"<button class=\"btn btn-xs\" onclick=\"requestJson({AudioReactive:{enabled:false}});\"><i class=\"icons on\"></i></button>"
|
"<button class=\"btn btn-xs\" onclick=\"requestJson({AudioReactive:{enabled:false}});\"><i class=\"icons on\"></i></button>"
|
||||||
@@ -143,13 +143,13 @@
|
|||||||
],
|
],
|
||||||
"Audio Source": [
|
"Audio Source": [
|
||||||
"I2S digital",
|
"I2S digital",
|
||||||
" - quiet"
|
" - peak 99%"
|
||||||
],
|
],
|
||||||
"Sound Processing": [
|
"Sound Processing": [
|
||||||
"running"
|
"running"
|
||||||
],
|
],
|
||||||
"AGC Gain": [
|
"AGC Gain": [
|
||||||
12.87,
|
9.9,
|
||||||
"x"
|
"x"
|
||||||
],
|
],
|
||||||
"UDP Sound Sync": [
|
"UDP Sound Sync": [
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
"liveseg": -1,
|
"liveseg": -1,
|
||||||
"lm": "",
|
"lm": "",
|
||||||
"lip": "",
|
"lip": "",
|
||||||
"ws": 3,
|
"ws": 4,
|
||||||
"fxcount": 187,
|
"fxcount": 187,
|
||||||
"palcount": 71,
|
"palcount": 71,
|
||||||
"cpalcount": 0,
|
"cpalcount": 0,
|
||||||
@@ -37,15 +37,15 @@
|
|||||||
],
|
],
|
||||||
"wifi": {
|
"wifi": {
|
||||||
"bssid": "A4:A9:30:F9:4D:96",
|
"bssid": "A4:A9:30:F9:4D:96",
|
||||||
"rssi": -42,
|
"rssi": -41,
|
||||||
"signal": 100,
|
"signal": 100,
|
||||||
"channel": 1,
|
"channel": 1,
|
||||||
"ap": false
|
"ap": false
|
||||||
},
|
},
|
||||||
"fs": {
|
"fs": {
|
||||||
"u": 8,
|
"u": 12,
|
||||||
"t": 983,
|
"t": 983,
|
||||||
"pmt": 1772891797
|
"pmt": 1772989317
|
||||||
},
|
},
|
||||||
"ndc": 0,
|
"ndc": 0,
|
||||||
"arch": "esp32",
|
"arch": "esp32",
|
||||||
@@ -53,9 +53,9 @@
|
|||||||
"clock": 240,
|
"clock": 240,
|
||||||
"flash": 4,
|
"flash": 4,
|
||||||
"lwip": 0,
|
"lwip": 0,
|
||||||
"freeheap": 166200,
|
"freeheap": 164096,
|
||||||
"uptime": 97383,
|
"uptime": 97889,
|
||||||
"time": "2026-3-8, 16:54:46",
|
"time": "2026-3-8, 17:03:12",
|
||||||
"u": {
|
"u": {
|
||||||
"AudioReactive": [
|
"AudioReactive": [
|
||||||
"<button class=\"btn btn-xs\" onclick=\"requestJson({AudioReactive:{enabled:false}});\"><i class=\"icons on\"></i></button>"
|
"<button class=\"btn btn-xs\" onclick=\"requestJson({AudioReactive:{enabled:false}});\"><i class=\"icons on\"></i></button>"
|
||||||
@@ -65,13 +65,13 @@
|
|||||||
],
|
],
|
||||||
"Audio Source": [
|
"Audio Source": [
|
||||||
"I2S digital",
|
"I2S digital",
|
||||||
" - quiet"
|
" - peak 99%"
|
||||||
],
|
],
|
||||||
"Sound Processing": [
|
"Sound Processing": [
|
||||||
"running"
|
"running"
|
||||||
],
|
],
|
||||||
"AGC Gain": [
|
"AGC Gain": [
|
||||||
12.87,
|
9.83,
|
||||||
"x"
|
"x"
|
||||||
],
|
],
|
||||||
"UDP Sound Sync": [
|
"UDP Sound Sync": [
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"psave": 1,
|
||||||
|
"n": "Sunrise",
|
||||||
|
"ib": true,
|
||||||
|
"on": true,
|
||||||
|
"bri": 255,
|
||||||
|
"seg": [{ "id": 0, "fx": 0, "cct": 0 }]
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"on": true,
|
"on": true,
|
||||||
"bri": 128,
|
"bri": 255,
|
||||||
"transition": 0,
|
"transition": 0,
|
||||||
"ps": -1,
|
"ps": 1,
|
||||||
"pl": -1,
|
"pl": -1,
|
||||||
"ledmap": 0,
|
"ledmap": 0,
|
||||||
"AudioReactive": {
|
"AudioReactive": {
|
||||||
|
|||||||
Reference in New Issue
Block a user