Options
All
  • Public
  • Public/Protected
  • All
Menu

Client interface for WLED devices.

Hierarchy

  • IsomorphicEventEmitter
    • WLEDClient

Index

Constructors

Properties

JSONAPI: WLEDJSONAPI

Options that are set on the device.

List of effects available for this device.

Information about the device.

isReady: Promise<boolean>

Promise that is resolved when a successful connection has been made and the state has been retrieved.

lightCapabilities: WLEDClientLightCapabilities

Lighting capabilities of the device.

Live streaming data sources currently sending data.

nightlight: { get state(): WLEDClientNightlightState & { remaining?: number }; disable: any; enable: any; setDuration: any; setMode: any; setTargetBrightness: any; toggle: any } = ...

Methods relating to the nightlight feature.

Type declaration

  • get state(): WLEDClientNightlightState & { remaining?: number }

    State object of the nightlight feature

    alias

    WLEDClient.state.nightlight

  • disable:function
    • disable(): Promise<void>
  • enable:function
    • Activate the nightlight. Depending on the set mode, the device will fade towards the target brightness over the set duration.

      Parameters

      • with_state: number | Omit<Partial<WLEDClientNightlightState>, "on"> = {}

        Optional. Duration if number is passed, otherwise nightlight state object containing other properties to set while activating the nightlight

      Returns Promise<void>

  • setDuration:function
    • setDuration(value: number): Promise<void>
    • Set the length of time the nightlight feature will remain active for.

      Parameters

      • value: number

        Time in minutes, 1 to 255

      Returns Promise<void>

  • setMode:function
  • setTargetBrightness:function
    • setTargetBrightness(value: number): Promise<void>
    • Set the target brightness of the nightlight feature.

      Parameters

      • value: number

        0 to 255

      Returns Promise<void>

  • toggle:function
    • toggle(): Promise<void>
    • Change the nightlight state to the opposite of what it currently is.

      Returns Promise<void>

paletteDataCache: WLEDPalettesData

List of color palettes available for this device.

List of presets save on this device.

Device's current state.

Accessors

  • get wsReadyState(): 0 | 2 | 1 | 3
  • The ready state of the WebSocket instance.

    Returns 0 | 2 | 1 | 3

Methods

  • addEventListener(type: string, callback: null | EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void
  • Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

    The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

    When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

    When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in ยง 2.8 Observing event listeners.

    When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

    If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

    The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

    Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • allowLiveData(): Promise<void>
  • Allow live data to be displayed by the device.

    Returns Promise<void>

  • clearSegments(): Promise<void>
  • Clear the segment array completely.

    Returns Promise<void>

  • connect(): Promise<boolean>
  • Connect to the device's WebSocket API.

    Returns Promise<boolean>

  • Create a new segment and adds it to the segment array.

    Parameters

    Returns Promise<void>

  • deletePreset(id: number): Promise<void>
  • Delete a preset by its ID.

    Parameters

    • id: number

      ID of the preset to delete

    Returns Promise<void>

  • deleteSegment(id: number): Promise<void>
  • Delete a specific segment by id.

    Parameters

    • id: number

      ID of the segment to be removed

    Returns Promise<void>

  • disableUDPSync(): Promise<void>
  • disconnect(): void
  • Disconnect from the device's WebSocket API.

    Returns void

  • dispatchEvent(event: Event): boolean
  • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

    Parameters

    • event: Event

    Returns boolean

  • emit<T>(eventName: string, ...args: T): boolean
  • Type Parameters

    • T extends any[]

    Parameters

    • eventName: string
    • Rest ...args: T

    Returns boolean

  • enableUDPSync(options?: RequireAtLeastOne<{ receive?: boolean; send?: boolean }, "send" | "receive">): Promise<void>
  • ignoreLiveData(until_reboot?: boolean): Promise<void>
  • Ignore any live data if the device is currently being used to display the live data.

    Parameters

    • Optional until_reboot: boolean

      If false or undefined, the live data will be ignored until the live data stream ends. If true the device will ignore live data until it reboots.

    Returns Promise<void>

  • init(): Promise<undefined | boolean>
  • off(eventName: string, listener: ((...args: any[]) => void)): void
  • Parameters

    • eventName: string
    • listener: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

  • on(eventName: string, listener: ((...args: any[]) => void)): void
  • Parameters

    • eventName: string
    • listener: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

  • once(eventName: string, listener: ((...args: any[]) => void)): void
  • Parameters

    • eventName: string
    • listener: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

  • reboot(): Promise<void>
  • refreshConfig(): Promise<void>
  • Get the latest config from the device.

    Returns Promise<void>

  • refreshContext(options?: { config?: boolean; presets?: boolean }): Promise<void>
  • Get the latest context from the device.

    Parameters

    • options: { config?: boolean; presets?: boolean } = {}
      • Optional config?: boolean
      • Optional presets?: boolean

    Returns Promise<void>

  • refreshEffects(): Promise<void>
  • Get the latest effects from the device.

    Returns Promise<void>

  • refreshInfo(): Promise<void>
  • Get the latest info from the device.

    Returns Promise<void>

  • refreshPalettes(): Promise<void>
  • Get the latest palettes from the device.

    Returns Promise<void>

  • refreshPresets(): Promise<void>
  • Get the latest presets from the device.

    Returns Promise<void>

  • refreshState(): Promise<void>
  • Get the latest state from the device.

    Returns Promise<void>

  • removeEventListener(type: string, callback: null | EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void
  • Removes the event listener in target's event listener list with the same type, callback, and options.

    Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | EventListenerOptions

    Returns void

  • setMainSegmentId(id: number): Promise<void>
  • Set which segment should be considered the main one.

    Parameters

    • id: number

      ID of the main segment

    Returns Promise<void>

  • setPreset(id: number): Promise<void>
  • Activate a new preset.

    Parameters

    • id: number

      ID of the desired preset

    Returns Promise<void>

  • setTransitionTime(value: number): Promise<void>
  • Duration of the crossfade between different colors/brightness levels.

    Parameters

    • value: number

      Time in 100ms intervals (eg. 4 is 400ms), 0 to 255

    Returns Promise<void>

  • startLEDStream(): Promise<void>
  • Start a live stream of LED values from the device via the WebSocket API. Listen to the update:leds event (e.g. wled.addEventListener('update:leds', cb)).

    Returns Promise<void>

  • stopLEDStream(): Promise<void>
  • Stop the live stream of LED values from the device.

    Returns Promise<void>

  • toggleLEDStream(): Promise<void>
  • Start the live stream if it is stopped, or stop the live stream if it is started

    Returns Promise<void>

Generated using TypeDoc