A Lovelace custom card providing a unified chat interface for real-time provisioning, editing, and technical debugging of Home Assistant configurations, accessed directly within the Dashboard.
β οΈ Important: This card requires the xAI Conversation with the Grok Code Fast service configured in Home Assistant.
- π¬ Interactive Chat: Chat bubble style interface with conversation history
- πΎ Auto-save: Persistent chat history and code using localStorage
- β¨οΈ Send on Enter: Optional keyboard shortcut (configurable checkbox)
- π File Attachments: Upload and send files (text, JSON, etc.) with your prompts
- β»οΈ Code Iteration: Automatically sends current code for refinement and updates
- π€ Multi-User Support: Tracks user context for personalized service
- π Conversation Continuity: Maintains context across multiple user devices (Laptop, Tablet, etc..)
- π Theme Support: Follows Home Assistant theme colors
- π¨ Responsive Design: Adapts to any screen size
This card is specifically designed to work with the xAI Conversation integration's Grok Code Fast service:
β Install the xAI Conversation integration
Without the xAI Conversation integration, this card will not function.
- Home Assistant 2025.10 or newer
- Frontend with container queries support (2025.7+ recommended)
Manual
- Open HACS
- Go to "Frontend"
- Click the three dots menu β "Custom repositories"
- Add this repository URL:
https://github.com/pajeronda/grok-code-fast-card - Click "Install"
-
Download
grok-code-fast-card.jsfrom this repository -
Copy to
/config/www/ -
Add resource to Lovelace:
- Go to Settings β Dashboards β Resources
- Click + ADD RESOURCE
- Enter:
- URL:
/local/www/grok-code-fast-card.js - Type: JavaScript Module
- URL:
- Click CREATE
-
Refresh browser cache (Ctrl+Shift+R)
mode card:
fullscreen:
- Edit your dashboard
- Click + ADD CARD
- Search for "Grok Code Fast Card"
- Click SAVE
Or add manually in YAML mode:
type: custom:grok-code-fast-card
theme: <your theme>Example with panel mode:
- type: panel
path: code
title: GROK CODE FAST
cards:
- type: custom:grok-code-fast-card
theme: <your theme>Example with Browser mod:
action: fire-dom-event
browser_mod:
service: browser_mod.popup
data:
initial_style: normal
style_sequence:
- normal
- fullscreen
- wide
title: '(tap π here)'
content:
type: custom:grok-code-fast-card
theme: <your theme>The card works without configuration.
Upload files to provide context for Grok:
- π Attach Button: Click paperclip icon to select files
- πΌοΈ Supported Types: Images (PNG, JPG, GIF), text files, JSON, YAML, code files
- ποΈ Preview: Attached files shown as badges with filename and size
- β Remove: Click X on badge to remove attachment before sending
- π€ Auto-clear: Attachments cleared after successful send
- πΎ Storage: File metadata saved in chat history
Enable the checkbox in the footer to send messages with Enter key:
- β Enter: Send message (when checkbox enabled)
- β Shift+Enter: Always adds new line (regardless of checkbox)
- β Unchecked: Enter adds new line normally
- π¬ Bubble-style chat interface
- π€ User messages align right (blue background)
- π€ Grok responses align left (card background)
- π All text is selectable and copyable
- π File attachments shown as badges in user messages
- πΎ Auto-saves to localStorage
- β¨ Syntax highlighting for Jinja2/YAML
- π’ Line numbers enabled
- π Auto-height on desktop, fixed on mobile
- π One-click copy button
- π¨ Follows Home Assistant theme
- β»οΈ Code Iteration: Current code automatically sent with each request for refinement
- π Context Preservation: Each response includes a unique ID
- π§ Memory: Previous response ID sent with next request
- π¬ Natural Flow: Grok remembers conversation context
- π€ User Tracking: Maintains separate conversations per user
Try these with the Grok Code Fast service:
Basic prompts:
- "Create an automation to turn on lights when motion is detected"
- "Fix this template:
{{ states('sensor.temp') * 2 }}" - "Make a template sensor for average temperature from 3 sensors"
- "Help me create a script to announce weather via TTS"
- "Generate a Lovelace card config for displaying energy usage"
- "Create a binary sensor that checks if it's nighttime"
With file attachments:
- Upload screenshot: "Explain what this error means and how to fix it"
- Attach JSON file: "Parse this API response and create sensors for each value"
- Send image: "Create an automation based on this state machine diagram"
- Upload config file: "Review this automation and suggest improvements"
Code iteration:
- First: "Create a motion light automation"
- Then: "Add a condition to only work at night"
- Then: "Also add a delay before turning off"
- (Card automatically sends current code for context)
- β Check resource is loaded: Settings β Dashboards β Resources
- β
Verify file exists at
/config/www/community/grok-code-fast-card/grok-code-fast-card.js - β Clear browser cache (Ctrl+Shift+R or Cmd+Shift+R)
- β Check browser console (F12) for errors
- β Most Common: xAI Conversation integration not installed
- β Verify integration: Settings β Devices & Services β look for "xAI Conversation"
- β Check service exists: Developer Tools β Services β search "grok_code_fast"
- β Check Home Assistant logs for integration errors
- β Ensure browser localStorage is enabled
- β Check no browser extensions are blocking storage
- β Private/Incognito mode may block localStorage
- β Check browser console for storage errors
- β Check file size (large files may cause issues)
- β Verify file type is supported (images, text, JSON, YAML, etc.)
- β Check browser console for file reading errors
- β Ensure browser supports FileReader API
- β Verify xAI Conversation integration supports conversation memory
- β Check browser console for service call logs
- β Clear localStorage and restart conversation if corrupted
- β Ensure Home Assistant 2025.1+
- β Update to latest Home Assistant version
- β Test in different browser (Chrome/Firefox/Safari)
- β Check if browser supports CSS container queries
Contributions welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details
Pajeronda
- GitHub: @pajeronda
- Repository: grok-code-fast-card
- Repository: xai conversation
If you find this card useful:
- β Star the repository
- π Report bugs via Issues
- π‘ Suggest features via Discussions
- π’ Share with the Home Assistant community
- xAI Conversation Integration - Required integration that provides the Grok Code Fast service
- Home Assistant - Open source home automation platform
- API Usage: This integration requires an active xAI account and a valid API key. Use of the xAI API is subject to xAI's terms of service.
- Trademarks: xAI, Grok, and related logos are registered trademarks of xAI Corp. This project is an unofficial integration developed by @pajeronda and is not affiliated with, sponsored by, or endorsed by xAI Corp.
Made with β€οΈ by Pajeronda β’ v1.0.2 β’ Updated 2025-11-19