Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[unifi] Provide LED channels for access point #17534

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jlaur
Copy link
Contributor

@jlaur jlaur commented Oct 9, 2024

Adds new channels for controlling LED on access point:

  • ledOverride: When OFF, the site-wide setting for device LED is used, otherwise channel ledColor is applied.
  • ledColor: This controls the color of the LED. Please note that some AP's might not support colors. The channel can be linked to a Switch item for simply turning the LED on or off.

TODO:

  • README
  • Update instructions
  • I18N properties
  • Channel ledColor should be advanced like ledOverride (or none of them should be)
  • Fully synchronize color/brightness/on-off (black = off, so when turning on, color should set to something not black)

This PR conflicts with #17530 and will need to be rebased after merging that.

JAR for testing: org.openhab.binding.unifi-4.3.0-SNAPSHOT.jar

Test report

Tests are performed with an access point only supporting blue color and not setable brightness. Each test has an initial state, a visual result and a verification of the persisted values for the device. Items:

  • Switch LED_Override linked to channel ledOverride
  • Color LED_Color linked to channel ledColor
  • Dimmer LED_Brightness linked to channel ledColor
  • Switch LED_Switch linked to channel ledColor
Testcase Status
Default → Override Passed
Override → Default Passed
Default: Brightness 100 → 50 Passed
Default: Brightness 50, Color Blue → Green Passed
Default: Brightness 100, Color Blue → Green Passed
Default, Brightness 50, Color Green → Override Passed
Override, Brightness 50, Color Green → Brightness 0 Passed
Override, Brightness 0, Color Green → Brightness 1 Passed
Override, Brightness 0, Color Green → ON Passed
  1. Default → Override
    Initial state:

    • Visual: LED off
    • LED_Override: OFF
    • LED_Color: 240.000,100,100
    • LED_Brightness: 100
    • LED_Switch: ON
    "led_override": "default",
    "led_override_color": "#0000ff",
    "led_override_color_brightness": 100,

    Action:

    openhab:send LED_Override ON

    Result:

    • Visual: LED on
    • LED_Override: ON
    • LED_Color: 240.000,100,100
    • LED_Brightness: 100
    • LED_Switch: ON
    "led_override": "on",
    "led_override_color": "#0000ff",
    "led_override_color_brightness": 100,
  2. Override → Default
    Initial state:

    • Visual: LED on
    • LED_Override: ON
    • LED_Color: 240.000,100,100
    • LED_Brightness: 100
    • LED_Switch: ON
    "led_override": "on",
    "led_override_color": "#0000ff",
    "led_override_color_brightness": 100,

    Action:

    openhab:send LED_Override OFF

    Result:

    • Visual: LED off
    • LED_Override: OFF
    • LED_Color: 240.000,100,100
    • LED_Brightness: 100
    • LED_Switch: ON
    "led_override": "default",
    "led_override_color": "#0000ff",
    "led_override_color_brightness": 100,
  3. Default: Brightness 100 → 50
    Initial state:

    • Visual: LED off
    • LED_Override: OFF
    • LED_Color: 240.000,100,100
    • LED_Brightness: 100
    • LED_Switch: ON
    "led_override": "default",
    "led_override_color": "#0000ff",
    "led_override_color_brightness": 100,

    Action:

    openhab:send LED_Brightness 50

    Result:

    • Visual: LED off
    • LED_Override: OFF
    • LED_Color: 240.000,100,50
    • LED_Brightness: 50
    • LED_Switch: ON
    "led_override": "default",
    "led_override_color": "#0000ff",
    "led_override_color_brightness": 50,
  4. Default: Brightness 50, Color Blue → Green
    Initial state:

    • Visual: LED off
    • LED_Override: OFF
    • LED_Color: 240.000,100,50
    • LED_Brightness: 50
    • LED_Switch: ON
    "led_override": "default",
    "led_override_color": "#0000ff",
    "led_override_color_brightness": 50,

    Action:

    openhab:send LED_Color 120.000,100,50

    Result:

    • Visual: LED off
    • LED_Override: OFF
    • LED_Color: 240.000,100,50
    • LED_Brightness: 50
    • LED_Switch: ON
    "led_override": "default",
    "led_override_color": "#008000",
    "led_override_color_brightness": 50,

    Comment: Was #008000, now fixed to to #00ff00 since brightness is separate.

  5. Default: Brightness 100, Color Blue → Green
    Initial state:

    • Visual: LED off
    • LED_Override: OFF
    • LED_Color: 240.000,100,100
    • LED_Brightness: 100
    • LED_Switch: ON
    "led_override": "default",
    "led_override_color": "#0000ff",
    "led_override_color_brightness": 100,

    Action:

    openhab:send LED_Color 120.000,100,100

    Result:

    • Visual: LED off
    • LED_Override: OFF
    • LED_Color: 240.000,100,100
    • LED_Brightness: 100
    • LED_Switch: ON
    "led_override": "default",
    "led_override_color": "#00ff00",
    "led_override_color_brightness": 100,
  6. Default, Brightness 50, Color Green → Override
    Initial state:

    • Visual: LED off
    • LED_Override: OFF
    • LED_Color: 120.000,100,50
    • LED_Brightness: 50
    • LED_Switch: ON
    "led_override": "default",
    "led_override_color": "#00ff00",
    "led_override_color_brightness": 50,

    Action:

    openhab:send LED_Override ON

    Result:

    • Visual: LED on
    • LED_Override: ON
    • LED_Color: 120.000,100,50
    • LED_Brightness: 50
    • LED_Switch: ON
    "led_override": "on",
    "led_override_color": "#00ff00",
    "led_override_color_brightness": 50,
  7. Override, Brightness 50, Color Green → Brightness 0
    Initial state:

    • Visual: LED on
    • LED_Override: ON
    • LED_Color: 120.000,100,50
    • LED_Brightness: 50
    • LED_Switch: ON
    "led_override": "on",
    "led_override_color": "#00ff00",
    "led_override_color_brightness": 50,

    Action:

    openhab:send LED_Brightness 0

    Result:

    • Visual: LED off
    • LED_Override: ON
    • LED_Color: 0,0,0
    • LED_Brightness: 0
    • LED_Switch: OFF
    "led_override": "off",
    "led_override_color": "#00ff00",
    "led_override_color_brightness": "0",

    Comment: Color is preserved on device.

  8. Override, Brightness 0, Color Green → Brightness 1
    Initial state:

    • Visual: LED off
    • LED_Override: ON
    • LED_Color: 0,0,0
    • LED_Brightness: 0
    • LED_Switch: OFF
    "led_override": "off",
    "led_override_color": "#00ff00",
    "led_override_color_brightness": "0",

    Action:

    openhab:send LED_Brightness 1

    Result:

    • Visual: LED on
    • LED_Override: ON
    • LED_Color: 120.000,100,1
    • LED_Brightness: 1
    • LED_Switch: ON
    "led_override": "on",
    "led_override_color": "#00ff00",
    "led_override_color_brightness": "1",
  9. Override, Brightness 0, Color Green → ON
    Initial state:

    • Visual: LED off
    • LED_Override: ON
    • LED_Color: 0,0,0
    • LED_Brightness: 0
    • LED_Switch: OFF
    "led_override": "off",
    "led_override_color": "#00ff00",
    "led_override_color_brightness": "0",

    Action:

    openhab:send LED_Switch ON

    Result:

    • Visual: LED on
    • LED_Override: ON
    • LED_Color: 120.000,100,100
    • LED_Brightness: 100
    • LED_Switch: ON
    "led_override": "on",
    "led_override_color": "#00ff00",
    "led_override_color_brightness": "100",

@jlaur jlaur added enhancement An enhancement or new feature for an existing add-on additional testing preferred The change works for the pull request author. A test from someone else is preferred though. labels Oct 9, 2024
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/ubiquiti-unifi-binding-feature-discussion/14520/1307

@jlaur jlaur force-pushed the unifi-led-color branch 3 times, most recently from 036fba2 to 104915e Compare October 14, 2024 21:07
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
additional testing preferred The change works for the pull request author. A test from someone else is preferred though. enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants