notifications to chromecast

Alexa, Google Home and Siri
freijn
Posts: 400
Joined: Friday 23 December 2016 17:40
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands Purmerend
Contact:

Re: notifications to chromecast

Post by freijn » Wednesday 02 May 2018 22:48

So happy with my new script !! THanks guys

https://www.youtube.com/watch?v=mCjCAzd1mEI

Charley
Posts: 29
Joined: Tuesday 06 March 2018 13:20
Target OS: Raspberry Pi
Domoticz version: V3.9030
Location: Netherlands
Contact:

Re: notifications to chromecast

Post by Charley » Friday 15 June 2018 18:45

@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: 400
Joined: Friday 23 December 2016 17:40
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands Purmerend
Contact:

Re: notifications to chromecast

Post by freijn » Friday 15 June 2018 22:13

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: 29
Joined: Tuesday 06 March 2018 13:20
Target OS: Raspberry Pi
Domoticz version: V3.9030
Location: Netherlands
Contact:

Re: notifications to chromecast

Post by Charley » Saturday 16 June 2018 18:17

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: 1002
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: notifications to chromecast

Post by remb0 » Sunday 17 June 2018 11:26

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 $


User avatar
EddyG
Posts: 326
Joined: Monday 02 November 2015 6:54
Target OS: Raspberry Pi
Domoticz version: 4.9999
Location: Rhenen, Netherlands
Contact:

Re: notifications to chromecast

Post by EddyG » Sunday 17 June 2018 16:17

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?
Regards,
Eddy

mark.sellwood
Posts: 56
Joined: Tuesday 04 March 2014 11:33
Target OS: Raspberry Pi
Domoticz version:
Location: Surrey, UK
Contact:

Re: notifications to chromecast

Post by mark.sellwood » Tuesday 19 June 2018 21:03

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: 56
Joined: Tuesday 04 March 2014 11:33
Target OS: Raspberry Pi
Domoticz version:
Location: Surrey, UK
Contact:

Re: notifications to chromecast

Post by mark.sellwood » Tuesday 19 June 2018 21:04

@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 » Tuesday 19 June 2018 21:21

curious wrote:
Tuesday 13 March 2018 21: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: 1002
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: notifications to chromecast

Post by remb0 » Tuesday 19 June 2018 22:02

thanks mark! this was solving my problem :)

curious
Posts: 136
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: notifications to chromecast

Post by curious » Monday 25 June 2018 20:04

site2017 wrote:
Tuesday 19 June 2018 21:21
curious wrote:
Tuesday 13 March 2018 21: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: 263
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 » Friday 07 September 2018 17:50

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: 263
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 » Friday 07 September 2018 18:04

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: 8
Joined: Thursday 01 June 2017 16:22
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: notifications to chromecast

Post by jeroentje » Sunday 09 September 2018 16:21

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: 995
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: notifications to chromecast

Post by sincze » Sunday 09 September 2018 17:17

Same with ny Google Home for some reason.
As I run the bash with & in the end I did not notice this before.
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

jeroentje
Posts: 8
Joined: Thursday 01 June 2017 16:22
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: notifications to chromecast

Post by jeroentje » Monday 10 September 2018 18:34

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: 995
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: notifications to chromecast

Post by sincze » Monday 10 September 2018 19:10

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.
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

jeroentje
Posts: 8
Joined: Thursday 01 June 2017 16:22
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: notifications to chromecast

Post by jeroentje » 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 ?

User avatar
sincze
Posts: 995
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: notifications to chromecast

Post by sincze » Monday 10 September 2018 20:09

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);
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

jeroentje
Posts: 8
Joined: Thursday 01 June 2017 16:22
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: notifications to chromecast

Post by jeroentje » Tuesday 11 September 2018 17:38

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 1 guest