I’m a little late jumping on the OpenAI / ChatGPT bandwagon, but I decided to try out Allen Porter’s seemingly infamous blueprint. However, many of the OpenAI blog posts I found were a bit out of date. Below is how I set it up.

Get an OpenAI API Key

  1. First, create an OpenAI account or sign in. Next, navigate to the API key page and “Create new secret key”. Make sure to save this somewhere safe and do not share it with anyone.
  2. Fund your account from the Billing page.

That’s it. As of the time of writing, it seems that OpenAI no longer grants a buck of credit to get started (or at least mine expired), so I did have to fund my account with a minimum of $5 to get started in earnest. I did have some free credit, but it expired before I actually got around to setting this up.

Set up OpenAI in Home Assistant

Add the OpenAI Integration

  1. Add the OpenAI Integration and paste your API key from above.

You can stop here, but to avoid sending unnecessary data to OpenAI, I also did the following:

  1. Navigate to the OpenAI integration from the integrations dashboard.
  2. Click configure and cleared out the prompt template.

    Note: I was having issues with this, but found that I could just insert a simple space then save.

  3. You can also change the model that’s being used here; I left it on gpt-3.5-turbo. You can find a full list of models in the OpenAI Platform docs.

    I did try GPT-4 but found that it was about 5x more expensive (costing ~$0.04 per call), and I wanted to be frugal with 3.5, which is running me <$0.01 / day.

Add a voice assistant

  1. In Home Assistant, head to Settings > Voice Assistants or use this link.
  2. Click the Add Assistant button.
  3. Give it a name; for conversation agent, select the OpenAI integration you added above, tweak the other settings if you want, and click create.

Ensure you have data in Home Assistant

The Blueprint linked at the top of this post assumes you have a working weather integration, your calendar available, and a notify service that supports enough long messages. For me, this meant using:

Import the Blueprint

I started off by using Allen Porter’s blueprint, which you can import easily using this link and follow the prompts.

Reading through the comments on the Gist, I noticed this comment that addressed one of my big needs, which was to feed multiple calendars.

To make importing (for others) easier, I’ve gone ahead and hosted the version found in the comment as a Gist so that it can be easily imported.

Some “Gotchas”

  • I noticed that responses were getting truncated, and I read somewhere that I needed to increase the max “tokens” configured in the OpenAI integration.

Enhancements I’d like to add

  • My work calendar isn’t available to Home Assistant, so I’d like to add a hint (probably using the Workday integration) on whether it’s a workday so that can be worked into the response.
  • Adding some logic to handle traveling or sharing in the prompt if I’m home or not.

Updated: