Page 2 of 3
Re: notifications to chromecast
Posted: Wednesday 02 May 2018 22:48
by freijn
So happy with my new script !! THanks guys
https://www.youtube.com/watch?v=mCjCAzd1mEI
Re: notifications to chromecast
Posted: Friday 15 June 2018 18:45
by Charley
@Freijn,
How did you get the ns.mp3 and the message.mp3 together. I get the following error.
sudo sox -m /tmp/ns.mp3 /tmp/message.mp3 /tmp/message2.mp3
sox FAIL sox: Input files must have the same sample-rate
sox WARN sox: Input files don't have the same # channels
Re: notifications to chromecast
Posted: Friday 15 June 2018 22:13
by freijn
Input files must have the same sample-rate
So What I did was finding what sample rate the second message and then converted the first message to the second one.
For finding the sample rate there are serveral tools. The most easy one is recorder of windows XP.... but I assume you are not on XP anymore.
Goldwave the very old version does the job and for free.
Let me know if that makes sense..
Frank
Re: notifications to chromecast
Posted: Saturday 16 June 2018 18:17
by Charley
Hi Frank,
I was able to make the ns.mp3 mono and the same sample rate as the message.mp3 file (24.050 Hz)
with sox I forced it to single channel. But the two will are mixed and no concatenated.
tried sox with and without -m option. Even tried to pipe them behind each other it all didn't give the proper result.
I may now try to edit the files completely and then select with the request which file to play.
Charley
Re: notifications to chromecast
Posted: Sunday 17 June 2018 11:26
by remb0
looks great.
But I have a minor issue, I think I missed something but can't figure out what.
Code: Select all
pi@Domoticz:~/stream2chromecast $ ./stream2chromecast.py -setvol 3
File "./stream2chromecast.py", line 176
print "sending data"
^
SyntaxError: Missing parentheses in call to 'print'
pi@Domoticz:~/stream2chromecast $ ./notification_chromecast.sh "test" 2 Notification : test
Volume : 2
Chromecast online
File "/home/pi/stream2chromecast/stream2chromecast.py", line 176
print "sending data"
^
SyntaxError: Missing parentheses in call to 'print'
File "/home/pi/stream2chromecast/stream2chromecast.py", line 176
print "sending data"
^
SyntaxError: Missing parentheses in call to 'print'
pi@Domoticz:~/stream2chromecast $
Re: notifications to chromecast
Posted: Sunday 17 June 2018 16:17
by EddyG
My script is working fine even with the concat of 2 mp3's at 24kHz.
The Chromecast on my TV is switching to the correct HDMI port. So normal TV is interupted.
The script is looping for a "200" return from the Chromecast and the mp3 is not playing on the TV.
Code: Select all
sudo ./stream2chromecast.py -devicename Woonkamer /tmp/message2.mp3
This simple command works, but TV does not return to the previous HDMI port.
Anyone any idea?
Re: notifications to chromecast
Posted: Tuesday 19 June 2018 21:03
by mark.sellwood
Version: 3.9651
Raspberry Pi 3
RASPBIAN STRETCH LITE
Raspbian Stretch Lite (April 2018)
Is this still working?
It was working for me but now its stopped.
If i run the script from the command line the massage gets played but in the command window I get "waiting for player to finish - press ctrl-c to stop"
It looks as if stream2chromecast is hanging.
Re: notifications to chromecast
Posted: Tuesday 19 June 2018 21:04
by mark.sellwood
@remb0,
Yes I had this too, I had to add "phython2.7" in front 2 lines, so now I have :-
#MP3 to Google Home
sudo python2.7 /home/pi/stream2chromecast/stream2chromecast.py -devicename $IPGH /tmp/message.mp3
If you have a look at
https://github.com/bronche/stream2chromecast it does say the plugin was written in Python 2.7
Re: notifications to chromecast
Posted: Tuesday 19 June 2018 21:21
by site2017
curious wrote: ↑Tuesday 13 March 2018 20:59
Our french speaking fellowers have a nice tutorial on how to send notifications to a chromecast device
http://easydomoticz.com/forum/viewtopic.php?f=17&t=5914
Unfortunately I don't get a message.
When I run the test,
Code: Select all
/home/pi/domoticz/scripts/notification_google_home.sh "There is someone at the door"
it works fine, but when I want Domoticz to notify me, a mail is send but there is no message on my chromecast.
Does one of you uses this notification-script and faced the same problem (and solved it

) ?
Is there a way to debug this ?
thanks for the comment
Re: notifications to chromecast
Posted: Tuesday 19 June 2018 22:02
by remb0
thanks mark! this was solving my problem

