[Deprecated] Amazon Alexa Text to Speech (TTS) v0.6.2 - Direct Integration (USA, Canada, UK, Italy, Australia, & Brazil)

How about this... Have the NodeJS server support two calls. The first would be a request to create/refresh the alexa cookie. This would then be stored within the NodeJS server (memory resident, local disk, etc...) but with some sort of time to live. If that amount of time expires, the NodeJS server would delete the cookie data. If a 2nd call comes in before the cookie TTL expires, the cookie would be returned and then the local cookie cache would be deleted.

Just trying to brainstorm ideas...

I'm not sure how long you are prepared to wait. You can put in a feature request, but we would have to prioritize it for implementation. At this point I think your best bet is to use one of the workarounds suggested in this thread.

I don't know what there is behind httpPost() function, but I think that it's just a "shortcut" for a groovy library to handle this and timeouts should be already available.
Seems that Hubitat has a timeout of 30 secs, while SmartThings from documentation it's 10 secs, so some changes has already been done from "pure" Groovy.

I know that everyone has his priorities, but this it's really a few minutes job, we (and you) have probably lost more time speaking about possible workarounds than expose a parameter for this.

I anyway understand your reasons so I'll try something different in the meanwhile.

Guys, finally we have it :muscle:t2:
Let me know if you found any problem, suggestions are welcome!

AlexaCookieNodeJs service with instructions:


To download as zip (only hubitat/AlexaCookieNodeJs/AlexaCookieNodeJs folder it's needed, maybe I can use Github releases later) use this link https://github.com/gabriele-v/hubitat/archive/master.zip

Updated Alexa TTS App for Hubitat:

6 Likes

This looks awesome! I'll try testing it tonight. Thank you!

Testing now...seem to be in an infinite loop in the HE app. ;(

[EDIT] Found my issue(s). It would be good to modify the username/password objects not to be the same as what HE uses. My autofill seems to keep placing my info into those fields constantly.

Works good overall btw! Will wait 6 days to see if refreshed.

1 Like

Hi, object names are unique (they are called alexaRefreshUsername and Alexa Refresh Password), so I think is the browser that matches the hubitat URL and password type field and it autocompletes.
I don't know how to solve it on app side, I can set password as normal input type but then it will be visible.

Gave it a try and it seems to be working:

Well done!!!!

The only glitch I have seems to getting pm2 to start using root instead of my user name. I'm on a Mac and I used sudo to install pm2. I'm sure it's a config item that I need to sort out. Here's to waiting the six days.

1 Like

Thank you for your efforts! I can run Node.js on my NAS and have access to several versions of Node: 4, 6, and 8. Does your solution require a certain version?

I've developed it with version 10 (latest stable), so I would say 8 will be better?

1 Like

I underestimated the complexity of this. I figured out how to automate a test routine I created that had a single action and all looked well. Being able to trigger routines with more than one action becomes difficult. Is one of those things where I can see what I want to do, however for the life of me google does not produce examples I need to make the code work.

I know it is possible I can see all the pieces there dangling in front of me. i peaked at the code for echo speaks and can sort of see how it is done there enough to know it is beyond me though.

Working nicely. Got a change to play with it. It works and was relatively easy to get going. I have the node server running on a windows box.

Have you been able to setup pm2 too? If I remember correctly it wasn't available for Windows.
In case I can update documentation

I was able to sort out my pm2 issue. It turns out that I had originally installed pm2 as my user and then reinstalled it using sudo. Pm2 was already running under my user. I stopped it and restarted it with sudo and everything is working great.

2 Likes

Thanks for pointing me to my error here :wink: Now working :+1:

I hear ya... I still need to find a useful way to allow the routine control. It's very easy to implement. Just need to work out the user interface part of it still :frowning:

2 Likes

I have a windows vm sitting in my basement that I run a bunch of node (and other) scripts on. I have them all start up with the system using a program called startup delayer. I also set up a batch file so if it quits with an error it will automatically restart. This seems to be working well. I set it up to refresh ever day just to test and its working.

Successfully running on a Raspberry PI. Had to update NodeJS to the newest version (from the official Node repository). Also, I had to pick a port higher than 1024. Other than that, worked flawlessly.

Thanks for the effort!

2 Likes

Well guys I just had a very promising test with some code that I combined this project with some of the logic from echospeaks.

Was able to set volume on all my devices and broadcast a tts to them. I am highly encouraged. If things continue to go well I think nearly all functionality available in echo speaks may work here...

3 Likes

Would this include fixing the cookie issue or would we still us a node.js service?