Supergiovane / node-red-contrib-sonospollytts

Play speech TTS using Sonos.
https://www.facebook.com/supergiovaneDev
MIT License
12 stars 6 forks source link

sonospollytts, hassio, docker and volume settings on Deploy and permissions to /tmp #16

Closed MarkusKu closed 5 years ago

MarkusKu commented 5 years ago

Hey, I run Node Red as an addon of an dockerized hassio installation on Ubuntu 18.04.2. I set up sonospollytts (seemingly) correctly with a sonos playbar as controller.

I think the following two issues are independent:

  1. When Sonos is playing and I deploy a flow, the volume is set to the value which is set in the sonospollytts node. This is a little bit annoying when you try things while listening to a radio station.

  2. When Sonos is stopped and I try the examples, the state of the node changes from ready, transitioning, download, error. In the debug-console the error "SonosPollyTTS: notifyError - unable to write TTS file. Check user permissions" shows up. I tried with docker exec <NodeRedContainer> /bin/bash to check the permissions of the /tmp-directory. It is owned by root and has 777 permissions. NodeRed is (as far as I can see) as well running as root. So there should be no problem with the rights. While starting NodeRed the hailing.mp3 is copied to this directory. The file is owned by root.

When Sonos is playing and the sonospollytts node is triggered, the above mentioned error is not showing. Neither the volume is changed nor any message is played.

The AWS IAM page doesn't show any login attempts, regardless if the credentials are entered correctly or not.

How to fix? Markus

Addition: Accessing of http://hassio:1880/tts/tts.mp3?f=/tmp/hailing.mp3 via a webbrowser works.

Supergiovane commented 5 years ago

Hello Markus I’ll take a look to it tomorrow.

Sent by Massimo on the move

Il giorno 23 giu 2019, alle ore 19:30, MarkusKu notifications@github.com ha scritto:

Hey, I run Node Red as an addon of an dockerized hassio installation on Ubuntu 18.04.2. I set up sonospollytts (seemingly) correctly with a sonos playbar as controller.

I think the following two issues are independent:

When Sonos is playing and I deploy a flow, the volume is set to the value which is set in the sonospollytts node. This is a little bit annoying when you try things while listening to a radio station.

When Sonos is stopped and I try the examples, the state of the node changes from ready, transitioning, download, error. In the debug-console the error "SonosPollyTTS: notifyError - unable to write TTS file. Check user permissions" shows up. I tried with docker exec /bin/bash to check the permissions of the /tmp-dirctory. It is owned by root and has 777 permissions. NodeRed is (as far as I can see) as well running as root. So there should be no problem with the rights. While starting NodeRed the hailing.mp3 is copied to this directory. The file is owned by root.

When Sonos is playing and the sonospollytts node is triggered, the above mentioned error is not showing. Neither the volume is changed nor any message is played.

The AWS IAM page doesn't show any login attempts, regardless if the credentials are entered correctly or not.

How to fix? Markus

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Supergiovane commented 5 years ago

sonospollytts.js.zip

Hello Markus, We'll focus on pount 2., because point 1. should be not so hard to be addressed in the upcoming release. About AWS credentials: do you see this message in the terminal's debug log, when node-red is started? "The security token included in the request is invalid." If yes, your credentials are wrong. The fact that sonospollytts is unable to write to the temp directory can be due to this problem. Can you check please and eventually, post here the node-red console log?

After that, please unzip the attached zip into the .node-red/node_modules/node-red-contrib-sonospollytts/sonospollytts folder and restart node-red. The volume issue should be resolved and i've added some more error logging verbosity. After that, run node-red and please post again the node-red console log here. Thanks.

MarkusKu commented 5 years ago

I was a little bit struggeling getting the logfiles. It seems it logs to the docker console. So I attached to it during startup. I'll try now the thing with the attached zip.

root@hassio:/home/markus# docker attach addon_a0d7b954_nodered exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 00-banner.sh: executing...

----------------------------------------------------------- Hass.io Add-on: Node-RED Flow-based programming for the Internet of Things ----------------------------------------------------------- Add-on version: 4.0.0 You are running the latest version of this add-on. System: Ubuntu 18.04.2 LTS (amd64 / qemux86-64) Home Assistant version: 0.94.4 Supervisor version: 166 ----------------------------------------------------------- Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat. ----------------------------------------------------------- [cont-init.d] 00-banner.sh: exited 0. [cont-init.d] 01-log-level.sh: executing... Log level is set to INFO [cont-init.d] 01-log-level.sh: exited 0. [cont-init.d] nginx.sh: executing... [cont-init.d] nginx.sh: exited 0. [cont-init.d] node-red.sh: executing... [19:48:21] INFO: Password is NOT in the Have I Been Pwned database! Nice! [19:48:22] INFO: Password is NOT in the Have I Been Pwned database! Nice! patching file nodes/ui_base.html Hunk #1 succeeded at 530 (offset -1 lines). audited 270 packages in 14.077s found 0 vulnerabilities

[cont-init.d] node-red.sh: exited 0. [cont-init.d] user.sh: executing... [cont-init.d] user.sh: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [19:49:07] INFO: Starting Node-RED...

> hassio-addon-node-red@ start /opt > node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"

24 Jun 19:49:27 - [info]

Welcome to Node-RED \===================

24 Jun 19:49:27 - [info] Node-RED version: v0.20.6 24 Jun 19:49:27 - [info] Node.js version: v10.16.0 24 Jun 19:49:27 - [info] Linux 4.15.0-52-generic x64 LE 24 Jun 19:49:28 - [info] Loading palette nodes 24 Jun 19:50:12 - [warn] rpi-gpio : Raspberry Pi specific node set inactive 24 Jun 19:50:14 - [info] Dashboard version 2.15.4 started at /endpoint/ui 24 Jun 19:50:40 - [info] Settings file : /etc/node-red/config.js 24 Jun 19:50:40 - [info] Context store : 'default' [module=memory] 24 Jun 19:50:40 - [info] User directory : /config/node-red/ 24 Jun 19:50:40 - [warn] Projects disabled : editorTheme.projects.enabled=false 24 Jun 19:50:41 - [info] Flows file : /config/node-red/flows.json 24 Jun 19:50:41 - [info] Server now running at http://127.0.0.1:46836/ 24 Jun 19:50:41 - [info] Starting flows [19:50:41] INFO: Starting NGinx... 24 Jun 19:50:42 - [info] SonosPollyTTS: ConfigNode:[object Object] 24 Jun 19:50:42 - [info] SonosPollyTTS: Temp dir set to /tmp 24 Jun 19:50:42 - [info] SonosPollyTTS: Node-Red URL: http://192.168.175.230:1880 24 Jun 19:50:42 - [info] Moving hailing file hailing.mp3 to temp dir /tmp 24 Jun 19:50:42 - [info] Started flows nginx: [alert] detected a LuaJIT version which is not OpenResty's; many optimizations will be >disabled and performance will be compromised (see https://github.com/openresty/luajit2 for >OpenResty's LuaJIT or, even better, consider using the OpenResty releases from >https://openresty.org/en/download.html) 24 Jun 19:50:46 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant

And then the contents of the debug nodes follow....

MarkusKu commented 5 years ago

A little actionlog here...

So, it seems the plugins are located at a different location:

root@a0d7b954-nodered:/opt$ find / -name "sonospollytts" /opt/sonospollytts.js /config/node-red/node_modules/node-red-contrib-sonospollytts /config/node-red/node_modules/node-red-contrib-sonospollytts/sonospollytts /config/node-red/node_modules/node-red-contrib-sonospollytts/sonospollytts/sonospollytts.html /config/node-red/node_modules/node-red-contrib-sonospollytts/sonospollytts/sonospollytts.js

Moving it to the correct destination...

root@a0d7b954-nodered:/opt$ mv sonospollytts.js /config/node-red/node_modules/node-red-contrib-sonospollytts/sonospollytts/sonospollytts.js

Restarting Node Red...

root@hassio:/home/markus# docker attach addon_a0d7b954_nodered [s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 00-banner.sh: executing...

----------------------------------------------------------- Hass.io Add-on: Node-RED Flow-based programming for the Internet of Things ----------------------------------------------------------- Add-on version: 4.0.0 You are running the latest version of this add-on. System: Ubuntu 18.04.2 LTS (amd64 / qemux86-64) Home Assistant version: 0.94.4 Supervisor version: 166 ----------------------------------------------------------- Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat. ----------------------------------------------------------- [cont-init.d] 00-banner.sh: exited 0. [cont-init.d] 01-log-level.sh: executing... Log level is set to INFO [cont-init.d] 01-log-level.sh: exited 0. [cont-init.d] nginx.sh: executing... [cont-init.d] nginx.sh: exited 0. [cont-init.d] node-red.sh: executing... [20:35:47] INFO: Password is NOT in the Have I Been Pwned database! Nice! [20:35:48] INFO: Password is NOT in the Have I Been Pwned database! Nice! patching file nodes/ui_base.html Hunk #1 succeeded at 530 (offset -1 lines). audited 270 packages in 10.82s found 0 vulnerabilities

[cont-init.d] node-red.sh: exited 0. [cont-init.d] user.sh: executing... [cont-init.d] user.sh: exited 0. [cont-init.d] done. [services.d] starting services [20:36:18] INFO: Starting Node-RED... [services.d] done.

> hassio-addon-node-red@ start /opt > node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"

24 Jun 20:36:30 - [info]

Welcome to Node-RED \===================

24 Jun 20:36:30 - [info] Node-RED version: v0.20.6 24 Jun 20:36:30 - [info] Node.js version: v10.16.0 24 Jun 20:36:30 - [info] Linux 4.15.0-52-generic x64 LE 24 Jun 20:36:31 - [info] Loading palette nodes 24 Jun 20:37:25 - [warn] rpi-gpio : Raspberry Pi specific node set inactive 24 Jun 20:37:26 - [info] Dashboard version 2.15.4 started at /endpoint/ui 24 Jun 20:37:42 - [info] Settings file : /etc/node-red/config.js 24 Jun 20:37:42 - [info] Context store : 'default' [module=memory] 24 Jun 20:37:42 - [info] User directory : /config/node-red/ 24 Jun 20:37:42 - [warn] Projects disabled : editorTheme.projects.enabled=false 24 Jun 20:37:42 - [info] Flows file : /config/node-red/flows.json 24 Jun 20:37:42 - [info] Server now running at http://127.0.0.1:46836/ [20:37:42] INFO: Starting NGinx... 24 Jun 20:37:43 - [info] Starting flows nginx: [alert] detected a LuaJIT version which is not OpenResty's; many optimizations will be >disabled and performance will be compromised (see https://github.com/openresty/luajit2 for >OpenResty's LuaJIT or, even better, consider using the OpenResty releases from >https://openresty.org/en/download.html) 24 Jun 20:37:43 - [info] SonosPollyTTS: ConfigNode:[object Object] 24 Jun 20:37:43 - [info] SonosPollyTTS: Temp dir set to /tmp 24 Jun 20:37:43 - [info] SonosPollyTTS: Node-Red URL: http://192.168.175.230:1880 24 Jun 20:37:43 - [info] Moving hailing file hailing.mp3 to temp dir /tmp 24 Jun 20:37:43 - [info] Started flows 24 Jun 20:37:48 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant

It seems nothing changed. But executing the sequence seems more enlightening:

[24/Jun/2019:20:44:11 -0400] 200 192.168.175.50, 172.30.32.1(172.30.32.2) POST /inject/401c35b.d22f5cc HTTP/1.1 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:67.0) Gecko/20100101 Firefox/67.0) 24 Jun 20:44:11 - [info] SonosPollyTTS: Leggi .MP3 diretto e skip polly, filename: hailing.mp3 [24/Jun/2019:20:44:11 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:44:11 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) 24 Jun 20:44:12 - [error] SonosPollyTTS: notifyError - msg: /tmp/Ciao-Mondoem-Come-stai_qm__Kimberly.mp3 error: 'AKIAQX7SBCR45CV-----/20190625/us-east-1/polly/aws4_request' not a valid key=value pair (missing equal-sign) in Authorization header: 'AWS4-HMAC-SHA256 Credential= AKIAQX7SBCR45CV-----/20190625/us-east-1/polly/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=0b88882ced54d52320b77a4188ba9563d91139065ddf9d782a6843b724a49159'.

(node:519) UnhandledPromiseRejectionWarning: TypeError: Cannot create property 'error' on string '/tmp/Ciao-Mondoem-Come-stai_qm__Kimberly.mp3' at notifyError (/config/node-red/node_modules/node-red-contrib-sonospollytts/sonospollytts/sonospollytts.js:944:19) at synthesizeSpeech.then.then.then.catch.error (/config/node-red/node_modules/node-red-contrib-sonospollytts/sonospollytts/sonospollytts.js:878:13) at process._tickCallback (internal/process/next_tick.js:68:7)

