mculed

Homebridge plugin to connect to nodeMCU devices via websockets

mculed(log: any, config: aliases, api: any)
Parameters
log (any)
config (aliases) Friendly names for your devices
api (any)
Example
config.json sample
{
   "platform": "mculed",
   "name": "mculed",
   "aliases": {
    "NODE-AC5812": "Kitchen Sink"
  }
}

configureAccessory

Called on startup of Homebridge, once per accessory

configureAccessory()

openSocket

This function opens a socket connection to the nodeMCU device

openSocket(accessory: any)
Parameters
accessory (any)

onMessage

Parsing of messages received nodeMCU devices

onMessage(accessory: any, response: any)
Parameters
accessory (any)
response (any)

wsSend

Send message to nodeMCU device

wsSend(message: any, callback: any)
Parameters
message (any)
callback (any)

didFinishLaunching

Called on startup of Homebridge, after initialization is complete Discover mculed devices using mDNS/Bonjour Creates homebridge device, once per discovered accessory

didFinishLaunching()

mcuModel

Call nodeMCU device and return configuration string

mcuModel(url: string, callback: function)
Parameters
url (string) URL of nodeMCU device
callback (function) Callback function to call when message or received

setOn

Turn on nodeMCU device

setOn()

setModeOn

Turn on and rotate thru the primary colors

setModeOn()

setXmasOn

Turn on and rotate thru the primary colors

setXmasOn()

setBrightness

Set brightness of nodeMCU device

setBrightness()

setHue

Set hue of nodeMCU device

setHue()

setSaturation

Set color saturation of nodeMCU device

setSaturation()

setColorTemperature

Set color temperature of nodeMCU device

setColorTemperature()

addMcuAccessory

Add MCU Device

addMcuAccessory()

addResetSwitch

Reset switch checks if each device is on the network and if it isn't found, removes it

addResetSwitch()

Identify

Am using the Identify function to validate a device, and if it doesn't respond remove it from the config

Identify()