GPT-Powered Messaging

This blueprint outlines an automation for Home Assistant that utilizes GPT (Generative Pretrained Transformer) to generate custom messages based on specific triggers, such as the completion of a washing machine cycle. Before implementing this automation, ensure that you have set up a conversation agent and integrated GPT within your Home Assistant environment. The automation uses the conversation processing service to generate a response, which is then communicated via a text-to-speech service to a specified media player.

alias: test GPT speak
description: ""
trigger: []
condition: []
action:
  - variables:
      testVarReponse: basic reponse mannuel
      testVarQuestion: test
  - service: conversation.process
    metadata: {}
    data:
      agent_id: xxxxxxxxxxxxxxxxxxxxxxxx
      text: >-
        build a sentence to tell that the washing machine is over.
    response_variable: testVarReponse
  - service: tts.cloud_say
    data:
      cache: false
      entity_id: media_player.bureau_de_loic
      message: "{{ testVarReponse.response.speech.plain.speech }}"
mode: single

Key Components:

  1. Variables: testVarReponse holds the GPT-generated response, and testVarQuestion is a placeholder for the question or trigger phrase.

  2. Conversation Process Service: This service sends a request to GPT with the provided agent_id and text. The text should be the trigger event’s description (e.g., dishwasher cycle completion).

  3. Text-to-Speech (TTS) Service: The generated response is then spoken out through the specified media player. Here google device but you can use whatever you need.

Customizing Triggers:

To use this blueprint effectively, define specific triggers in the trigger section. For instance, you could set a trigger for when your washing machine’s smart plug reports a power drop, indicating the cycle’s completion.
As well your prompt need to be updated depending on your trigger.

Prerequisites:

  • Ensure that a conversation agent is set up in your Home Assistant.
  • Integrate GPT with your Home Assistant for processing the conversation requests.
  • Configure the text-to-speech service in your environment.
1 Like

That’s really nice blueprint! Can you make it so that it’s easy to add also with the add blueprint button?

That isn’t a blueprint, or even an automation as it has trigger listed but no trigger…

1 Like

I got this error… Some encoding issue with the file?

I didn’t look at it, just genned a link for you.
However that is not at all a blueprint. It isn’t even a complete automation as it has no trigger…
I’ll move it out of the exchange and kill the link I added…