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:
-
Variables:
testVarReponse
holds the GPT-generated response, andtestVarQuestion
is a placeholder for the question or trigger phrase. -
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). -
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.