ByteDev / ByteDev.Sonos

Set of classes and tools to help control Sonos devices.
MIT License
19 stars 5 forks source link
csharp sonos upnp

Build status NuGet Package License: MIT

ByteDev.Sonos

Set of classes and tools to help control Sonos devices.

Installation

ByteDev.Sonos has been written as a .NET Standard 2.0 library, so you can consume it from a .NET Core or .NET Framework 4.6.1 (or greater) application.

ByteDev.Sonos is hosted as a package on nuget.org. To install from the Package Manager Console in Visual Studio run:

Install-Package ByteDev.Sonos

Further details can be found on the nuget page.

Release Notes

Releases follow semantic versioning.

Full details of the release notes can be viewed on GitHub.

Usage

At the highest level there are two main classes in the ByteDev.Sonos assembly: SonosController and SonosDeviceService.

SonosController

SonosController allows you to control the speaker, aspects of it's queue, and operations on it's current track.

SonosController controller = new SonosControllerFactory().Create("192.168.1.100");

SonosVolume volume = await controller.GetVolumeAsync();

volume.Increase(10);

await controller.SetVolumeAsync(volume);

SonosDeviceService

SonosDeviceService allows you to get details about a particular Sonos device and even restart the device.

var service = new SonosDeviceService();

var sonosDevice = await service.GetDeviceAsync("192.168.1.100");

var httpResponseMessage = await service.RebootAsync("192.168.1.100");