Class Light

Represents a Twinkly device

Hierarchy

  • Light

Constructors

  • Creates an instance of Light.

    Parameters

    • ipaddr: string

      IP Address of the Twinkly device

    • timeout: number = 20000
    • useFetch: boolean = false

    Returns Light

Properties

activeLoginCall: boolean
challenge: string
ipaddr: string
net: default | AxiosInstance
nleds: undefined | number
token: undefined | AuthenticationToken
udpClient: any

Methods

  • Add a movie to the device

    Parameters

    Returns Promise<any>

    response from device

  • Automatically ends a login call after 1 second

    Returns Promise<void>

  • Create a new playlist

    Parameters

    • playlist: object

    Returns Promise<object>

    response from device

  • Returns Promise<any>

    response from device

  • Ensure that we are logged into to the device, and if not initiate a login request

    Returns Promise<void>

  • Gets the current brightness level

    Returns Promise<number>

    Current brightness in range 0..100

  • Get the current movie

    Returns Promise<object>

    response from device

  • Get the movie config from the device

    Returns Promise<any>

    response from device

  • Get the current MQTT config

    Returns Promise<object>

    MQTT config

  • Get the number of LEDs in the device

    Returns Promise<number>

    number of LEDs in the device

  • Get the name of the device

    Returns Promise<string>

    Name of device

  • Get network status

    Returns Promise<object>

    response from device

  • Get the current playlist

    Returns Promise<object>

    response from device

  • Returns Promise<number>

    Current saturation in range 0..100

  • Get device summary

    Returns Promise<any>

    response from device

  • Sends a login request

    Returns Promise<void>

  • Sends a logout request

    Returns Promise<void>

  • Sends a DELETE request to the device, appending the required tokens

    Parameters

    • url: string
    • data: any

    Returns Promise<any>

  • Sends a GET request to the device, appending the required tokens

    Parameters

    • url: string
    • Optional params: object
    • requiresToken: boolean = true

    Returns Promise<any>

  • Send a movie config to the device

    Parameters

    Returns Promise<any>

  • Send a movie to the device

    Parameters

    Returns Promise<any>

  • Sends a POST request to the device, appending the required tokens

    Parameters

    • url: string
    • data: any = {}
    • contentType: string = "application/json"

    Returns Promise<any>

  • Send a realtime frame to device

    Parameters

    Returns Promise<any>

  • Send a realtime frame to device via UDP WARNING: This only works with nodejs

    Parameters

    Returns Promise<void>

  • Sets the brightness level

    Parameters

    • value: number
    • Optional mode: string = "enabled"
    • Optional type: string = "A"

    Returns Promise<void>

  • Set the current movie

    Parameters

    • id: number

    Returns Promise<object>

    response from device

  • Sets the color in HSV when in color mode

    Parameters

    Returns Promise<void>

  • Sets the LED operation mode

    Parameters

    Returns Promise<void>

  • Set the MQTT config

    Parameters

    • config: object

    Returns Promise<object>

    response from device

  • Sets the name of the device

    Parameters

    • name: string

      Desired device name, max 32 charachters

    Returns Promise<void>

  • Set network status

    Parameters

    • status: object

    Returns Promise<object>

  • Turns the device off

    Returns Promise<void>

  • Sets the color in RGB when in color mode

    Parameters

    Returns Promise<void>

  • Sets the saturation level

    Parameters

    • value: number
    • mode: string = "enabled"
    • type: string = "A"

    Returns Promise<void>

  • Experimental

    Sets the state

    Parameters

    • state: boolean

      Set on/off

    Returns Promise<void>

  • Sets the time when lights will turn on and off

    Parameters

    Returns Promise<void>

  • Upload a layout of LEDs to the device

    Parameters

    • coordinates: coordinate[]
    • source: string = "3D"
    • synthesized: boolean = false
    • aspectXY: number = 0
    • aspectXZ: number = 0

    Returns Promise<any>

  • Check that we are logged in to the device

    Returns Promise<void>

Generated using TypeDoc