(node:519) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:519) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 24 Jun 20:44:12 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:13 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:14 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:15 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:16 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:17 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:18 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:19 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:20 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:21 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:22 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:23 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:24 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:25 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:26 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit 24 Jun 20:44:27 - [info] SonosPollyTTS: HandleQueue - Polly is in downloading Timeout 24 Jun 20:44:27 - [info] SonosPollyTTS: HandleQueue - Polly is downloading the file, exit [24/Jun/2019:20:44:28 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:44:38 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:44:48 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:44:58 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:45:08 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:45:18 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:45:28 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:45:38 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:45:48 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:45:59 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:46:09 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:46:19 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:46:28 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:46:38 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9))

I think the volume issue is fixed. Thank you!

MarkusKu commented 5 years ago

Another thing: I was wondering why the Sonos tried to download the hailing.mp3 and I couldn't hear anything. I saw the 401 error. I disabled all passwords from the configuration, but it seems that the Hass.io implementation requires at least one password:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 00-banner.sh: executing...

----------------------------------------------------------- Hass.io Add-on: Node-RED Flow-based programming for the Internet of Things ----------------------------------------------------------- Add-on version: 4.0.0 You are running the latest version of this add-on. System: Ubuntu 18.04.2 LTS (amd64 / qemux86-64) Home Assistant version: 0.94.4 Supervisor version: 166 ----------------------------------------------------------- Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat. ----------------------------------------------------------- [cont-init.d] 00-banner.sh: exited 0. [cont-init.d] 01-log-level.sh: executing... Log level is set to INFO [cont-init.d] 01-log-level.sh: exited 0. [cont-init.d] nginx.sh: executing... [cont-init.d] nginx.sh: exited 0. [cont-init.d] node-red.sh: executing... [21:15:59] FATAL: [21:15:59] FATAL: Configuration of this add-on is incomplete. [21:15:59] FATAL: [21:15:59] FATAL: Please be sure to set the "credential_secret" option. [21:15:59] FATAL: [21:15:59] FATAL: The credential secret is an encryption token, much like [21:15:59] FATAL: a password, that is used by Node-RED for encrypting [21:15:59] FATAL: credentials you put into Node-RED. [21:15:59] FATAL: [21:15:59] FATAL: Just like a password, a credential secret can be [21:15:59] FATAL: anything you like. Just be sure to store it somewhere [21:15:59] FATAL: safe for later, e.g., in case of a recovery. [21:15:59] FATAL: [cont-init.d] node-red.sh: exited 1. [cont-finish.d] executing container finish scripts... [cont-finish.d] 99-message.sh: executing... ----------------------------------------------------------- Oops! Something went wrong.

We are so sorry, but something went terribly wrong when starting or running this add-on.

Be sure to check the log above, line by line, for hints. ----------------------------------------------------------- [cont-finish.d] 99-message.sh: exited 0. [cont-finish.d] done. [s6-finish] waiting for services. [s6-finish] sending all processes the TERM signal.

By the way: I thing I already mentioned it, if I try to access the URL with a browser I have to authenticate and then it downloads and plays the sound.

I fiddeled a little around with the passwords and if the http://:@hassio:1880/tts/tts.mp3?f=/tmp/hailing.mp3 would be a solution. Didn't work yet...

Supergiovane commented 5 years ago

Hello Markus, where you wrote:

It seems nothing changed. But executing the sequence seems more enlightening:

[24/Jun/2019:20:44:11 -0400] 200 192.168.175.50, 172.30.32.1(172.30.32.2) POST /inject/401c35b.d22f5cc HTTP/1.1 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:67.0) Gecko/20100101 Firefox/67.0) 24 Jun 20:44:11 - [info] SonosPollyTTS: Leggi .MP3 diretto e skip polly, filename: hailing.mp3 [24/Jun/2019:20:44:11 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) [24/Jun/2019:20:44:11 -0400] 401 -(192.168.175.211) GET /tts/tts.mp3?f=%2Ftmp%2Fhailing.mp3 HTTP/1.1 (Linux UPnP/1.0 Sonos/50.1-65071 (ZPS9)) 24 Jun 20:44:12 - [error] SonosPollyTTS: notifyError - msg: /tmp/Ciao-Mondoem-Come-stai_qm__Kimberly.mp3 error: 'AKIAQX7SBCR45CV-----/20190625/us-east-1/polly/aws4_request' not a valid key=value pair (missing equal-sign) in Authorization header: 'AWS4-HMAC-SHA256 Credential= AKIAQX7SBCR45CV-----/20190625/us-east-1/polly/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=0b88882ced54d52320b77a4188ba9563d91139065ddf9d782a6843b724a49159'.

