Easy Sonos
Moderator: leecollings
- fl1p
- Posts: 17
- Joined: Friday 19 July 2013 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Belgium
- Contact:
Re: Easy Sonos
How do you integrate this in Domoticz? I have everything running, but I want to be able to click a button, then a TTS message comes out of a speaker.
The PHP-script is ready, and what now?
The PHP-script is ready, and what now?
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Easy Sonos
Add a virtual switch and put the php url in the On Action of the switch.
Not using Domoticz anymore
- fl1p
- Posts: 17
- Joined: Friday 19 July 2013 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Belgium
- Contact:
Re: Easy Sonos
That seems to work only sometimes... I added a simple test with "Play". I click the button, it works. Then I pause it via Sonos and I click the button again. Doesn't work for a few times.
The button has a very strange behaviour.
And how do I start a playlist? Just put in the name of the playlist/radio station between the brackets? Does it have to be in my sonos favourits or sonos playlists or both...?
The button has a very strange behaviour.
And how do I start a playlist? Just put in the name of the playlist/radio station between the brackets? Does it have to be in my sonos favourits or sonos playlists or both...?
-
- Posts: 60
- Joined: Saturday 20 June 2015 10:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Easy Sonos
Hi,
sorry i tried to put this command (see below) on the switch, the on action for the script isn't working, did i miss something ?
put "#!/usr/bin/env php" before the "<?php" statement in sonos.play.php
chmod u+x sonos.play.php
call it with "script://home/pi/domoticz/scripts/sonos.play.php"
sorry i tried to put this command (see below) on the switch, the on action for the script isn't working, did i miss something ?
put "#!/usr/bin/env php" before the "<?php" statement in sonos.play.php
chmod u+x sonos.play.php
call it with "script://home/pi/domoticz/scripts/sonos.play.php"
- fl1p
- Posts: 17
- Joined: Friday 19 July 2013 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Belgium
- Contact:
Re: Easy Sonos
I'm not sure what your level of linux is, so I put it in full. Maybe you got this right allready.
Just for sure:
1) In het file sonos.play.php you shut put this:
2) Browse to the file where sonos.play.php is located and do:
3) The in the On-command line in your switch, you put:
Else, did you try and test it via the command line on your server itself?
For me, that sometimes worked...
Just for sure:
1) In het file sonos.play.php you shut put this:
Code: Select all
#!/usr/bin/env php
Code: Select all
sudo chmod u+x sonos.play.php
Code: Select all
script:///home/pi/domoticz/scripts/sonos.play.php
For me, that sometimes worked...
-
- Posts: 60
- Joined: Saturday 20 June 2015 10:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Easy Sonos
Sorry, still not working
i have got the message error in the logs : "Error executing scrript command /home/pi/domoticz/scripts/sonos.play.php returned 32512".
Very strange because when i type the command line (with the putty console) in the folder scripts "php sonos.play.php", it's working.
i have got the message error in the logs : "Error executing scrript command /home/pi/domoticz/scripts/sonos.play.php returned 32512".
Very strange because when i type the command line (with the putty console) in the folder scripts "php sonos.play.php", it's working.
- fl1p
- Posts: 17
- Joined: Friday 19 July 2013 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Belgium
- Contact:
Re: Easy Sonos
It means he can't find the script. Are you sure you put the script it in that place?
Also mind the 3 slashes behind script:
Also mind the 3 slashes behind script:
-
- Posts: 60
- Joined: Saturday 20 June 2015 10:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Easy Sonos
i checked the on action on the switch is :
script:///home/pi/domoticz/scripts/sonos.play.php
i joined some screenshots, it should be helpful, i hope
script:///home/pi/domoticz/scripts/sonos.play.php
i joined some screenshots, it should be helpful, i hope
- Attachments
-
- image2.PNG (329.5 KiB) Viewed 4131 times
-
- image1.PNG (171.25 KiB) Viewed 4131 times
-
- Posts: 27
- Joined: Monday 13 April 2015 23:19
- Target OS: NAS (Synology & others)
- Domoticz version: 3.5033
- Location: Amsterdam, The Netherlands
- Contact:
Re: Easy Sonos
Not sure if that fixes it but maybe you should set the chmod u+x also on the sonos.class.php. In your screenshot you can see that it is not executable at the moment, while it is required by the sonos.play.php file.
-
- Posts: 60
- Joined: Saturday 20 June 2015 10:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Easy Sonos
Thanks for your reply, i did the same for the sonos.class.php (chmod u+x sonos.class.php) but still the same message : "Error executing scrript command /home/pi/domoticz/scripts/sonos.play.php returned 32512" in the logs.
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Easy Sonos
I use a php file as well, but I am calling it using http:// instead of script:///. Maybe you can try that?
My php file is running from the web server of my NAS so not on a Pi.
My php file is running from the web server of my NAS so not on a Pi.
Not using Domoticz anymore
-
- Posts: 179
- Joined: Friday 12 July 2013 13:53
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta Ch
- Location: The Netherlands
- Contact:
Re: Easy Sonos
Try the following.
On the first line of sonos.play.php
Remove; (don't what's behind the red square). #!/usr/bin/env php
Replace by this;
#!/usr/bin/php
On the first line of sonos.play.php
Remove; (don't what's behind the red square). #!/usr/bin/env php
Replace by this;
#!/usr/bin/php
-
- Posts: 60
- Joined: Saturday 20 June 2015 10:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Easy Sonos
Sorry, i already tried, it's not working
- Attachments
-
- Capture.PNG (9.54 KiB) Viewed 4084 times
-
- Posts: 40
- Joined: Tuesday 26 May 2015 10:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Easy Sonos
noticed that a simple Play() command is not working if you have a group of 2 Sonos players?
sometimes i have my 2 speakers as group (1 in kitchen, 1 in living).
Trying to figure out how to solve this!
EDIT this seems not needed.
Play wasn't working because there was nothing in the queue.
EDIT2 trying to get a mp3 played for my doorbell:
$sonos_1->Stop();
$sonos_1->AddURIToQueue("x-file-cifs://172.16.0.3/Public/MEDIA/MP3/dingdong.mp3",1) ;
$sonos_1->Next();
$sonos_1->Play();
for some reason first it worked and the mp3 was inserted inside the queue as the next song. But after some testing, it is added evertime as the last one of the queue??
anyone had the same issue? Other problem there is: a Radio stream is not considered as a Queue and nothing can be added! So need to check first if Stream is playing or queue!
sometimes i have my 2 speakers as group (1 in kitchen, 1 in living).
Trying to figure out how to solve this!
EDIT this seems not needed.
Play wasn't working because there was nothing in the queue.
EDIT2 trying to get a mp3 played for my doorbell:
$sonos_1->Stop();
$sonos_1->AddURIToQueue("x-file-cifs://172.16.0.3/Public/MEDIA/MP3/dingdong.mp3",1) ;
$sonos_1->Next();
$sonos_1->Play();
for some reason first it worked and the mp3 was inserted inside the queue as the next song. But after some testing, it is added evertime as the last one of the queue??
anyone had the same issue? Other problem there is: a Radio stream is not considered as a Queue and nothing can be added! So need to check first if Stream is playing or queue!
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Easy Sonos
You can take a look at https://github.com/ThomasTr/sonos. That has the possibility to stop current playing radio/list, plays a mp3, continues previously played radio/list. Maybe you can use that for the doorbell mp3.
Not using Domoticz anymore
-
- Posts: 40
- Joined: Tuesday 26 May 2015 10:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Easy Sonos
Thanks, this one does exactly what I need it for!G3rard wrote:You can take a look at https://github.com/ThomasTr/sonos. That has the possibility to stop current playing radio/list, plays a mp3, continues previously played radio/list. Maybe you can use that for the doorbell mp3.
also when in a group, the message goes only to the speaker i choose. And afterwards the 2 speakers get correctly in sync again. But need to test, as i want it to be sent to both speakers (1 in kitchen, 1 in living room).
Also i only have it working for now from my own pc running WAMP with php/etc and just browsing to
http://localhost/sonos/index.php?zone=k ... &volume=20
How do I use it in DOmoticz? I created a virtual switch and tried script://home/pi/scripts/sonos/index.php?zone=kitchen&action=sendMessage&messageId=1&volume=20 but doesn't seem to work. Also see now logging. but gave the folder sonos 777 rights?
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Easy Sonos
See my post above http://www.domoticz.com/forum/viewtopic ... 214#p49096, please try that.trekker25 wrote: How do I use it in DOmoticz? I created a virtual switch and tried script://home/pi/scripts/sonos/index.php?zone=kitchen&action=sendMessage&messageId=1&volume=20 but doesn't seem to work. Also see now logging. but gave the folder sonos 777 rights?
I think you always have to start a php with http and not with script.
Not using Domoticz anymore
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Easy Sonos
There is a icon on the drive for sonos
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 40
- Joined: Tuesday 26 May 2015 10:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Easy Sonos
what do you mean by this?Derik wrote:There is a icon on the drive for sonos
running it with http:// wil also not work on Rpi, as when i try to access http://ip_rpi/ nothing happens. And with script:// it doesn't seem to do anything.
Read somewhere you need to run apache2 besides the builtin webserver. (for the dashboard on :8080)
So probably going to run it from my NAS.
see this topic:
http://www.domoticz.com/forum/viewtopic.php?f=4&t=7067
In this wiki:
https://www.domoticz.com/wiki/Scripts#PHP_Scripts
it would be usefull if it would mentioned that PHP scripts can't be called from a Switch?
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Easy Sonos
https://drive.google.com/folderview?id= ... sp=sharing
You can find a sonos icon for your Domoticz webui...
You can find a sonos icon for your Domoticz webui...
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Who is online
Users browsing this forum: No registered users and 1 guest