W10 : make domoticz cast to chromecast & GoogleHome

Moderator: leecollings

Post Reply
zicht
Posts: 272
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

W10 : make domoticz cast to chromecast & GoogleHome

Post by zicht »

** Only for Windows **
Just found this on the web : https://www.rlatour.com/cast/index.html

Installed it and made a lua function :

Code: Select all

function Cast(ctext,cdevice,cvolume)
	casttext=""
	cvolume=tonumber(cvolume) if cvolume==0 or cvolume==nil then cvolume=40 end
	if cdevice~=nil then casttext=casttext..' -device "'..cdevice..'"'  end 
	if ctext~=nil then casttext=casttext..' -text "'..ctext..'"' end
	casttext=casttext..' -volume '..tostring(cvolume) 
	casttext='start /b /realtime Cast.exe -background'..casttext    
        print(casttext)
	os.execute(casttext)
end
Not the niced code, but working.
I used the os.execute and this slows down a lot... so i added "start /b /realtime" to speed things a bit up.
Now a can let google home and other chromecast say things by calling this function.

sorry : I am not a coder and have no clue how to do it on RP or linux, i just try to find sollutions for my needs (and then share it) ...
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: W10 : make domoticz cast to chromecast & GoogleHome

Post by Brutus »

Thnx for sharing.

Will look into this. Already have it running on my Windows Machine Casting to TV and so on.
Looking for some new speakers with google cast in it will be a nice option now!

Greetings.
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
zicht
Posts: 272
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: W10 : make domoticz cast to chromecast & GoogleHome

Post by zicht »

Your welcome.

I have got some more experience with it now : it works best to cast to an ip adress. Messages to an ipadress are more reliable being delivered.

The inbuild text2speach is only englisch... You can use google tts to construct an mp3 with your text message in any language :) this way it sounds also like it is comming from google home .. same voice.
Below a partial sample. Message,mp3 is written in the domoticz directory (where nssm.exe is) and cip is the ipholder for the target device.

Code: Select all

	
mkfile='curl -s -G "http://translate.google.com/translate_tts" --data "ie=UTF-8&total=1&idx=0&client=tw-ob&&tl=nl" --data-urlencode "q='..ctext..'" -A "Mozilla" --compressed -o message.mp3' 
cfile='C:/PROGRA~2/domoticz/message.mp3'
os.capture(mkfile)

casttext=casttext..' -file '..cfile 
casttext=casttext..' -volume '..tostring(cvolume) 
casttext='start /b /realtime Cast.exe -background '..cip..casttext    
I made and input template in the custom tab, making it possible to send messages to any room i want from the in home domoticz website ...
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest