Commit Graph
321 Commits
Author SHA1 Message Date
imonlinux 68c7930405 Update linux-voice-assistant-2mic-install.md
typo
2026-01-11 16:30:45 -08:00
imonlinux 7abceb946e Delete docs/xvf3800_usb_led_testing.md
Obsolete
2026-01-11 15:47:56 -08:00
imonlinux 5b1ef20656 Update linux-voice-assistant-xvf3800.md
Updated to include all of the information needed to install and configure the XVF3800.
2026-01-11 15:46:26 -08:00
imonlinux c527f60681 Create linux-voice-assistant_xvf3800.service
Added wants and after for pipewire.
2026-01-11 15:38:45 -08:00
imonlinux 4b6b6dd380 Update button_controller.py
Summary

Optimize GPIO button polling interval

Problem

Aggressive polling at 100 Hz (10ms interval) unnecessarily high for human button presses, causing elevated CPU usage with no benefit to responsiveness.

Changes

Changed default poll_interval_seconds from 0.01 to 0.05 (100 Hz → 20 Hz)
Updated ButtonRuntimeConfig dataclass default
Updated fallback default in constructor
2026-01-10 13:26:19 -08:00
imonlinux 67abca1111 Update xvf3800_button_controller.py
Summary

Add USB context manager support and optimize polling interval

Problem

Missing context manager: USB resources could leak on exceptions
Aggressive polling: 100 Hz (10ms) unnecessarily high for human button presses
Changes

Context Manager Support (Critical Fix B)

Added __enter__ and __exit__ methods to XVF3800USBClient class
Enhanced close() with proper null checks and error handling
Enables safe with statement usage
Polling Optimization (Critical Fix C)

Changed default poll_interval_seconds from 0.01 to 0.05 (100 Hz → 20 Hz)
Updated XVF3800ButtonRuntimeConfig dataclass default
Updated fallback default in __init__ constructor
2026-01-10 13:25:29 -08:00
imonlinux d10cf87eef Update xvf3800_led_backend.py
Problem

XVF3800 LED ring worked inconsistently (~50% success rate at startup) due to: 1. Timing race: LED commands sent before WS2812 power (X0D33) enabled 2. Missing context manager: USB resources could leak on exceptions

Changes

Context Manager Support (Critical Fix B)

Added __enter__ and __exit__ methods to _ReSpeaker class
Enhanced close() with proper null checks and error handling
Enables safe with statement usage
LED Power Management (NEW Critical Fix)

Proactive initialization: Enable X0D33 immediately in __init__ before any LED operations
Defensive runtime checks: Added _ensure_led_power() helper method
Power verification: Check X0D33 state before set_effect() and set_ring_colors()
Added 50ms settle time after enabling power
Documentation

Added GPO_WRITE_VALUE and GPO_READ_VALUES to PARAMETERS dict
Added GPO_WS2812_POWER_INDEX constant for clarity
Enhanced inline comments explaining power management
2026-01-10 13:24:38 -08:00
imonlinux 1da9ac1fac Update audio_engine.py
Summary

Add thread-safe locking for wake word reload logic

Problem

Wake word reload logic accessed self.state.wake_words_changed flag without synchronization, creating a potential race condition when wake words are dynamically switched via Home Assistant.

Changes

Added self._wake_words_lock = threading.Lock() in __init__
Wrapped wake word reload block with with self._wake_words_lock: context manager
Ensures atomic read-modify-write of wake_words_changed flag
Impact

Risk: Very low - purely defensive improvement
Benefit: Eliminates race condition in wake word switching
Performance: Negligible overhead (lock only held during reload check)
2026-01-10 13:23:33 -08:00
imonlinux fed867936a Update xvf3800_button_controller.py
Fix physical mute button not illuminating the led ring with the Mute State.
2026-01-10 11:50:02 -08:00
imonlinux 90fa3a9df7 Update pyproject.toml
updated the aioesphomeapi dependency to 43.9.1
2026-01-08 08:47:37 -08:00
imonlinux 05817ceb58 Update config.json.example
Added volume_sync and max_volume_percent options.
2026-01-06 13:46:32 -08:00
imonlinux 010e5447df Update __main__.py
Add volume max percentage and config for volume sync.
2026-01-06 13:37:00 -08:00
imonlinux 6866358dfe Update config.py
Add volume max percentage and config for volume sync.
2026-01-06 13:36:28 -08:00
imonlinux 7891997392 Update audio_volume.py
Add volume max percentage and config for volume sync.
2026-01-06 13:35:52 -08:00
imonlinux cc2a7a6206 Update audio_volume.py
version mismatch fix
2026-01-06 12:22:34 -08:00
imonlinux 1a1c15f836 Update __main__.py
version mismatch fix
2026-01-06 12:21:54 -08:00
imonlinux cfc24f6b73 Update config.py
Fix self shot foot.
2026-01-06 12:03:44 -08:00
imonlinux 4da78c7435 Update mpv_player.py
What this fixes:

On boot, if PipeWire/Pulse starts with the sink at ~40%, LVA now pushes the sink volume to match the persisted LVA volume (0.0–1.0).

When you move the HA media_player volume slider, LVA now updates:

wpctl (PipeWire) if available

pactl (PulseAudio / PipeWire-Pulse) if available

amixer (ALSA) as a fallback

No reboot / alsactl store required — LVA simply re-applies the persisted volume at start.
2026-01-05 21:52:41 -08:00
imonlinux 8a9939cf62 Update __main__.py
What this fixes:

On boot, if PipeWire/Pulse starts with the sink at ~40%, LVA now pushes the sink volume to match the persisted LVA volume (0.0–1.0).

When you move the HA media_player volume slider, LVA now updates:

wpctl (PipeWire) if available

pactl (PulseAudio / PipeWire-Pulse) if available

amixer (ALSA) as a fallback

No reboot / alsactl store required — LVA simply re-applies the persisted volume at start.
2026-01-05 21:52:02 -08:00
imonlinux eb4c4c26c8 Update config.py
What this fixes:

On boot, if PipeWire/Pulse starts with the sink at ~40%, LVA now pushes the sink volume to match the persisted LVA volume (0.0–1.0).

When you move the HA media_player volume slider, LVA now updates:

wpctl (PipeWire) if available

pactl (PulseAudio / PipeWire-Pulse) if available

amixer (ALSA) as a fallback

No reboot / alsactl store required — LVA simply re-applies the persisted volume at start.
2026-01-05 21:51:21 -08:00
imonlinux a1b460391d Add audio_volume.py
This helper script keeps the LVA media player volume and the OS device volume synchronized.
2026-01-05 21:46:15 -08:00
imonlinux 0f3c7d6c15 Update led_controller.py
Updated to align with the new XVF3800 initialization pathway / preflight behavior.

Keeps XVF3800 behavior isolated to XVF3800 mode so other LED backends remain unchanged.
2026-01-05 18:59:13 -08:00
imonlinux b8a3ce2c39 Update xvf3800_led_backend.py
Extends the existing XVF3800 USB control backend beyond LEDs to support startup preflight commands needed for audio reliability.

Implements command execution internally (no reliance on xvf_host.py) using the same USB control-transfer approach already used for LED features.
2026-01-05 18:57:52 -08:00
imonlinux 3ba4e748ee Update __main__.py
Adds XVF3800-specific initialization flow during controller startup.

Ensures the XVF3800 preflight runs at the right time so audio initialization sees the correct device state.
2026-01-05 18:56:37 -08:00
imonlinux 5932f945e9 Update linux-voice-assistant.service
Add require for pipewire
2026-01-02 19:03:17 -08:00
imonlinux 5315c56556 Add per LED support
Added support for the XVF3800 per-LED command LED_RING_COLOR (12-LED ring, 48-byte payload).

Implemented/readied the device control logic so the backend can:

write per-LED frames (set_ring_rgb / set_ring_solid / clear_ring),

detect availability (supports_per_led) and fall back if unsupported.

Improved robustness/diagnostics for USB control transfers (more consistent request composition + debug logging around writes).
2026-01-01 15:18:54 -08:00
imonlinux a7a4f47f52 Add per LED control
Prevented MQTT command/state feedback loops while keeping HA-friendly behavior:

accepts retained /state topics during a short startup bootstrap window to restore last-known settings,

then stops processing /state messages and unsubscribes from .../+/state after bootstrap.

Ensures runtime control is driven only by /set topics, while /state remains publish-only for HA UI synchronization.

Adds explicit logging around bootstrap completion to make startup behavior clear.
2026-01-01 15:17:41 -08:00
imonlinux 4f05312e16 Per LED Control Added
Integrated per-LED rendering into the existing effect/state pipeline:

solid/off uses ring frames directly,

blink toggles between frames (color ↔ off),

pulse now rewrites LED_RING_COLOR with scaled RGB per step (instead of relying on global brightness),

spin uses a single “dot” moving around the 12 LEDs.

Ensured the controller uses the XVF3800’s fixed ring size (12) where appropriate.

Fixed the “stuck in Responding” issue by subscribing the voice_idle handler so Idle effects reapply correctly when returning to IDLE.
2026-01-01 15:16:13 -08:00
imonlinux 7bbe0ed96f Add test file that captures microphone audio
uses the same code that the LVA uses to capture microphone audio. Defaults to downmix and accepts left and right as variable for --channel.
2025-12-23 14:03:18 -08:00
imonlinux 4bea3f63d2 Update hey_luna.json
Fixed the friendly name for Hey Luna
2025-12-22 19:43:36 -08:00
imonlinux 77c2299453 Update audio_engine.py
reverting the revert
2025-12-22 11:46:09 -08:00
imonlinux ae9b834ee3 Update audio_engine.py
Revert refractory bug fix
2025-12-22 09:54:01 -08:00
imonlinux bddbbbe899 Update 99-respeaker-xvf3800.rules
Add rule to disable USB autosuspend for the XVF3800. Attempting to address the XVF3800 becoming non-responsive after a period of inactivity.
2025-12-20 16:20:51 -08:00
imonlinux 670cd52725 Merge pull request #50 from imonlinux/refractory-rejection-loop_#48
Update audio_engine.py issue: 48
2025-12-20 13:35:34 -08:00
imonlinux 22e94fc92b Update linux-voice-assistant-2mic-install.md 2025-12-18 12:13:03 -08:00
imonlinux 99157b9a8a Add AEC persistance service file 2025-12-16 09:44:52 -08:00
imonlinux 46c39c6ae5 Update config.json.example
cleanup and restore of missing options
2025-12-12 15:18:39 -08:00
imonlinux ab99019d42 Update entity.py
Fix play status sync error between mpv and HA when skipping tracks.
2025-12-11 18:47:01 -08:00
imonlinux 7abce1060d Update mpv_player.py
Fix play status sync error between mpv and HA when skipping tracks.
2025-12-11 18:46:31 -08:00
imonlinux 8187760b39 Update mqtt_controller.py 2025-12-11 11:25:59 -08:00
imonlinux 3f05bcfc56 Create 99-respeaker-xvf3800.rules
Added a udev rule to allow non-root users to access the USB LEDs.
2025-12-11 09:57:15 -08:00
imonlinux 31b6d70910 Update xvf3800_usb_led_testing.md
Added the requirement for a udev rule.
2025-12-11 09:54:13 -08:00
imonlinux 1cd861454a Add files via upload 2025-12-11 09:09:07 -08:00
imonlinux f1d2700fac LED Effect Mapping
Background on LED effect mapping from XVF3800 to LVA LED effects.
2025-12-10 14:43:04 -08:00
imonlinux 70079d6a61 Update config.py
Bug fix.
2025-12-09 07:57:02 -08:00
imonlinux 957d3f2839 Update to include XVF3800 Support 2025-12-08 15:21:49 -08:00
imonlinux ae8f1c5c3a Add legacy XVF3800 LED Controls
Minimal pyusb-based wrapper focused on the legacy LED controls only
2025-12-08 14:08:01 -08:00
imonlinux 3d7cc49466 Add support for XVF380 LEDs
Keeps all existing DotStar/NeoPixel behavior intact.

Adds a USB-based XVF3800 backend using the legacy LED controls (LED_EFFECT, LED_BRIGHTNESS, LED_SPEED, LED_COLOR).

Plugs it into LedController by treating "led_type": "xvf3800", "interface": "usb" as a new backend.
2025-12-08 14:06:45 -08:00
imonlinux b15848a97d Add pyusb to required depends 2025-12-08 11:43:59 -08:00
imonlinux 59d8071384 Delete linux_voice_assistant/xvf3800_controller.py
Duplicate file...
2025-12-08 11:34:22 -08:00