Subscribes to the new mic_muted and mic_unmuted events.
Provides visual feedback by setting the LEDs to a solid dim red when muted and calling the idle state handler (turning the LEDs off) when unmuted.
Implements the core mute functionality.
Adds a new MicMuteHandler class that subscribes to the set_mic_mute event. This handler updates the state.mic_muted flag and publishes secondary mic_muted or mic_unmuted events for LED feedback.
Modifies the process_audio function to check the state.mic_muted flag in its main loop, pausing audio processing when the flag is True.
Instantiates the MicMuteSwitchEntity on startup to register it with Home Assistant.
Updates the central message handler to correctly route SwitchCommandRequest messages from Home Assistant to the appropriate entity.
Defines a new MicMuteSwitchEntity class that creates the switch entity in Home Assistant.
When the switch is toggled, it publishes a set_mic_mute event to the internal event bus with the new state (True for muted, False for unmuted).
Updates the MediaPlayerEntity to handle the saving and loading logic.
The entity's internal volume state is now initialized from the saved preferences.volume_level.
When a volume change command is received from Home Assistant, the handle_message method now updates the Preferences object and calls save_preferences() to persist the new volume level to disk.
Modifies the startup sequence to read the volume_level from the loaded preferences.
This saved value is then passed as the initial_volume when creating the music_player and tts_player instances.
Updates the MpvMediaPlayer constructor (__init__) to accept an initial_volume parameter.
This allows the volume to be set immediately when the mpv process is created, applying the saved setting at startup.
Adds a new volume_level: float field to the Preferences dataclass. This creates a dedicated entry in the preferences.json file to store the user's desired volume (from 0.0 to 1.0).
Passes the event_bus and loop instances into the ServerState object upon creation.
Adds new command-line arguments (--led-interface, --led-clock-pin, --led-data-pin) to allow the user to select and configure the LED hardware interface at runtime.
event_bus: EventBus
loop: asyncio.AbstractEventLoop
This provides a globally accessible instance of the event bus and the main asyncio event loop to any component that needs them.