notifications to chromecast

Alexa, Google Home and Siri

Moderator: leecollings

freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: notifications to chromecast

Post by freijn »

So happy with my new script !! THanks guys

https://www.youtube.com/watch?v=mCjCAzd1mEI
Charley
Posts: 24
Joined: Tuesday 06 March 2018 12:20
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.9030
Location: Netherlands
Contact:

Re: notifications to chromecast

Post 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
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: notifications to chromecast

Post 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
Charley
Posts: 24
Joined: Tuesday 06 March 2018 12:20
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.9030
Location: Netherlands
Contact:

Re: notifications to chromecast

Post 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
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: notifications to chromecast

Post 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 $

EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: notifications to chromecast

Post 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?
mark.sellwood
Posts: 102
Joined: Tuesday 04 March 2014 10:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Surrey, UK
Contact:

Re: notifications to chromecast

Post 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.
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
mark.sellwood
Posts: 102
Joined: Tuesday 04 March 2014 10:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Surrey, UK
Contact:

Re: notifications to chromecast

Post 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
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
site2017
Posts: 1
Joined: Wednesday 11 October 2017 18:46
Target OS: -
Domoticz version:
Contact:

Re: notifications to chromecast

Post 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
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: notifications to chromecast

Post by remb0 »

thanks mark! this was solving my problem :)
curious
Posts: 132
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: notifications to chromecast

Post 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 ?
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: notifications to chromecast

Post 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

It's nice to be important, but it's more important to be nice
Scooter ;)
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: notifications to chromecast

Post 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

It's nice to be important, but it's more important to be nice
Scooter ;)
jeroentje
Posts: 7
Joined: Thursday 01 June 2017 16:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: notifications to chromecast

Post 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 !
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: notifications to chromecast

Post 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.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
jeroentje
Posts: 7
Joined: Thursday 01 June 2017 16:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: notifications to chromecast

Post 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 ?
Last edited by jeroentje on Monday 10 September 2018 19:10, edited 1 time in total.
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: notifications to chromecast

Post 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.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
jeroentje
Posts: 7
Joined: Thursday 01 June 2017 16:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: notifications to chromecast

Post 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 ?
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: notifications to chromecast

Post 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);
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
jeroentje
Posts: 7
Joined: Thursday 01 June 2017 16:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: notifications to chromecast

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests