A Homebridge plugin to integrate Sonos speakers into HomeKit, specifically focusing on "Night Sound" and "Speech Enhancement" controls.
- Device Discovery: Automatically discovers Sonos devices on your local network.
- Strict Filtering: Only exposes devices that you explicitly allow in the configuration.
- Night Sound: Toggle "Night Sound" mode for compatible Sonos speakers (e.g. Playbar, Beam, Arc).
- Speech Enhancement: Toggle "Speech Enhancement" mode.
- Install Homebridge (if you haven't already).
- Install this plugin:
npm install -g homebridge-sonos-hb-plugin
If you want to install this plugin manually (e.g., for testing a local build):
-
Pack the plugin: Run the following command in the root of the project to create a
.tgzfile (e.g.,homebridge-sonos-hb-plugin-2.0.0.tgz):npm pack
-
Install the package: Copy the generated
.tgzfile to your Homebridge server (if different) and run:npm install -g ./homebridge-sonos-hb-plugin-2.0.0.tgz
-
Restart Homebridge: Restart your Homebridge service to load the new plugin version.
IMPORTANT: This plugin will NOT expose any devices by default. You must explicitly list the Room Name of each Sonos speaker you want to control.
Add the following to your config.json in the platforms array:
{
"platforms": [
{
"platform": "SonosHBPlugin",
"name": "Sonos",
"deviceNames": ["Living Room", "Kitchen"],
"devices": [
{
"deviceName": "Office",
"ipAddress": "192.168.1.50"
},
{
"deviceName": "Master Bedroom",
"macAddress": "B8:E9:37:XX:XX:XX"
}
]
}
]
}platform: Must be "SonosHBPlugin".name: The name of the platform (optional, defaults to "Sonos").deviceNames: (Legacy) An array of strings. These must match exactly the Room Names of your Sonos devices.devices: (Strict Filter) Array of objects. If populated, this list takes precedence. Each item must have adeviceNameand optionalipAddressormacAddress.- If
ipAddressis provided, the device must match BOTH the name and IP. - If
macAddressis provided, the device must match BOTH the name and MAC. - If both are provided, it must match ALL conditions.
- If
To find the correct Room Names, check your Sonos App. Alternatively, run Homebridge with this plugin enabled; it will log all discovered devices (and their names) to the Homebridge console/log.
This plugin uses the homebridge Dynamic Platform API.
- Discovery: On startup (
didFinishLaunching), the plugin triggers a UPnP discovery for Sonos devices. - Filtering: Discovered devices are compared against the configuration. Only matches are registered.
- Control: The plugin uses direct SOAP requests (UPnP RenderingControl service).
- State Management: Currently assumes default "OFF" state on startup.
- No devices showing up? Check the Homebridge logs. Ensure your
deviceNameslist matches. - Errors controlling device? Ensure the device has a static IP.
# Build the plugin
npm run build
# Watch for changes
npm run watch