#hs.milight

Simple controls for the MiLight LED WiFi bridge (also known as LimitlessLED and EasyBulb)


#API Overview

Constants - Useful values which cannot be changed

Constructors - API calls which return an object, typically one that offers API methods

Methods - API calls which can only be made on an object returned by a constructor


#API Documentation

#Constants

Signaturehs.milight.maxBrightness
TypeConstant
DescriptionSpecifies the maximum brightness value that can be used. Defaults to 25
NotesNone
Sourceextensions/milight/milight.lua line 14

Signaturehs.milight.minBrightness
TypeConstant
DescriptionSpecifies the minimum brightness value that can be used. Defaults to 0
NotesNone
Sourceextensions/milight/milight.lua line 9

#Constructors

Signaturehs.milight.new(ip[, port]) -> bridge
TypeConstructor
DescriptionCreates a new bridge object, which will be connected to the supplied IP address and port
Parameters
  • ip - A string containing the IP address of the MiLight WiFi bridge device. For convenience this can be the broadcast address of your network (e.g. 192.168.0.255)
  • port - An optional number containing the UDP port to talk to the bridge on. Defaults to 8899
Returns
  • An hs.milight object
Notes
  • You can not use 255.255.255.255 as the IP address, to do so requires elevated privileges for the Hammerspoon process
ExamplesNone
Sourceextensions/milight/libmilight.m line 73

#Methods

Signaturehs.milight:delete()
TypeMethod
DescriptionDeletes an hs.milight object
Parameters
  • None
Returns
  • None
NotesNone
ExamplesNone
Sourceextensions/milight/libmilight.m line 121

Signaturehs.milight:disco() -> bool
TypeMethod
DescriptionCycles through the disco modes
Parameters
  • None
Returns
  • True if the command was sent correctly, otherwise false
NotesNone
ExamplesNone
Sourceextensions/milight/milight.lua line 90

Signaturehs.milight:send(cmd[, value]) -> bool
TypeMethod
DescriptionSends a command to the bridge
Parameters
  • cmd - A command from the hs.milight.cmd table
  • value - An optional value, if appropriate for the command (defaults to 0x00)
Returns
  • True if the command was sent, otherwise false
Notes
  • This is a low level command, you typically should use a specific method for the operation you want to perform
ExamplesNone
Sourceextensions/milight/libmilight.m line 140

Signaturehs.milight:zoneBrightness(zone, value) -> integer
TypeMethod
DescriptionSets brightness for the specified zone
Parameters
  • zone - A number specifying which zone to operate on. 0 for all zones, 1-4 for zones one through four
  • value - A number containing the brightness level to set, between hs.milight.minBrightness and hs.milight.maxBrightness
Returns
  • A number containing the value that was sent to the WiFi bridge, or -1 if an error occurred
NotesNone
ExamplesNone
Sourceextensions/milight/milight.lua line 107

Signaturehs.milight:zoneColor(zone, value) -> bool
TypeMethod
DescriptionSets RGB color for the specified zone
Parameters
  • zone - A number specifying which zone to operate on. 0 for all zones, 1-4 for zones one through four
  • value - A number between 0 and 255 that represents a color
Returns
  • True if the command was sent correctly, otherwise false
Notes
  • The color value is not a normal RGB colour, but rather a lookup in an internal table in the light hardware. While any number between 0 and 255 is valid, there are some useful values worth knowing:
  • 00 - Violet
  • 16 - Royal Blue
  • 32 - Baby Blue
  • 48 - Aqua
  • 64 - Mint Green
  • 80 - Seafoam Green
  • 96 - Green
  • 112 - Lime Green
  • 128 - Yellow
  • 144 - Yellowy Orange
  • 160 - Orange
  • 176 - Red
  • 194 - Pink
  • 210 - Fuchsia
  • 226 - Lilac
  • 240 - Lavender
ExamplesNone
Sourceextensions/milight/milight.lua line 121

Signaturehs.milight:zoneOff(zone) -> bool
TypeMethod
DescriptionTurns off the specified zone
Parameters
  • zone - A number specifying which zone to operate on. 0 for all zones, 1-4 for zones one through four
Returns
  • True if the command was sent correctly, otherwise false
NotesNone
ExamplesNone
Sourceextensions/milight/milight.lua line 64

Signaturehs.milight:zoneOn(zone) -> bool
TypeMethod
DescriptionTurns on the specified zone
Parameters
  • zone - A number specifying which zone to operate on. 0 for all zones, 1-4 for zones one through four
Returns
  • True if the command was sent correctly, otherwise false
NotesNone
ExamplesNone
Sourceextensions/milight/milight.lua line 77

Signaturehs.milight:zoneWhite(zone) -> bool
TypeMethod
DescriptionSets the specified zone to white
Parameters
  • zone - A number specifying which zone to operate on. 0 for all zones, 1-4 for zones one through four
Returns
  • True if the command was sent correctly, otherwise false
NotesNone
ExamplesNone
Sourceextensions/milight/milight.lua line 154