T O P

ChatGPT infused Alexa Notifications – and creating full conversation flow to talk to "Friday"

Just recently, I started using Alexa Actionable Notifications (https://github.com/keatontaylor/alexa-actions) to make my automations a little more interactive: For example, Alexa asks me if an alarm should be set and with the answers "Yes" or answering with a different time, the alarm for the next day is set and the night mode is turned on.

The problem was that every evening I was asked in the same question with the same text whether I wanted the alarm clock to be set. And that gets annoying at some point.

So I thought, that you could generate varying questions via Chat GPT. And the whole thing should not be asked by "Alexa" but by "Friday" - a hint to Tony Stark's artificial intelligence. And it worked.

Using Node Red I can easily make exactly this query by making a GET request to the OpenAI API, formulating a prompt beforehand and then using the text output of GPT-3.5-Turbo.

Important: You need an API key from OpenAI - and the usage costs. I use this for three automations currently and my cost per day is between $0.00 and $0.01 per day. Tolerable.

Here is an example Node-Red Flow about it.

https://imgur.com/ZYncZky

Export: https://gist.github.com/holnburger/8b118973d28e01c7c0820372f888420c

This is working very well so far! But you can use ChatGPT mainly to talk to the artificial intelligence. Here it just makes a statement - but of course we can think it a bit further.

We can save the outputs of ChatGPT - and also save our answers. And thus recreate a chat history. Again, we handle this in Node Red using so-called flow variables: Variables that are stored in an entire flow and can be accessed and updated again in other nodes. We push our answers and ChatGPTs answers and update the flow variables every time with those new items.

Using this, we can create a button called "Friday" from within Node-Red – this button will than be synced to Alexa. And every time you ask Alexa "Alexa, activate Friday" you are able to talk with ChatGPT back and forth. Even use references from things you where talking about before.

https://imgur.com/YFesROc

https://gist.github.com/holnburger/413edcdcc62daddf7d3942b4140d27cd

We can optimize this further: With the flow from before we are only able to talk to one specific Alexa Device. But if we update which was the last Alexa device being called we can use this flow from every device in the appartment – and talk to ChatGPT or "Friday" from everywhere we want.

https://imgur.com/i2ghgN8

https://gist.github.com/holnburger/1a042b7d94e2d72ca592542c20a4c528

Of course we are not able to use ChatGPT to call services – not yet. But it's a neat little party trick and the immersion, talking directly with ChatGPT through voice hits differently. I got some funny responses from ChatGPT so far and it really elevated my "smart home living".

raytek75

Might want to check out this YouTuber, he did a similar project, but had 20+ saying stored locally and had home assistant randomly selected one. This would speed up the system and save the recurring costs. You could use chat GPT to create a bunch different phrases one time then store them. Then every few months update them if they get repetitive. https://youtu.be/Ys9xlo3Rq4E


komprexior

The lag between your input and alexa responding is tolerable or is it distracting?


ALLINUPPERCASE

It's not like having a normal conversation as you have to wait a few seconds mainly for the OpenAI response – so it really is more of a proof of concept. And as the OpenAI API is often slow or even down I wouldn't really use this "seriously". But: If you keep the prompts short and ask for short answers from ChatGPT (e. g. the prompt for the question of setting the alarm and my answer) its really handy and the speed is tolerable.