Skip to content

feat: Add support for the AudioReactive usermod#2086

Open
mcaulifn wants to merge 3 commits into
frenck:mainfrom
mcaulifn:mcaulifn/audio-reactive
Open

feat: Add support for the AudioReactive usermod#2086
mcaulifn wants to merge 3 commits into
frenck:mainfrom
mcaulifn:mcaulifn/audio-reactive

Conversation

@mcaulifn

@mcaulifn mcaulifn commented Jun 11, 2026

Copy link
Copy Markdown

Proposed Changes

This PR adds support for the AudioReactive usermod, which provides sound-reactive effects on WLED devices equipped with a microphone or receiving audio via UDP sound sync.

  • Adds an AudioReactive model, exposed as State.audio_reactive. It is None when the usermod is not installed on the device, so existing devices are unaffected.
  • Adds a WLED.audio_reactive(on=...) method to enable or disable the usermod.

Related Issues

Summary by CodeRabbit

  • New Features
    • Added support for the AudioReactive usermod, enabling control of audio-reactive lighting modes.
  • Bug Fixes
    • Improved state handling for AudioReactive so it’s correctly represented when present or omitted.
  • Tests
    • Added coverage for AudioReactive state serialization/deserialization and verified the control request payload.

Copilot AI review requested due to automatic review settings June 11, 2026 01:06
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 075d09e6-d0e9-4d26-9cc2-7767f29a6b0d

📥 Commits

Reviewing files that changed from the base of the PR and between 6d362d0 and 8ac61be.

📒 Files selected for processing (1)
  • tests/__snapshots__/test_models.ambr

📝 Walkthrough

Walkthrough

This PR adds WLED AudioReactive usermod support by defining a data model for the feature, exporting it publicly, implementing a control method, and providing comprehensive test coverage for model deserialization and API integration alongside snapshot updates.

Changes

AudioReactive Usermod Feature

Layer / File(s) Summary
AudioReactive data model
src/wled/models.py
AudioReactive dataclass with on: bool field and new audio_reactive: AudioReactive | None field on State (alias "AudioReactive").
Public API export
src/wled/__init__.py
AudioReactive imported from models and added to __all__ for public API availability.
Audio reactive control method
src/wled/wled.py
New async def audio_reactive(self, *, on: bool) -> None method POSTs {"AudioReactive": {"enabled": on}} to /json/state endpoint.
Model and integration tests with snapshots
tests/test_models.py, tests/test_wled.py, tests/__snapshots__/test_models.ambr
Tests verify audio_reactive deserializes to None when absent and correctly captures on flag when present; integration tests confirm POST payload with both True and False cases; snapshots updated across device fixtures to reflect the new audio_reactive field.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

🐰 A rabbit hops with audio cheer,
Reactive beats now crystal clear!
Toggle on with just a call,
The usermod dances through it all! 🎵

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: Add support for the AudioReactive usermod' clearly and accurately summarizes the main change: introducing support for a new WLED AudioReactive usermod feature.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds first-class support for the WLED “AudioReactive” usermod, including state deserialization and a client API to toggle it.

Changes:

  • Add AudioReactive model and expose it on State as audio_reactive.
  • Add WLED.audio_reactive(on=...) to toggle the usermod via /json/state.
  • Add unit tests for deserialization and request payload generation.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/test_wled.py Adds client-level test for posting AudioReactive enable/disable payload.
tests/test_models.py Adds model tests for presence/absence of State.audio_reactive.
src/wled/wled.py Adds audio_reactive() client method posting the usermod toggle.
src/wled/models.py Introduces AudioReactive model and adds it to State with aliasing.
src/wled/init.py Exports AudioReactive as part of the public package API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/wled/wled.py
Comment thread src/wled/__init__.py
Comment thread src/wled/__init__.py
@mcaulifn

Copy link
Copy Markdown
Author

@mik-laj Any chance you can add a label to allow the checks to run?

@mik-laj mik-laj added the new-feature New features or options. label Jun 21, 2026
CI on PR frenck#2086 failed because the device fixture snapshots didn't
account for the new audio_reactive field on State.
Copilot AI review requested due to automatic review settings June 22, 2026 11:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature New features or options.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants