Skip to content

Fix TypeError in UniFi LED brightness control#1

Closed
Sese-Schneider wants to merge 2 commits into
devfrom
Sese-Schneider-patch-1
Closed

Fix TypeError in UniFi LED brightness control#1
Sese-Schneider wants to merge 2 commits into
devfrom
Sese-Schneider-patch-1

Conversation

@Sese-Schneider
Copy link
Copy Markdown
Owner

Proposed change

Fixes a TypeError in the UniFi LED brightness control.

Stacktrace
[31m2025-11-06 10:03:52.668 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [546689866048] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 270, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2816, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2859, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 830, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
        hass, entity, func, data, call.context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 902, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 651, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/usr/src/homeassistant/homeassistant/components/unifi/light.py", line 140, in async_turn_on
    await self.entity_description.control_fn(self.hub, self._obj_id, True, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/unifi/light.py", line 72, in async_device_led_control_fn
    DeviceSetLedStatus.create(
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
        device=device,
        ^^^^^^^^^^^^^^
    ...<2 lines>...
        color=color,
        ^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiounifi/models/device.py", line 847, in create
    if not (0 <= brightness <= 100):
            ^^^^^^^^^^^^^^^^^^^^^^

Related:

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@Sese-Schneider Sese-Schneider deleted the Sese-Schneider-patch-1 branch November 19, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unifi E7 LED turned off once... now error.

1 participant