Arduino library for ESP32 to control Sonos speakers over WiFi.
- Automatic device discovery
- Playback control (play, pause, stop, next, previous)
- Volume control and mute
- Multiple device management
begin()- Initialize the libraryend()- Clean shutdownisInitialized()- Check initialization status
discoverDevices()- Find Sonos speakers on networkgetDiscoveredDevices()- Get list of found devicesgetDeviceByName(name)- Find device by room namegetDeviceByIP(ip)- Find device by IP addressgetDeviceCount()- Get number of discovered devices
play(deviceIP)- Start playbackpause(deviceIP)- Pause playbackstop(deviceIP)- Stop playbacknext(deviceIP)- Skip to next trackprevious(deviceIP)- Go to previous track
setVolume(deviceIP, volume)- Set volume (0-100)getVolume(deviceIP, &volume)- Get current volumeincreaseVolume(deviceIP, increment)- Increase volumedecreaseVolume(deviceIP, decrement)- Decrease volumesetMute(deviceIP, mute)- Set mute state (true/false)
setConfig(config)- Set library configurationgetConfig()- Get current configuration
setDeviceFoundCallback(callback)- Called when device discoveredsetLogCallback(callback)- Custom logging handler
getErrorString(result)- Convert error code to string
SUCCESS- Operation completed successfullyERROR_NETWORK- Network communication errorERROR_TIMEOUT- Operation timed outERROR_INVALID_DEVICE- Invalid or offline deviceERROR_SOAP_FAULT- SOAP protocol errorERROR_NO_MEMORY- Insufficient memoryERROR_INVALID_PARAM- Invalid parameter
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.