this is the problem: "...not a valid key=value pair (missing equal-sign) in Authorization header..." You may have missed something in the AWS authorization (Polly acces Key and Polly secret Key) or this can be related to the fact, that you need authentication on every http request. I have no hass.io to test with, but if you're able in some way to disable the http authentication, it should be better.

The hailing.mp3 is not downloaded. I'ts simply copied from the plugin folder to the Temp directory. The copy works, so there are no problems with file permissions. Please check again the Polly authentication fields and let me know. Thanks.

MarkusKu commented 5 years ago

It's two things:

  1. AWS authentication: I entered the credentials in the config node. See the screenshot. You also see the token in the log. I changed the last 5 chars for obvious reasons in the data I posted here...
  2. The authentication against the node red webserver: Under hass.io requires to set at least a password whith which all the in node red entered credentials are encrypted. I can not leave it empty. I also can not change it without reencrypt or probably rather reenter all the credentials. I also do not know if the trust between homeassistant and node red will be broken if I change something. So I tried to find a way to pass some credentials in the URL to access the file via html. If it works you can maybe add some additional credential fields for authenticating against node red
Supergiovane commented 5 years ago

Hello Markus This is a very particular node, because it opens an http endpoint to listen to Sonos. When you write somethings, the node tells AWS Polly service to transform the text in an mp3. The node downloads the mp3 and stores it in the temp folder. Then the node creates an HTTP endpoint and tells Sonos: "Sonos, please connect to this endpoint and begin streaming this file". This process involves the fact, in your case, that Sonos must authenticate itself to Node-Red. There is nothing i can do to controlling how Sonos is authenticating, therefore i'm not optimistic that you can use this node behind hass.io, if it doesn't permit Sonos to connect to node-red without authentication. What i can try, is to pass the username and password of your node-red to Sonos and hope it can do some sort of auth by itself. But i need time to install hass.io on an RPi and try it.

The fastest way for you, is to setup another RPI with standard node-red installation, used only for sonospollytts and communicate with this RPi via MQTT. But i'll let you know. In the meantime i leave this issue opened.

Supergiovane commented 5 years ago

Hello Markus just as info, what is running on that port?

24 Jun 19:50:41 - [info] Server now running at http://127.0.0.1:46836/

MarkusKu commented 5 years ago

Hello Supergiovane, I don't use a RPI. I use a ubuntu 18.04.2 LTS in a VM on a Synology Diskstation. I installed it like described here.

If I could be of assistance, I could set you up a Virtualbox-VM with hassio.

On localhost:46836 is node-red running. I think it is reverse proxied by nginx to 1880. I'llcheck If I can bypass this. I think nginx is enforcing the authentication.

root@hassio:/home/markus# netstat -antp | grep 468 tcp 0 0 127.0.0.1:46836 0.0.0.0: LISTEN 29857/node-red
tcp 0 0 127.0.0.1:46836 127.0.0.1:58474 ESTABLISHED 29857/node-red
tcp 0 0 127.0.0.1:46836 127.0.0.1:58668 ESTABLISHED 29857/node-red
tcp 0 0 127.0.0.1:58668 127.0.0.1:46836 ESTABLISHED 29929/nginx: worker tcp 0 0 127.0.0.1:58474 127.0.0.1:46836 ESTABLISHED 29929/nginx: worker root@hassio:/home/markus# netstat -antp | grep 1880 tcp 0 0 0.0.0.0:1880 0.0.0.0:
LISTEN 29797/nginx: master tcp 0 0 192.168.175.230:1880 192.168.175.211:35034 TIME_WAIT -
tcp 0 0 192.168.175.230:1880 192.168.175.211:35029 TIME_WAIT -
tcp 0 0 192.168.175.230:1880 192.168.175.211:35030 TIME_WAIT -
tcp 0 0 192.168.175.230:1880 192.168.175.211:35020 TIME_WAIT -
tcp 0 0 192.168.175.230:1880 192.168.175.211:35024 TIME_WAIT -
tcp 0 0 192.168.175.230:1880 192.168.175.211:35025 TIME_WAIT -

Supergiovane commented 5 years ago

Thanks for the infos. I tried to activate the authentication in nodered and sonospollytts works. I suspect something in the hassio proxy. Good idea the VM. I’ve a qnap and i’ll use this to make some tests woth hassio. If you’re running in VM, you can try to use my workaround in the meantime. (Install clean nodered on debian /ubuntu VM). There is a desktop version of raspbian as well.