Re: notifications to chromecast
Posted: Monday 25 June 2018 20:04
by curious
site2017 wrote: ↑Tuesday 19 June 2018 21:21
curious wrote: ↑Tuesday 13 March 2018 20:59
Our french speaking fellowers have a nice tutorial on how to send notifications to a chromecast device
http://easydomoticz.com/forum/viewtopic.php?f=17&t=5914
Unfortunately I don't get a message.
When I run the test,
Code: Select all
/home/pi/domoticz/scripts/notification_google_home.sh "There is someone at the door"
it works fine, but when I want Domoticz to notify me, a mail is send but there is no message on my chromecast.
Does one of you uses this notification-script and faced the same problem (and solved it

) ?
Is there a way to debug this ?
thanks for the comment
Did you mark the http-option under the switch notification properties ?
Re: notifications to chromecast
Posted: Friday 07 September 2018 17:50
by thecosmicgate
Playing around with this script for a while, but I can't get any sound out of one of mine Google home's. Tried on a mini and on a home , but the script (from the French tut) starts and in see "waiting for player to stop" but I can wait for hours but no sound and no stop (when I run the example rule : There is somebody on the door.
But when I have a look in the /tmp/ folder where the audio file is created I can find a playable message.mp3 . When I downloaded this and run it , it's exactly the text what I was expecting out off the Google home's ..
So what's going wrong :S ?
Sent from my ONEPLUS A6003 using Tapatalk
Re: notifications to chromecast
Posted: Friday 07 September 2018 18:04
by thecosmicgate
mark.sellwood wrote:@remb0,
Yes I had this too, I had to add "phython2.7" in front 2 lines, so now I have :-
#MP3 to Google Home
sudo python2.7 /home/pi/stream2chromecast/stream2chromecast.py -devicename $IPGH /tmp/message.mp3
If you have a look at
https://github.com/bronche/stream2chromecast it does say the plugin was written in Python 2.7
When I add the python2.7 I'll get the error : invalid Syntax
message=$1 # text message
^
SyntaxError: invalid syntax
Sent from my ONEPLUS A6003 using Tapatalk
Re: notifications to chromecast
Posted: Sunday 09 September 2018 16:21
by jeroentje
Hi,
same issue here. new google mini.
stream2chromecast stays "sending data" and takes 10 mins to stop.
The file is played well. I also use the french script with google TTS.
I've tried a lot (different versions of the .py files about messages and .py script and all the common solutions found in google for stream2chromecast), but still no solution.
Anyone ? " Sending data" hangs, you have to CNTL-C to stop:
Notification : testje
Volume : 0.2
Chromecast online
ip_addr: 192.168.0.200 device name:
-----------------------------------------
Stream2Chromecast version:0.6.3
Copyright (C) 2014-2016 Pat Carter
GNU General Public License v3.0
https://www.gnu.org/licenses/gpl-3.0.html
-----------------------------------------
ip_addr: 192.168.0.200 device name:
source is file: /tmp/message.mp3
local ip address: 192.168.0.202
OS identifies the mimetype as : audio/mpeg
URL & content-type:
http://192.168.0.202:41791?/tmp/message.mp3 audio/mpeg
loading media...
192.168.0.200 - - [09/Sep/2018 16:18:03] "GET /?/tmp/message.mp3 HTTP/1.1" 200 -
sending data
and then it hangs
Any help is appriciated !
Re: notifications to chromecast
Posted: Sunday 09 September 2018 17:17
by sincze
Same with ny Google Home for some reason.
As I run the bash with & in the end I did not notice this before.
Re: notifications to chromecast
Posted: Monday 10 September 2018 18:34
by jeroentje
Hi Sincze,
as you didn't notice it before, where you able to send several musicfiles of spoken text from domoticz direct after each other (fe from multiple events ?) to the google home ?
I suppose this did not work ?
Re: notifications to chromecast
Posted: Monday 10 September 2018 19:10
by sincze
jeroentje wrote: ↑Monday 10 September 2018 18:34
Hi Sincze,
as you did noticed it before, where you able to send several musicfiles of spoken text from domoticz direct after each other (fe from multiple events ?) to the google home mini .
I suppose this did not work ?
Yes it was possible.
Example 'front door opened' directly followed by 'alarm switched off'.
That plays very well on the Google home.
Re: notifications to chromecast
Posted: Monday 10 September 2018 19:12
by jeroentje
then it should have something to do with the & I think

Can you post the command with a bash in the end, as it work correctly please ?
Re: notifications to chromecast
Posted: Monday 10 September 2018 20:09
by sincze
jeroentje wrote: ↑Monday 10 September 2018 19:12
then it should have something to do with the & I think

Can you post the command with a bash in the end, as it work correctly please ?
Whoops it seems I did not include the & in the final version.... my mistake.
I call stream2chromecast via PHP, converted a lot of the bash file to PHP, in addition I store the created samples on my SSD so I don't have to ask google to recreate them every time (using the urlencode functionality that encodes the text it needs to pronounce.) Responsiveness is a lot faster that way:
Code: Select all
$command=('python /home/pi/domoticz/scripts/system/stream2chromecast/stream2chromecast.py -devicename '.$devicename.' -setvol '.$volume);
$output = exec($command);
$command=('python /home/pi/domoticz/scripts/system/stream2chromecast/stream2chromecast.py -devicename '.$devicename.' '.$file);
$output = exec($command);
Re: notifications to chromecast
Posted: Tuesday 11 September 2018 17:38
by jeroentje
hi Sincze, many thanks for showing.
When I use the & at the end of the command, it is working as expected.
I only find it strange there are a lot of processen for this python running (for all the text streamed) and it takes a while till they are out of the system.
Many thanks again.