Skip to content

Commit

Permalink
Add functions to control the LED of an access point
Browse files Browse the repository at this point in the history
  • Loading branch information
theimo1221 committed Dec 15, 2024
1 parent 6ccbe86 commit fed0de2
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions unifi.js
Original file line number Diff line number Diff line change
Expand Up @@ -2139,6 +2139,48 @@ class Controller extends EventEmitter {
return this._request('/api/s/<SITE>/rest/device/' + ap_id.trim(), {disabled: disable}, 'PUT');
}

/**
* Override LED settings for a device (using REST)
*
* required parameter <device_id> = 24 char string; value of _id for the device which can be obtained from the device list
* required parameter <override_color> = string, hexCode; "#ff0000" sets LED to full red.
* required parameter <override_color_brightness> = string, 0-100; "100" sets LED to full brightness.
* required parameter <override_mode> = string, off/on/default; "off" disables the LED of the device,
* "on" enables the LED of the device,
* "default" applies the site-wide setting for device LEDs
*/
setLED(device_id, override_color, override_color_brightness, override_mode) {
return this._request(
'/api/s/<SITE>/rest/device/' + device_id.trim(),
{
led_override: override_mode,
led_override_color: override_color,
led_override_color_brightness: override_color_brightness
},
'PUT'
);
}

/**
* Override LED Brightness for a device (using REST) - led_override_color_brightness()
*
* required parameter <device_id> = 24 char string; value of _id for the device which can be obtained from the device list
* required parameter <override_color_brightness> = string, 0-100; "100" sets LED to full brightness.
*/
setLEDBrightness(device_id, override_color_brightness) {
return this._request('/api/s/<SITE>/rest/device/' + device_id.trim(), {led_override_color_brightness: override_color_brightness}, 'PUT');
}

/**
* Override LED Color for a device (using REST) - led_override_color()
*
* required parameter <device_id> = 24 char string; value of _id for the device which can be obtained from the device list
* required parameter <override_color> = string, hexCode; "#ff0000" sets LED to full red.
*/
setLEDColor(device_id, override_color) {
return this._request('/api/s/<SITE>/rest/device/' + device_id.trim(), {led_override_color: override_color}, 'PUT');
}

/**
* Override LED mode for a device (using REST) - led_override()
*
Expand Down

0 comments on commit fed0de2

Please sign in to comment.