Closed JorinL closed 5 years ago
Hello JorinL, do you still have this problem? Have you tried to leave the default temp field blank?
Yep - problem persists.
Empty uses /tmp - same problem.
It needs to be a directory which is available for other machines/sonos on my node-red server right? Or does ist send the mp3 file to the sonos and not the sonos needs access to the dir?
For me that would be from node red perspective /data/public/ from LAN via http "http://duffstation:1880/some_mp3_file.mp3
Just for the info my Node Red is inside a docker container - but available from the local network.
Hello Once created the mp3 file, the node tells Sonos to contact an endpoint it created in your node-red. Sonos contacts this endpoint. The endpoint read the mp3 from your temp folder and starts streaming it to sonos using the fake "tts.mp3" filename. Sonos is not in direct "contact" with your directory. I saw you're in Germany. Do you maybe run Node-Red behind homematic?
It needs to be a directory which is available for other machines/sonos on my node-red server right?
NO
Or does ist send the mp3 file to the sonos and not the sonos needs access to the dir?
YES
Hi, no the Node-Red ist an instance alone on a Rancher Kubernetes Cluster with Docker under the hood. It is mainly connected over MQTT to a "FHEM" instance.
Maybe this "endpoint" has no access to the directory? This endpoint is spawning on the node JS where Node-Red is running (same user?)?
It seems to be the same user: -rw-r--r-- 1 node-red node-red 56673 Oct 24 13:10 hailing.mp3 that is now inside /tmp
Hi, Has Docker the port forwarting to node-red? If not, Sonos cannot contact node-red. Node-red must have r/w access rights to the temp folder, but it has, otherwise you'll not hear the hailing. Do you've tried a simple reboot?
Jep - port forwarding 1880 ist done - is there more needed for this node? Node-Red ist working fine over years now ;-) r/w is given.
I redeployed the container / like a reboot :-D
Sonos gets the info from the node but says - no file available
No, it should work. Can you post the node-red output log? What appens if you double click on the mp3 file directly? Can you copy the mp3 you find in the tmp folder (you may use TFTP to copy it) to your desktop ant try to play it by double clicking on it?
I need to be sure that at least, the mp3 file itself is working.
Mp3s are working fine.
Log
node-red-docker@1.0.1 start /usr/src/node-red
node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"
24 Oct 13:49:19 - [info]
Welcome to Node-RED
===================
24 Oct 13:49:19 - [info] Node-RED version: v1.0.1
24 Oct 13:49:19 - [info] Node.js version: v12.10.0
24 Oct 13:49:19 - [info] Linux 4.15.0-66-generic x64 LE
24 Oct 13:49:20 - [info] Loading palette nodes
24 Oct 13:49:21 - [info] Dashboard version 2.17.1 started at /ui
24 Oct 13:49:21 - [info] Settings file : /data/settings.js
24 Oct 13:49:21 - [info] HTTP Static : /data/public
24 Oct 13:49:21 - [info] Context store : 'default' [module=memory]
24 Oct 13:49:21 - [info] User directory : /data
24 Oct 13:49:21 - [warn] Projects disabled : editorTheme.projects.enabled=false
24 Oct 13:49:21 - [info] Flows file : /data/flows.json
24 Oct 13:49:21 - [info] Starting flows
24 Oct 13:49:21 - [info] SonosPollyTTS: ConfigNode:[object Object]
24 Oct 13:49:21 - [info] SonosPollyTTS: Temp dir set to /tmp
24 Oct 13:49:21 - [info] SonosPollyTTS: Node-Red URL: http://192.168.0.8:1880
24 Oct 13:49:21 - [info] Moving hailing file hailing.mp3 to temp dir /tmp
24 Oct 13:49:22 - [info] Started flows
24 Oct 13:49:22 - [info] Server now running at http://127.0.0.1:1880/admin/
24 Oct 13:49:22 - [info] [mqtt-broker:707c62cd.b68904] Connected to broker: mqtt://192.168.0.8:1883
Checking for Hue Bridge updates…
24 Oct 13:49:22 - [error] [function:2e5dfef4.f58de2] ReferenceError: boost is not defined (line 12, col 17)
24 Oct 13:49:22 - [error] [function:eb392a9b.77398] ReferenceError: humidity is not defined (line 11, col 1)
SoftwareUpdate {
attributes: Attributes { attributes: { checkforupdate: true }, changed: {} }
}
Updating Hue Bridge Firmware and Lights…
24 Oct 13:49:55 - [info] SonosPollyTTS: Leggi .MP3 diretto e skip polly, filename: hailing.mp3
24 Oct 13:49:56 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit
Ok let me finish an update to the knx-ultimate node, then i'll look at this! I know that when running behind something, like docker, homeassistant and so on, Sonos has issues to contact node-red to start streaming. I'll look again into that. Is there nothing below "24 Oct 13:49:56 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit" line?
No sorry - that is the last line appearing.
Is this /tts/tts.mp3 expected somewhere in the filesystem or viewable on https://192.168.0.8:1880/tts/tts.mp3 ? Or is it really not an existent file? :-D
"/tts/tts.mp3" it's an non existent file. "tts" is the endpoint that sonos calls and the tts.mp3 is a fake file. I suspect there's something that stops sonos to reach the endpoint. I need to dive in the code.
What works ist to play a mp3 which i used with node red and a direct connected speaker:
24 Oct 14:20:44 - [info] SonosPollyTTS: Leggi HTTP filename: http://192.168.0.8:1880/Doorbell/Sound-of-a-doorbell.mp3
plays nice on the Sonos. So only the Polly thing won't
That's important. So you have the endpoint "Doorbell" that Sonos can reach? The node doesn't create a "Doorbell" endpoint. Have you edited something by hands? Auf jedem Fall, ich werde nochmal prüfen. Vielleicht etwas um Polly API nicht klappt.
Hehe it is not an endpoint - its a normal mp3 file I use since ages to play it on a connected speaker. I just used an inject node with this string "http://192.168.0.8:1880/Doorbell/Sound-of-a-doorbell.mp3" against the sonospollytts node. No polly function used here. But it works an sonos plays that file or the node streams it to the sonos.
Nothing edited by hand.
OK! Will take a look. If you inject that, the node again read the doorbell.mp3 and creates a tts endpoint. So this part does work.
Can you confirma that:If you inject something like {payload:"Hallo, wie geht es ihnen"), it creates the mp3 and you can play it out of node-red by double clicking on it?
If you inject that, the node again read the doorbell.mp3 and creates a tts endpoint. So this part does work.
If i inject the doorbell.mp3 it works and I see @sonos: And Hailing does not work - Sound-of-a-doorbell.mp3 works.
Can you confirma that:If you inject something like {payload:"Hallo, wie geht es ihnen"), it creates the mp3 and you can play it out of node-red by double clicking on it?
Can't confirm. Injecting "Hallo, wie geht es ihnen" creates the mp3 (which is playable) and copies the hailing.mp3 into /tmp, but then Sonos says:
And nothing is played at all.
Ok, thanks. I'll check and revert. Please leave me some time, because i'm working to release today an update version of another my node knx-ultimate. Thank i'll take a look after dinner or tomorrow. Sorry for that, but i'm concentrated on another node and i cannot have two things at the same time (i'm not multitasking anymore).
Hey no problem ;-) At least you care - thanks for that :-)
For what i can see, if the last thing on the log is "...is downloading, exit", it seems that the node cannot reach the Amazon AWS Apis to download the file. Do you maybe have a firewall blocking something ? I mean in your LAN, like pfSense or in Docker...
But the mp3 from AWS is there - and also payable (manually). Haling sound and the mp3 with the text to speech content are not working (are not played at the sonos and give out an error on sonos).
Everyhing else like playing mp3s from an http adress (Sound-of-a-doorbell.mp3) is working.
Yes, but it seems not able to close the connection, thus it goes in timeout, but ok, let me find out more... I suspect i must use a docker too, otherwise it works everytime. A question: do you have updated the node-red itself? I know that docker images are everytime out of date.
Eh ;-) Thats a bot of a prejudice :-)
My Dockerimage comes directly from Node-Red - running Node-Red 1.0.1: Maintenance Release
Currently I think the delivery from endpoint to sonos for the hailing and text to speech mp3 could be the problem. But also I don't know what normally is showing inside the Log :-)
Sorry, but i had another user using a very, very old nodered image, so old that some javascript functions where not implemented! :-) I've a Qnap Nas with Docker. I'll try it.
Hehe ;-) using docker means also keeping with the timeline and up to date :-) (In my personal way)
Thanks for the investigation and Time! :-)
If i can help - let me know.
I'm back to you. The knx-ultimate node has been deployed, so yet i've time for you. I've installed the docker image. I've set the port on docker to 1880 I've set up sonospollytts with Marlene. Bang, it works. Can i see your docker network configuration? Mine is like this:
My Setup looks like this (Rancher is a bit more then only Docker):
Ist the sonospolltts using some other tools eventually? Probably not included in my container?
No, all required depencendies are automatically downloaded by the package installer. Network seems to be ok. I never heard about Kubernetes. I haven’t any chances to try it, but it should run like my qnap container station. I’ll try some “blind” test tomorrow, to try to figure out what the problem can be.
sonospollytts.js.zip Hallo Jorin i've added some debug log. Can you extract the attached file and copy it into this folder?
.node-red/node_modules/node-red-contrib-sonospollytts/sonospollytts
Then, please restart node-red and try "Super duper ciao" and post me the log. Thanks.
Good morning :-)
Did place the file and tested first with empty /tmp and then again. It did not play - but we have one DEBUG in Log.
25 Oct 07:52:30 - [info] SonosPollyTTS: ConfigNode:[object Object]
25 Oct 07:52:30 - [info] SonosPollyTTS: Temp dir set to /tmp
25 Oct 07:52:30 - [info] SonosPollyTTS: Node-Red URL: http://192.168.0.8:1880
25 Oct 07:52:30 - [info] Moving hailing file hailing.mp3 to temp dir /tmp
25 Oct 07:52:30 - [info] SonosPollyTTS: Temp dir set to /tmp
25 Oct 07:52:30 - [info] SonosPollyTTS: Node-Red URL: http://192.168.0.8:1880
25 Oct 07:52:30 - [info] SonosPollyTTS: Hailing disabled
25 Oct 07:52:31 - [info] Started flows
25 Oct 07:52:31 - [info] [mqtt-broker:707c62cd.b68904] Connected to broker: mqtt://192.168.0.8:1883
Checking for Hue Bridge updates…
SoftwareUpdate {
attributes: Attributes { attributes: { checkforupdate: true }, changed: {} }
}
Updating Hue Bridge Firmware and Lights…
First test (empty /tmp)
25 Oct 07:55:43 - [info] SonosPollyTTS: Leggi .MP3 diretto e skip polly, filename: hailing.mp3
25 Oct 07:55:44 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit
Second test (files in /tmp both available)
25 Oct 07:55:59 - [info] SonosPollyTTS: Leggi .MP3 diretto e skip polly, filename: hailing.mp3
25 Oct 07:55:59 - [info] SonosPollyTTS: DEBUG - fromcache : /tmp/Hallo_pause_ wie geht es ihnen_Marlene.mp3
25 Oct 07:56:00 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit``````
Thanks. I need you to speak something that is not in the temp folder. Something like "uno due tre quattro". Sorry and thank you for your patience!
Which .js file should I take - the one from the email or the one from here? :-D They differ.
Frist test was with an "empty" temp folder.
Hello Jorin this one from here. I've added more "Jorin" debug logs.
;-)
Ok I took that version:
25 Oct 08:23:50 - [info] SonosPollyTTS: Leggi .MP3 diretto e skip polly, filename: hailing.mp3
25 Oct 08:23:51 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit
Hmm.... it seems not even enter the function where i've logged "JORIN" rows. You should see some debug starting with "JORIN....".
Jep - I took a look into the code - seems to die after
RED.log.info('SonosPollyTTS: HandleQueue - Polly is downloading the file, exit');
This here should call the next function after 1 second right?
node.oTimer=setTimeout(function(){HandleQueue(node);},1000);
sonospollytts.js.zip Can you try with this and post the entire log?
This here should call the next function after 1 second right? node.oTimer=setTimeout(function(){HandleQueue(node);},1000);
It recalls itself every second, waiting until the file has been downloaded from AWS Polly API.
Now we have more output :-)
node-red-docker@1.0.1 start /usr/src/node-red
node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"
25 Oct 08:44:09 - [info]
Welcome to Node-RED
===================
25 Oct 08:44:09 - [info] Node-RED version: v1.0.1
25 Oct 08:44:09 - [info] Node.js version: v12.10.0
25 Oct 08:44:09 - [info] Linux 4.15.0-66-generic x64 LE
25 Oct 08:44:09 - [info] Loading palette nodes
25 Oct 08:44:10 - [info] Dashboard version 2.17.1 started at /ui
25 Oct 08:44:10 - [info] Settings file : /data/settings.js
25 Oct 08:44:10 - [info] HTTP Static : /data/public
25 Oct 08:44:10 - [info] Context store : 'default' [module=memory]
25 Oct 08:44:10 - [info] User directory : /data
25 Oct 08:44:10 - [warn] Projects disabled : editorTheme.projects.enabled=false
25 Oct 08:44:10 - [info] Flows file : /data/flows.json
25 Oct 08:44:10 - [info] Server now running at http://127.0.0.1:1880/admin/
25 Oct 08:44:10 - [info] Starting flows
25 Oct 08:44:10 - [info] SonosPollyTTS: ConfigNode:[object Object]
25 Oct 08:44:10 - [info] SonosPollyTTS: Temp dir set to /tmp
25 Oct 08:44:10 - [info] JORIN BEGIN
25 Oct 08:44:10 - [info] SonosPollyTTS: Node-Red URL: http://192.168.0.8:1880
25 Oct 08:44:10 - [info] Moving hailing file hailing.mp3 to temp dir /tmp
25 Oct 08:44:10 - [info] SonosPollyTTS: Temp dir set to /tmp
25 Oct 08:44:10 - [info] JORIN BEGIN
25 Oct 08:44:10 - [info] SonosPollyTTS: Node-Red URL: http://192.168.0.8:1880
25 Oct 08:44:10 - [info] SonosPollyTTS: Hailing disabled
25 Oct 08:44:11 - [info] Started flows
25 Oct 08:44:11 - [info] [mqtt-broker:707c62cd.b68904] Connected to broker: mqtt://192.168.0.8:1883
Checking for Hue Bridge updates…
SoftwareUpdate {
attributes: Attributes { attributes: { checkforupdate: true }, changed: {} }
}
Updating Hue Bridge Firmware and Lights…
25 Oct 08:46:28 - [info] JORIN LEGGI
25 Oct 08:46:28 - [info] SonosPollyTTS: Leggi .MP3 diretto e skip polly, filename: hailing.mp3
25 Oct 08:46:28 - [info] JORIN into PlaySonos for playing /tmp/hailing.mp3
25 Oct 08:46:28 - [info] JORIN into PlaySonos after encodeURIComponent sUrl:http://192.168.0.8:1880/tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3
25 Oct 08:46:28 - [info] JORIN into PlaySonos after setvolume
25 Oct 08:46:28 - [info] JORIN into PlaySonos setAVTransportURI node.sPollyState: transitioning
25 Oct 08:46:28 - [info] JORIN LEGGI
25 Oct 08:46:28 - [info] JORIN after filename = path.join(node.dir, filename); filename: /tmp/uno due tre quattro_Marlene.mp3
25 Oct 08:46:28 - [info] JORIN before synthesizeSpeech /tmp/uno due tre quattro_Marlene.mp3
25 Oct 08:46:29 - [info] JORIN after synthesizeSpeech /tmp/uno due tre quattro_Marlene.mp3
25 Oct 08:46:29 - [info] JORIN into PlaySonos for playing /tmp/uno due tre quattro_Marlene.mp3
25 Oct 08:46:29 - [info] JORIN into PlaySonos after encodeURIComponent sUrl:http://192.168.0.8:1880/tts/tts.mp3?f=%2Ftmp%2Funo%20due%20tre%20quattro_Marlene.mp3
25 Oct 08:46:29 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit
25 Oct 08:46:29 - [info] JORIN into PlaySonos after setvolume
25 Oct 08:46:29 - [info] JORIN into PlaySonos setAVTransportURI node.sPollyState: transitioning
My Thoughts: "http://192.168.0.8:1880/tts/tts.mp3?f=%2Ftmp%2Funo%20due%20tre%20quattro_Marlene.mp3"
This is a http address which is not available - not from the localhost not from LAN. Is it used that way? If the node stream from local filesystem "/tmp/uno due tre quattro_Marlene.mp3" it can reach that. But this http thing blows my mind :-D
Such address should be avaiable and if you point your browser to http://192.168.0.8:1880/tts/tts.mp3, you should download an empty (14 Byte) tts.mp3 file. Klappt das dir?
Thanks for the log! That's clearer now. I sent you again the .js file with some modifications.
Cannot GET /tts/tts.mp3 (Firefox)
Does your node starts a webserver? Or how should it be available?
No, the node creates an endpoint using the default node-red webserver. The enpoint is called "tts". Practically, it add an entry point to the standard node.red webserver. You should ever be able to download the tts.mp3.
Nope not able to.
I'm using pictures and gifs inside my flows - so i have a modified setup inside the node-red web root dir.
My httpStatic is "httpStatic: '/data/public',"
Can you add a path configuration for the tts.mp3 ? :-) I think thats the problem.
What appens if you point Firefox on http://192.168.0.8:1880/data/public/tts/tts.mp3 ?
Same.. "Cannot GET /data/public/tts/tts.mp3"
I think we found the problem - the tts.mp3 is not available on http. If you make the path of it configureable that would be it or not? :-D
Log from latest .js
node-red-docker@1.0.1 start /usr/src/node-red
node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"
25 Oct 09:03:19 - [info]
Welcome to Node-RED
===================
25 Oct 09:03:19 - [info] Node-RED version: v1.0.1
25 Oct 09:03:19 - [info] Node.js version: v12.10.0
25 Oct 09:03:19 - [info] Linux 4.15.0-66-generic x64 LE
25 Oct 09:03:19 - [info] Loading palette nodes
25 Oct 09:03:20 - [info] Dashboard version 2.17.1 started at /ui
25 Oct 09:03:20 - [info] Settings file : /data/settings.js
25 Oct 09:03:20 - [info] HTTP Static : /data/public
25 Oct 09:03:20 - [info] Context store : 'default' [module=memory]
25 Oct 09:03:20 - [info] User directory : /data
25 Oct 09:03:20 - [warn] Projects disabled : editorTheme.projects.enabled=false
25 Oct 09:03:20 - [info] Flows file : /data/flows.json
25 Oct 09:03:20 - [info] Server now running at http://127.0.0.1:1880/admin/
25 Oct 09:03:20 - [info] Starting flows
25 Oct 09:03:20 - [info] SonosPollyTTS: ConfigNode:[object Object]
25 Oct 09:03:20 - [info] SonosPollyTTS: Temp dir set to /tmp
25 Oct 09:03:20 - [info] JORIN BEGIN
25 Oct 09:03:20 - [info] SonosPollyTTS: Node-Red URL: http://192.168.0.8:1880
25 Oct 09:03:20 - [info] Moving hailing file hailing.mp3 to temp dir /tmp
25 Oct 09:03:20 - [info] SonosPollyTTS: Temp dir set to /tmp
25 Oct 09:03:20 - [info] JORIN BEGIN
25 Oct 09:03:20 - [info] SonosPollyTTS: Node-Red URL: http://192.168.0.8:1880
25 Oct 09:03:20 - [info] SonosPollyTTS: Hailing disabled
25 Oct 09:03:21 - [info] Started flows
25 Oct 09:03:21 - [info] [mqtt-broker:707c62cd.b68904] Connected to broker: mqtt://192.168.0.8:1883
Checking for Hue Bridge updates…
SoftwareUpdate {
attributes: Attributes { attributes: { checkforupdate: true }, changed: {} }
}
Updating Hue Bridge Firmware and Lights…
25 Oct 09:03:36 - [info] JORIN LEGGI
25 Oct 09:03:36 - [info] SonosPollyTTS: Leggi .MP3 diretto e skip polly, filename: hailing.mp3
25 Oct 09:03:36 - [info] JORIN into PlaySonos for playing /tmp/hailing.mp3
25 Oct 09:03:36 - [info] JORIN into PlaySonos after encodeURIComponent sUrl:http://192.168.0.8:1880/tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3
25 Oct 09:03:36 - [info] JORIN into PlaySonos after setvolume
25 Oct 09:03:36 - [info] JORIN into PlaySonos setAVTransportURI node.sPollyState: transitioning
25 Oct 09:03:36 - [info] JORIN LEGGI
25 Oct 09:03:36 - [info] JORIN after filename = path.join(node.dir, filename); filename: /tmp/uno due tre quattro_Marlene.mp3
25 Oct 09:03:36 - [info] JORIN before synthesizeSpeech /tmp/uno due tre quattro_Marlene.mp3
25 Oct 09:03:37 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit
25 Oct 09:03:37 - [info] JORIN after synthesizeSpeech /tmp/uno due tre quattro_Marlene.mp3
25 Oct 09:03:37 - [info] JORIN into PlaySonos for playing /tmp/uno due tre quattro_Marlene.mp3
25 Oct 09:03:37 - [info] JORIN into PlaySonos after encodeURIComponent sUrl:http://192.168.0.8:1880/tts/tts.mp3?f=%2Ftmp%2Funo%20due%20tre%20quattro_Marlene.mp3
25 Oct 09:03:37 - [info] JORIN into PlaySonos after setvolume
25 Oct 09:03:37 - [info] JORIN into PlaySonos setAVTransportURI node.sPollyState: transitioning
I'll try to handle httpStatic directly in the code.
I changed my httpStatic and now i've been able to reproduce the issue. Thanks for the hint. I come to you soon.
Nice! :-)
No. It works. Sorry i had a false IP set. It works even with httpStatic: '/data/public',
Do you maybe use https or authentication?
No - no https in use.
Is the entry you make to the webserver visible in the node-red config or just coming with the .js file?
Ohh I found the tts.mp3
http://duffstation:1880/admin/tts/tts.mp3
So that is not coming with the changed http static :-D But with the AdminRoot
Which is at my side: httpAdminRoot: '/admin'
Sonos mentions: "tts.mp3F=/data/public/2.mp3" is not availabe
Which is completely correct. Only "/data/public/2.mp3" is available for playback ;-) What means from Sonos side: http://duffstation:1880/2.mp3 Seems like a var comes into the output to sonos?
Sonos Controller: