Viewing a single comment thread. View all comments

nightofgrim t1_jdehy1h wrote

I crafted a prompt to get ChatGPT to act as a home automation assistant. I told it what devices we have in the house and their states. I told it how to end any statement with one or more specially formatted commands to manipulate the accessories in the house.

It was just a fun POC, but it immediately became clear how much better this could be over Alexa or Siri.

I was able to ask it to do several things at once. Or be vague about what I wanted. It got it.

46

iamspro t1_jdeq8jw wrote

Awesome I did the same, plus a step to send those commands to the home assistant API. Then with Shortcuts I added a way to send the arbitrary sentence from Siri to this server. Still a bit awkward though because you have to say something like "hey siri tell gpt to turn off the kitchen light"

9

nightofgrim t1_jdevw3a wrote

I didn’t hook up voice because of that awkward part. If I could get my hands on a raspberry pi I might make my own listening device.

6

RedditLovingSun t1_jdemr0b wrote

That's awesome I've been thinking of trying something similar with a raspberry pi with various inputs and outputs but am having trouble thinking of practical functions it could provide. Question, how did you hook the model to the smart home devices, did program your own apis that chatgpt could use?

3

nightofgrim t1_jdewhmx wrote

I'm at work so I don't have the prompt handy, but I instructed chat GPT to output commands in the following format:

[deviceName:state]

So chatGPT might reply with:

> I turned on your bedroom light [bedroom light:on] and turned up the temperature [thermostat:72]

All you have to do is parse the messages for [:] and trigger the thing.

EDIT:

I told it to place all commands at the end, but it insists on inlining them. Easy enough to deal with.

7

---AI--- t1_jdey54g wrote

GPT is really good at outputting json. Just tell it you want the output in json, and give an example.

So far in my testing, it's got a success rate of 100%, although I'm sure it may fail occasionally.

9

nightofgrim t1_jdf00h9 wrote

If it fails, reply that it screwed up and needs to fix it. I bet that would work.

5

iJfbQd t1_jdf9cqi wrote

I've just been parsing the json output using a json5 parser (ie in Python, import json5 as json). In my experience, this catches all of the occasional json output syntax errors (like putting a comma after the terminal element).

2

Smallpaul t1_jdejh9x wrote

>I crafted a promoted to get ChatGPT

?

1

nightofgrim t1_jdew090 wrote

Prompt. Thanks. Damn auto correct needs ChatGPT level intelligence.

5