GitHunt
LU

luizbafilho/groq-hass

Groq Conversation for Home Assistant

hacs_badge

Integration for Groq cloud API in Home Assistant, providing fast LLM inference with support for conversation agents and AI tasks.

Features

  • Conversation Agents: Create multiple conversation agents with different Groq models
  • AI Task Entities: Generate structured data using LLMs
  • Tool Calling: Full support for Home Assistant actions and device control
  • File Attachments: Support for images and PDF files in conversations
  • JSON Mode: Structured outputs for AI tasks
  • Fast Inference: Leverage Groq's lightning-fast LLM inference
  • Multiple Models: Support for Llama, Mixtral, and other Groq models

Supported Models

The integration supports all models available in Groq, including:

  • Llama 3 (8B, 70B)
  • Mixtral (8x7B)
  • Gemma
  • And more as they become available

Installation

  1. Open HACS in your Home Assistant instance
  2. Click on "Integrations"
  3. Click the three dots in the top right corner
  4. Select "Custom repositories"
  5. Add this repository URL: https://github.com/luizbafilho/groq-hass
  6. Select "Integration" as the category
  7. Click "Add"
  8. Search for "Groq Conversation" and install
  9. Restart Home Assistant

Manual Installation

  1. Download the latest release from this repository
  2. Copy the custom_components/groq_conversation directory to your Home Assistant's custom_components directory
  3. Restart Home Assistant

Configuration

Getting a Groq API Key

  1. Visit Groq Console
  2. Sign up or log in to your account
  3. Navigate to the API Keys section
  4. Create a new API key
  5. Copy the API key for use in Home Assistant

Adding the Integration

  1. Go to SettingsDevices & Services
  2. Click "+ Add Integration"
  3. Search for "Groq"
  4. Enter your Groq API key
  5. Click Submit

Creating Conversation Agents

After adding the integration:

  1. In the Groq integration card, click "Configure"
  2. Click "Add conversation agent"
  3. Select a model (e.g., llama3-8b-8192, mixtral-8x7b-32768)
  4. (Optional) Customize the system prompt
  5. (Optional) Select which Home Assistant APIs the agent can access
  6. Click Submit

The conversation agent will appear as a new entity that can be used with:

  • Voice assistants (Assist)
  • The conversation integration
  • Automation scripts

Creating AI Task Entities

For structured data generation:

  1. In the Groq integration card, click "Configure"
  2. Click "Add AI task"
  3. Select a model optimized for structured outputs
  4. Click Submit

Use AI task entities in automations or scripts to generate structured data.

Usage Examples

Voice Assistant

Once configured with Home Assistant APIs, you can use voice commands like:

  • "Turn on the living room lights"
  • "What's the temperature in the bedroom?"
  • "Set the thermostat to 72 degrees"

Automations

Use conversation agents in automations:

action:
  - service: conversation.process
    data:
      agent_id: conversation.llama_3_8b
      text: "Summarize today's events"

AI Tasks for Structured Data

Generate structured data in automations:

action:
  - service: ai_task.generate_data
    target:
      entity_id: ai_task.mixtral_8x7b
    data:
      task_name: "Extract Information"
      instructions: "Extract all mentioned locations from this text: {{ trigger.text }}"
      structure:
        locations:
          - name: string
            type: string

Features Detail

Tool Calling

The integration supports tool calling, allowing the LLM to:

  • Control devices (lights, switches, climate, etc.)
  • Query device states
  • Execute Home Assistant actions
  • Access calendar and todo lists
  • And more through the Home Assistant LLM API

File Attachments

Conversation agents support image and PDF attachments for vision tasks:

  • Describe images
  • Extract text from PDFs
  • Answer questions about visual content

JSON Mode

AI task entities use Groq's JSON mode for reliable structured output generation:

  • Extract entities from text
  • Generate formatted data
  • Create structured responses
  • Validate against schemas

Troubleshooting

Integration Not Found

Make sure you've:

  1. Copied the files to the correct custom_components directory
  2. Restarted Home Assistant
  3. Cleared your browser cache

API Errors

Check that:

  1. Your API key is valid and active in Groq Console
  2. You have available API credits
  3. The selected model is available in your region

Models Not Loading

If models don't appear in the dropdown:

  1. Check your internet connection
  2. Verify your API key has the correct permissions
  3. Check Home Assistant logs for error messages

Support

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This integration is licensed under the Apache License 2.0, the same license as Home Assistant.

Acknowledgments

  • Built for Home Assistant
  • Powered by Groq
  • Inspired by the OpenAI Conversation integration

Disclaimer

This is a custom integration and is not officially affiliated with or endorsed by Groq or Home Assistant.