Skip to content

Allow applying an existing preset to a specific segment via JSON API #5868

Description

@d3nn3s08

Is your feature request related to a problem? Please describe
I'm integrating WLED into an external application that uses a single LED strip with multiple segments to display the status of multiple devices (for example, multiple 3D printers).
Each device has the same set of states:

  • Idle
  • Preparing
  • Printing
  • Paused
  • Finished
  • Failed
  • Filament Error
  • HMS Error
  • Waiting
  • Offline
    Currently, presets are tied to the segment information stored inside the preset.
    This means that if I have 20 devices with the same 10 states, I need to create 200 presets (20 × 10), even though the only difference between those presets is the target segment.
    During testing with WLED 16.0.0 I tried using the JSON API like this:
    {
    "seg": [
    {
    "id": 0,
    "ps": 11
    }
    ]
    }
    The request is accepted (HTTP 200), but the preset is not applied.
    I also tested storing multiple segments inside one preset and setting the non-target segment to "on": false, hoping WLED would ignore those segments.
    Instead, WLED actively applies the stored "on": false state and turns the other segment off, also restoring its stored colour and brightness.
    The only reliable solution I found is creating partial presets using "Checked segments only", which means creating one preset for every state and every segment.
    This works reliably, but requires a large number of nearly identical presets.
    The solution you'd like
    It would be useful if the JSON API supported applying an existing preset to a specific segment without requiring the preset itself to contain segment-specific information.
    For example:
    {
    "ps": 3,
    "segment": 5
    }
    or any other officially supported mechanism that allows reusing the same preset across different segments.
    The preset would define only the visual appearance:
  • colors
  • effects
  • palettes
  • brightness
  • transitions
    while the API request would specify which segment should receive those settings.
    This would significantly reduce the number of required presets for installations with many segments while remaining fully backwards compatible.
    Alternatives you've considered
    I tested several alternatives:
  1. One preset per state and per segment
    Works reliably.
    Example:
    20 segments × 10 states = 200 presets.
    This is currently the only reliable solution I found.
  2. Segment-specific preset activation
    {
    "seg": [
    {
    "id": 5,
    "ps": 3
    }
    ]
    }
    Accepted by WLED 16.0.0, but had no observable effect.
  3. Store multiple segments in one preset
    I tried storing all segments inside the preset while setting the non-target segments to:
    "on": false
    Unfortunately this does not behave as an "ignore this segment" flag.
    Instead, WLED actively applies the stored state and turns those segments off.
    Additional Context
    The behaviour described above was verified on a real WLED 16.0.0 installation using two persistent segments and repeated live testing.
    I'm not requesting a specific implementation.
    If there is already an officially supported way to reuse presets across multiple segments, I'd be very happy to learn about it.
    Otherwise, I think such a capability could be useful not only for my project but also for any application that uses WLED as a multi-device status indicator.
    Thanks for creating and maintaining WLED!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions