Lovelace Card¶
A custom card for viewing and interacting with OpenCode sessions.
Installation¶
Add Resource¶
Via UI:
- Go to Settings > Dashboards
- Click the three dots menu > Resources
- Click "Add Resource"
- URL:
/local/opencode-card.js - Type: JavaScript Module
Via YAML:
Basic Usage¶
Add to your dashboard:
Configuration Options¶
| Option | Type | Default | Description |
|---|---|---|---|
title |
string | "OpenCode Sessions" | Card title |
device |
string | - | Device ID to pin to |
working_refresh_interval |
number | 10 | Refresh interval (seconds) when working |
Examples¶
Basic Card¶
Shows all sessions with list view:
Pinned Device¶
Shows detail view for a specific session:
Custom Refresh¶
Faster updates when AI is working:
Card Views¶
List View¶
Shows all active sessions with:
- Session title
- State indicator (idle/working/permission/error)
- Model name
- Token counts
- Cost
Click a session to see details.
Detail View¶
Shows single session with:
- Full session information
- Chat history
- Permission approval buttons (when pending)
- Prompt input field
Permission Handling¶
When a permission is pending:
- Card shows permission details (type, title, pattern)
- Approve/Reject buttons appear
- Click to respond
Chat History¶
The detail view can load session history:
- Click "Load History" or "Refresh"
- Messages show user prompts and AI responses
- Tool calls are displayed with names and results
Troubleshooting¶
Card not appearing¶
- Check that the resource URL is correct
- Verify the file exists in
config/www/ - Clear browser cache and reload
- Check browser console for errors
History not loading¶
- Ensure the session is connected
- Check HA logs for errors
- Try refreshing the page