<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.domoticz.com/index.php?action=history&amp;feed=atom&amp;title=Sonos</id>
	<title>Sonos - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.domoticz.com/index.php?action=history&amp;feed=atom&amp;title=Sonos"/>
	<link rel="alternate" type="text/html" href="https://wiki.domoticz.com/index.php?title=Sonos&amp;action=history"/>
	<updated>2026-09-19T00:05:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wiki.domoticz.com/index.php?title=Sonos&amp;diff=17121&amp;oldid=prev</id>
		<title>Walter vl: Added Python plugins</title>
		<link rel="alternate" type="text/html" href="https://wiki.domoticz.com/index.php?title=Sonos&amp;diff=17121&amp;oldid=prev"/>
		<updated>2022-02-21T15:23:16Z</updated>

		<summary type="html">&lt;p&gt;Added Python plugins&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Introduction==&lt;br /&gt;
A native integration of the Sonos wireless music system in Domoticz is something that I think would be highly appreciated by a lot of Domoticz users. Unfortunately until now there is no hardware support included by default. User m_g_s_g started to work on [https://www.domoticz.com/forum/viewtopic.php?f=28&amp;amp;t=3721 a native Sonos plugin] for a while but unfortunately he abandoned the project. The code is still [https://github.com/mgsg/domoticz-sonos-plugin on GitHub] waiting for someone to pick this up and continue his work.&lt;br /&gt;
&lt;br /&gt;
Next to the native plugin there are multiple other solutions available by using scripts. Below the ones that can be found on the forum:&lt;br /&gt;
&lt;br /&gt;
*Easy Sonos&lt;br /&gt;
*Node Sonos HTTP API&lt;br /&gt;
*Wrapper for PHPSonos&lt;br /&gt;
*Sonos Soco Plugin&lt;br /&gt;
&lt;br /&gt;
==Easy Sonos==&lt;br /&gt;
The instructions below are based on [https://www.domoticz.com/forum/viewtopic.php?f=38&amp;amp;t=6088 this topic] thanks to Marmo&lt;br /&gt;
&lt;br /&gt;
*Download from https://www.github.com/DjMomo/sonos the file sonos.class.php and copy it to your scripts directory&lt;br /&gt;
*Install PHP and PHP5 curl if it is not installed on your machine. So sudo apt-get install php5-cli php5-curl (in Debian).&lt;br /&gt;
*To do an easy test, create two separate scripts for PLAY (sonos.play.php) and PAUSE (sonos.pause.php), both similar except in the command itself. As follows (only change the IP address to the IP of your Sonos):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$IP_sonos_1 = &amp;quot;192.168.1.20&amp;quot;;&lt;br /&gt;
require(&amp;quot;sonos.class.php&amp;quot;);&lt;br /&gt;
$sonos_1 = new SonosPHPController($IP_sonos_1);&lt;br /&gt;
$sonos_1 = $sonos_1-&amp;gt;Play();&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*chmod u+x the created play and pause files&lt;br /&gt;
*Call them from a virtual switch like this: script:///path to domoticz dir/domoticz/scripts/sonos.play.php&lt;br /&gt;
&lt;br /&gt;
==Wrapper for PHPSonos==&lt;br /&gt;
This works similar to the Easy Sonos solution. The only difference is that you need to have a PHP enabled webserver in order to have this working. User G3rard forked the [https://github.com/ThomasTr/sonos original wrapper] by ThomasTr and improved it a bit for use with Domoticz. This also includes text to speach functionality.&lt;br /&gt;
&lt;br /&gt;
To install this follow the instructions as [https://github.com/gerard33/sonos described here].&lt;br /&gt;
&lt;br /&gt;
==Node Sonos HTTP API==&lt;br /&gt;
&lt;br /&gt;
Another solution is to use the [https://github.com/jishi/node-sonos-http-api Node Sonos HTTP API]. There is a nice step-by-step guide on the forum made by Holland, it is a bit more extensive than the instructions below, you can find it [https://www.domoticz.com/forum/viewtopic.php?f=38&amp;amp;t=10940 here]&lt;br /&gt;
 &lt;br /&gt;
*If you don&amp;#039;t use the Domoticz SD card image first install node.js from the [[MQTT#Installing Node.JS|instructions from the link in point 1 here]].&lt;br /&gt;
*log into your machine through a shell and go to the home directory (normally one directory higher than the domoticz directory)&lt;br /&gt;
*&amp;lt;code&amp;gt;git clone https://github.com/jishi/node-sonos-http-api node-sonos-http-api&amp;lt;/code&amp;gt;&lt;br /&gt;
*&amp;lt;code&amp;gt;cd node-sonos-http-api&amp;lt;/code&amp;gt;&lt;br /&gt;
*&amp;lt;code&amp;gt;npm install --production&amp;lt;/code&amp;gt;&lt;br /&gt;
*start the server by running &amp;lt;code&amp;gt;npm start&amp;lt;/code&amp;gt;&lt;br /&gt;
*Now you can control your system by invoking the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://localhost:5005/zones&lt;br /&gt;
http://localhost:5005/lockvolumes&lt;br /&gt;
http://localhost:5005/unlockvolumes&lt;br /&gt;
http://localhost:5005/pauseall[/{timeout in minutes}]&lt;br /&gt;
http://localhost:5005/resumeall[/{timeout in minutes}]&lt;br /&gt;
http://localhost:5005/preset/{JSON preset}&lt;br /&gt;
http://localhost:5005/preset/{predefined preset name}&lt;br /&gt;
http://localhost:5005/{room name}/{action}[/{parameter}]&lt;br /&gt;
http://localhost:5005/reindex&lt;br /&gt;
http://localhost:5005/sleep/{timeout in seconds or timestamp HH:MM:SS or off}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
More info can be found [https://github.com/jishi/node-sonos-http-api here]&lt;br /&gt;
&lt;br /&gt;
==Sonos Soco Python Module==&lt;br /&gt;
The [https://github.com/SoCo/SoCo Soco]  is based on Python and therefore requires Python 2.7, or 3.2 or newer. (I have not installed this myself so below is just an educational guess)&lt;br /&gt;
&lt;br /&gt;
*Log into your machine through a shell and go to the home directory (normally one directory higher than the domoticz directory)&lt;br /&gt;
*Install python and python-pip package and/or python3 and python3-pip&lt;br /&gt;
*&amp;lt;code&amp;gt;git clone https://github.com/SoCo/SoCo SoCo&amp;lt;/code&amp;gt;&lt;br /&gt;
*&amp;lt;code&amp;gt;cd SoCo&amp;lt;/code&amp;gt;&lt;br /&gt;
*&amp;lt;code&amp;gt;sudo pip install soco&amp;lt;/code&amp;gt;&lt;br /&gt;
*&amp;lt;code&amp;gt;sudo pip3 install soco&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More info on SoCo [https://github.com/SoCo/SoCo here].&lt;br /&gt;
&lt;br /&gt;
== Python Plugins ==&lt;br /&gt;
There are some Python plugins created on github but all not recently updated.&lt;br /&gt;
&lt;br /&gt;
https://github.com/gerard33/sonos&lt;br /&gt;
&lt;br /&gt;
https://github.com/Gerard-Oedzes/domoticz-sonos&lt;br /&gt;
&lt;br /&gt;
==Forum topics for reference==&lt;br /&gt;
&lt;br /&gt;
*[https://www.domoticz.com/forum/viewtopic.php?f=28&amp;amp;t=3721 Sonos Native Plugin]&lt;br /&gt;
*[https://www.domoticz.com/forum/viewtopic.php?f=38&amp;amp;t=6088 Easy Sonos]&lt;br /&gt;
*[https://www.domoticz.com/forum/viewtopic.php?f=38&amp;amp;t=8953 Updated Sonos TTS (PHP)]&lt;br /&gt;
*[https://www.domoticz.com/forum/viewtopic.php?f=28&amp;amp;t=5289 Sonos Soco Plugin]&lt;br /&gt;
*[https://www.domoticz.com/forum/viewtopic.php?f=38&amp;amp;t=10940 Node Sonos http-api step-by-step guide]&lt;/div&gt;</summary>
		<author><name>Walter vl</name></author>
	</entry>
</feed>