A little bit of GPT

Hi all,

I thought I’d play around with the openAI GPTs platform. I created an automation in home assistant with a webhook trigger that sends a notification to my phone:

alias: GPT Test
description: ""
trigger:
  - platform: webhook
    allowed_methods:
      - POST
      - PUT
    local_only: false
    webhook_id: ***REMOVED***
condition: []
action:
  - service: notify.mobile_app_iphone
    data:
      message: message:{{trigger.json.message}}
mode: single

and exposed this in a custom GPT with the following action schema in its config (essentially giving it the ability to call an api, inferring what it does from the description):

{
  "openapi": "3.1.0",
  "info": {
    "title": "home assistant hooks",
    "description": "gives the ability to send things to homeassistant",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://hooks.nabu.casa/***REMOVED***"
    }
  ],
  "paths": {
    "/": {
      "post": {
        "description": "Sends a notification to home assistant",
        "operationId": "SendNotificaiton",
        "parameters": [
          {
            "name": "message",
            "in": "body",
            "description": "the message to be sent in the notification",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "deprecated": false
      }
    }
  },
  "components": {
    "schemas": {}
  }
}

and gave it some basic instructions:

then tested it out…

… simple, yes. but WOW

1 Like

Nice! Challenge accepted, this gave me an Idea to attempt this with Voice Assistant.
Here is my attempt at this without chat GPT.



I added this to my configuration.yaml intent_script: !include custom_intent_responses/en/responses.yaml # These are the responses for the conversations
I created a file called responses.yaml in the custom_intent_responses/en directory.
I created a file called send_message_intent.yaml in my custom_sentences/en directory.
I added this to the responses.yaml file.

  Send_Message_Intent:
    speech:
      text: >-
        {{ ["I have sent your message, " ,
            "I have sent your message to Home Assistant, " ,
            "Your message has been sent, ",
            "Your message has been sent to Home Assistant, ",
           ] | random }}
    action:
      service: notify.persistent_notification
      data:
        message: "{{my_message}}"

I added this to the send_message_intent.yaml file

language: "en"
intents:
  Send_Message_Intent:
    data:
      - sentences: # These are the sentences the system can expect to hear before acting on the intent
        - "[hey] [(would|could|can)] [you] send a message to [home] assistant saying [that] {my_message}"
lists:
  my_message:
    wildcard: true

restarted HA and there it is.
Thanks for the incentive!

1 Like