Huh, this looks strange, you are not using the tts
service, but are using the cached file created by the tts service.
Also the metadata
part should be indented under data
Your traces are not working for me, de dpaste page keeps loading, but doesn’t show anything (could be dpaste is down)
I tried to call your script before executing the tts message in a sequence…I didn’t catch what happened…a couple of time started to work and then stopped.
Sometimes it happened to hear the tts message twice.
Last but not the least, executing multiple times the flow, which contains the script and the call service to the tts message…the volume started to raise and lower…and I haven’t done any changes in the volume…very very strange…
I will do more tests, and when it will be clearer for me, I will give you (i hope) better explanation with the traces.
If you execute the script without an action, it won’t do anything.
If you add it with the action (the tts service call) it will execute that service call, so you don’t have to that again after the script service call.
BTW, this might be easier for you to include:
service: script.google_home_resume
data:
action:
- service: tts.google_translate_say
data:
entity_id: media_player.camerastudio
message: This is a TTS message
script_extra:
volume: 0.8
My main problem is exactly this: I do not know how to integrate this “action” in node red.
How do you currently include the message in the tts service call?
Looks like my issue came from how I was calling the tts message. I used visual editor with these steps. Add action, play media, selected the player, pick media, tts, google, typed my message, and done. That’s where the code came from in my last message, it was generated by the visual editor.
Calling tts with this code seemed to work just fine volume did restore in all my different scenarios. I think I am going to change how I call the tts message even though everything is working as is this is much simpler and seems like its how you intended it to be called.
service: tts.google_translate_say
data:
entity_id: media_player.all_speakers
message: "run the test"
Feels good to see the problem. Again, thanks for everything!!
Finally, I achieved to modify the service call, so now everything works. Thank you very much for the help. The hardest thing was to write the json format, but only because I haven’t idea how to do it. It is very easy, and it follow the logic of the yaml structure :
‘’’
{
"variables": {
"action": {
"service": "tts.google_translate_say",
"target": {
"entity_id": "media_player.camerastudio"
},
"data": {
"message": "Questo e un messaggio",
"language": "it"
},
"extra": {
"volume": 0.7
}
}
}
}
‘’’
Here the code in node red:
[{“id”:“8bcd6f352b98e5e2”,“type”:“inject”,“z”:“30f4839e340a033e”,“name”:“Avvio CM”,“props”:[{“p”:“payload”}],“repeat”:"",“crontab”:"",“once”:false,“onceDelay”:0.1,“topic”:"",“payload”:"",“payloadType”:“str”,“x”:100,“y”:400,“wires”:[[“911210ed47e9cda1”]]},{“id”:“911210ed47e9cda1”,“type”:“api-call-service”,“z”:“30f4839e340a033e”,“name”:"",“server”:“5f04c7c3.35aa98”,“version”:5,“debugenabled”:true,“domain”:“script”,“service”:“turn_on”,“areaId”:[],“deviceId”:[],“entityId”:[“script.google_home_resume”],“data”:"{“variables”:{“action”:{“service”:“tts.google_translate_say”,“target”:{“entity_id”:“media_player.camerastudio”},“data”:{“message”:“Questo e un messaggio”,“language”:“it”},“extra”:{“volume”:0.7}}}}",“dataType”:“json”,“mergeContext”:"",“mustacheAltTags”:false,“outputProperties”:[],“queue”:“none”,“x”:300,“y”:400,“wires”:[[]]},{“id”:“5f04c7c3.35aa98”,“type”:“server”,“name”:“Home Assistant”,“addon”:true}]
For next time:
Thank you very much…
I was so happy that finally worked… unfortunately, not at all…
Indeed, it does not work when it triggers the google nest device (cucinanest), not only for Spotify, but also for YouTube.
Here the two traces :
google - Pastebin.com
The other thing that I cannot make it work since the beginning, it is the so called dummy player…
If I follow your instruction and I try to install vlc, it pops up a window in which it asks me for a password.
I have no idea which password to put…any idea?
First some general comments.
-
primary_spotcast
should berobert_soldano
, not what you have now. It doesn’t really matter since you only have one Spotify account integrated, but if you even add one, you need to make sure it matches. - You can remove the
radio_data
if you don’t use it.
What I can see in the trace is that players_to_resume
returns an empty list. However, when I try the template which creates this variable with the data from your trace, I get the right player. The only reason I can imagine why that happens is that there was already a resume active for that script.
I’m working on an update which will also show that in the trace, so if you update to that version as soon as I released it, it will give me some more data to use to debug.
You wrote: " primary_spotcastshould be
robert_soldano`, not what you have now. It doesn’t really matter since you only have one Spotify account integrated, but if you even add one, you need to make sure it matches."
I cannot understand what you mean.
In the file I found: “primary_spotcast”: “Robert.soldano”.
And this is the correct one. Can you explain me, what do you mean?
No, that is not the correct one, it should be:
primary_spotcast: robert_soldano
the value for primary_spotcast
should match the media_player entity from the Spotify integration which is media_player.spotify_robert_soldano
Where Can I verify which is my primary spotcast user?
You can’t
The setting is just there in case you have more then one Spotify account integrated, and therefor also added additional accounts to the spotcast setup.
The additional accounts will have an account name, the first one not.
This primary_spotcast
setting is there to determine which account has not been set up with an account name, so that specific function of the spotcast.start service call will not be used.
I have just installed visual studio code server… just to see what it does.
I opened the scripts.yaml file on which I place your script…it tells me that there is an error in the file.
I do not know if it can help to better the code…
No, it won’t help improving the code, as there is nothing wrong there. VSCode is incorrect with regards to this error.
Normally the contents of the data
section of a service call is a dictionary.
Something like this:
data:
account: foo
media: bar
VSCode is not aware that you can template the entire data
part. So it throws this error. The code is actually correct.
Could you let me know something about the dummy player vlc telnet?
Could you let me know something about the vlc?
It looks like you are trying to add the integration, you should install the add-on via the Add On store (Settings > Add-ons). The integration will be automatically discovered then.
Yes, you were right. Thank you again.