Page 2 of 2
Re: Spoken Notifications Goolge Home (Mini/Nest/Chromecast etc)
Posted: Wednesday 04 January 2023 22:07
by QNTL
Hi,
These are the screenshots.
The script runs (as it does if I put the script itself with ' &' added) but there is no sound playing.
So I don't know if it is evoled to another issue
This says Domoticz:
Code: Select all
2023-01-04 21:59:34.552 Status: User: TSHR (IP: 192.168.2.14) initiated a switch command (18/Test/On)
2023-01-04 21:59:34.769 Status: Executing script: /home/pi/domoticz/scripts/file.sh
Oh and let me say this: Thanks for the time and effort you give to my issue!
Re: Spoken Notifications Goolge Home (Mini/Nest/Chromecast etc)
Posted: Thursday 05 January 2023 20:43
by QNTL
So dear FireWizard,
You've helped on this issue in the past as well. It was in this topic
viewtopic.php?t=27627&start=20#.
The solution is missing though. The link you posted doesn't work anymore
Can you remember anything about that link?
I've reached out to HNBC84 as well. Hope he sees it!
Re: Spoken Notifications Goolge Home (Mini/Nest/Chromecast etc)
Posted: Thursday 05 January 2023 21:11
by QNTL
OKAY.....SO IT WORKS NOW
Cannot express my joy right now.
This topic solved my problem:
viewtopic.php?t=26504
I needed to add this to the script:
The full script is:
Code: Select all
#!/bin/sh
sudo -H -u pi /home/pi/.local/bin/catt -d, --device Kantoor cast /home/pi/Music/file.mp3
I cannot explain why. Maybe someone with knowledge can?
Again, I cannot script, but Googling and following orders I can.
Thanks for all the help.

Re: Spoken Notifications Goolge Home (Mini/Nest/Chromecast etc)
Posted: Thursday 05 January 2023 21:17
by FireWizard
Hello @QNTL,
I do not remember that I posted in this thread. However I do remember that I posted once, but I also saw that that post has been removed. Probably this one. No idea, why. I have had similar problems in the past but I abandoned that topic, as I found another solution.
But I think we should find the cause of this issue, as it returns regularly.
As I use catt as well, I needed a way to activate the stream, in my case a Domoticz webpage.
Therefore I considered a virtual switch in Domoticz, like you. But that is not very practical.
Therefore I decided to use a voice command. This activates a virtual switch in Node-RED.
As I run catt and Node-RED on different Raspberry Pi's, I had to transfer the command to the other Pi. A program called mqtt-launcher does that job for me.
So there was no need for me, to activate a command by a script.
By the way, do you have Node-RED running?
Regards
Re: Spoken Notifications Goolge Home (Mini/Nest/Chromecast etc)
Posted: Thursday 05 January 2023 21:34
by FireWizard
Hello @QNTL.
Our posts crossed each other an I'm happy that it works. Perfect
So you do not need an intermediate script!
Can you modify the title a little? Swap the l and g. And can you mark the topic as solved?
If you look in the man page for sudo, you will find:
-H' The -H (HOME) option requests that the security policy set the HOME environment variable to the home directory of the target user (root by default) as specified by the password database. Depending on the policy, this may be the default behavior.
and
-u user' The -u (user) option causes sudo to run the specified command as a user other than root. To specify a uid instead of a user name, #uid. When running commands as a uid, many shells require that the '#' be escaped with a backslash ('\'). Security policies may restrict uids to those listed in the password database. The sudoers policy allows uids that are not in the password database as long as the targetpw option is not set. Other security policies may not support this.
I was pretty sure that it had something to do with some "environment" thing.
Good that you found it.
@waltervl
Can you document this solution in the WIKI, as it is an often recurring issue.
Regards
Re: Spoken Notifications Google Home (Mini/Nest/Chromecast etc)
Posted: Thursday 05 January 2023 22:07
by QNTL
Have done so.
Again, thanks for all the help.
And I'm glad that I could found something to add to the community, even though it was just searching and asking the right questions!
how to create a new post
Posted: Friday 06 January 2023 14:36
by franseilering
in the domoticz website, the wiki page, there is description on how to use domoticz api json url
I cannot write the url here. Very strange
Just below the contents there is a format describing the url to change a switch or whatever.
I can NOT show this url here??
and if I have a script like
Code: Select all
return {
on = {
customEvents = {
'testTrigger' -- event triggered by emitEvent
}
},
execute = function(XX, XXX,triggerinfo)
XXdevices(13).switchOn() --end
XXlog('Test succeeded = ' .. XXX data(0), XX LOG_ERROR)
end
}
I replaced dz with XX and device with XXX.
Is this the way I have to post a problem?
My problem is that if the script is executed I want to use the parameters I included in the url
---jeessoonhtm?type=command¶m=customevent&event=testTrigger&idx=10&switchcmd=Set%20Level&level=25
(I cannot include json with a dot and then htm or http in the line above)
I tried dz DOT log('Test succeeded = ' .. device DOT data, dz DOT LOG_ERROR)
but it gives me an error