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 = 1000

    Returns Light

Properties

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

Methods

  • Parameters

    Returns Promise<void>

  • Returns Promise<void>

  • 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

  • Returns Promise<any>

  • Returns Promise<number>

  • Get the name of the device

    Returns Promise<string>

    Name of device

  • Gets time when lights will turn on and off

    Returns Promise<timer>

  • Sends a login request

    Returns Promise<void>

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

    Parameters

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

    Returns Promise<any>

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

    Parameters

    • url: string
    • params: object

    Returns Promise<any>

  • Parameters

    Returns Promise<any>

  • Parameters

    Returns Promise<void>

  • Sets the brightness level

    Parameters

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

    Returns Promise<void>

  • Sets the colour in HSV when in colour mode

    Parameters

    Returns Promise<void>

  • Sets the LED operation mode

    Parameters

    Returns Promise<void>

  • Sets the name of the device

    Parameters

    • name: string

      Desired device name, max 32 charachters

    Returns Promise<void>

  • Turns the device off

    Returns Promise<void>

  • Sets the colour in RGB when in colour mode

    Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Experimental

    Sets the state

    Parameters

    • state: boolean

      Set on/off

    Returns Promise<void>

  • Check that we are logged in to the device

    Returns Promise<void>

Generated using TypeDoc