A comprehensive Lovelace card for monitoring Pylontech (SOK) BMS battery systems in Home Assistant. Designed to work with entites created by the Pylontech BMS Integration https://github.com/jtubb/HA-Pylontech-BMS but should work with any that follow similar naming convetions.
- System Overview - Total voltage, power, average cycles, and time to empty/full estimates
- Multi-Pack Monitoring - Display 1-16+ battery packs in a responsive grid layout
- Interactive Heatmaps - Click temperature or voltage labels to view cell-level heatmaps
- History Graphs - Click any metric to view historical data powered by mini-graph-card
- Real-time Updates - Live monitoring with visual SOC indicators and color coding
- Responsive Design - Optimized layouts for desktop, tablet, and mobile devices
- Pack Metrics - Voltage, current, power, delta V, and temperature for each pack
- Visual Alerts - Instant warnings for packs with alarms or faults
- Home Assistant 2024.1.0 or newer
- Pylontech BMS Integration installed and configured
- mini-graph-card (required for history graphs)
- Open HACS in Home Assistant
- Go to "Frontend"
- Click the three dots in the top right corner
- Select "Custom repositories"
- Add this repository URL:
https://github.com/jtubb/pylontech-battery-card - Select category: "Lovelace"
- Click "Add"
- Find "Pylontech Battery Card" in the list and click "Install"
- Install mini-graph-card from HACS
- Add the resource (see below - this is required!)
- Clear your browser cache (Ctrl+Shift+R or Cmd+Shift+R)
- Restart Home Assistant
This step is required or you'll get "Custom element doesn't exist" error!
Method 1: Via UI (Recommended)
- Go to Settings → Dashboards → Resources (three-dot menu in top right)
- Click "Add Resource"
- URL:
/hacsfiles/pylontech-battery-card/pylontech-battery-overview.js - Type: JavaScript Module
- Click "Create"
- Clear browser cache (Ctrl+Shift+R)
Method 2: Via configuration.yaml
lovelace:
resources:
- url: /hacsfiles/pylontech-battery-card/pylontech-battery-overview.js
type: module- Download
pylontech-battery-overview.jsfrom the latest release - Copy the file to
config/www/directory - Install mini-graph-card manually
- Add to your Lovelace resources:
- url: /local/pylontech-battery-overview.js type: module - url: /local/mini-graph-card-bundle.js type: module
- Restart Home Assistant
type: custom:pylontech-battery-overview
entity_prefix: sensor.sok_rack_1
start_index: 1
end_index: 5type: custom:pylontech-battery-overview
entity_prefix: sensor.sok_rack_1
start_index: 1
end_index: 5
title: Battery System Overview
show_system_overview: true
show_packs: true| Option | Type | Default | Description |
|---|---|---|---|
entity_prefix |
string | required | Entity prefix for your battery system (e.g., sensor.sok_rack_1) |
start_index |
number | 1 |
Starting pack number to display |
end_index |
number | required | Ending pack number to display |
title |
string | Battery System Overview |
Card title |
show_system_overview |
boolean | true |
Show system overview section with totals |
show_packs |
boolean | true |
Show individual pack cards |
The card expects entities to follow this naming pattern:
{entity_prefix}_pack_{N}_{metric}
Examples:
sensor.sok_rack_1_pack_1_pack_voltagesensor.sok_rack_1_pack_1_state_of_chargesensor.sok_rack_1_pack_1_temperature_cells_1_4sensor.sok_rack_1_pack_1_cell_0_voltage
type: custom:pylontech-battery-overview
entity_prefix: sensor.sok_rack_1
start_index: 1
end_index: 5
title: Main Battery Systemtype: custom:pylontech-battery-overview
entity_prefix: sensor.sok_rack_1
start_index: 1
end_index: 1
title: Battery Packtype: custom:pylontech-battery-overview
entity_prefix: sensor.sok_rack_1
start_index: 1
end_index: 5
title: System Statistics
show_system_overview: true
show_packs: falsetype: custom:pylontech-battery-overview
entity_prefix: sensor.sok_rack_1
start_index: 1
end_index: 16
title: Large Battery Systemtype: vertical-stack
cards:
- type: custom:pylontech-battery-overview
entity_prefix: sensor.sok_rack_1
start_index: 1
end_index: 5
title: Rack 1 - Main System
- type: custom:pylontech-battery-overview
entity_prefix: sensor.sok_rack_2
start_index: 1
end_index: 3
title: Rack 2 - Backup System- Temperature Heatmap: Click the "Temperature" label in any pack card to view cell temperature distribution
- Voltage Heatmap: Click the "Delta V" label to view cell voltage distribution
- Cell History: Click any individual cell in the heatmap to view its history graph
- Click any system metric (voltage, power, cycles, etc.) to view its history
- Click any pack metric to view that pack's history
- Zoom controls: 1h, 3h, 6h, 12h, 24h intervals
- Powered by mini-graph-card for smooth, interactive graphs
- Red (< 20%): Critical low battery
- Orange (20-50%): Low battery
- Normal (> 50%): Adequate charge
- Red border + warning icon: Pack has active alarms or faults
- Click the pack for detailed information
- Blue: Lower values (cooler temperature or lower voltage)
- Yellow/Orange: Medium values
- Red: Higher values (warmer temperature or higher voltage)
- Green checkmark: All systems normal
- Red warning icon: One or more packs have issues
This is the most common issue after HACS installation.
The JavaScript file hasn't been loaded as a resource.
Solution:
- Go to Settings → Dashboards → Resources (click three dots in top right)
- Verify resource is added:
/hacsfiles/pylontech-battery-card/pylontech-battery-overview.js - If missing, click "Add Resource" and add it (Type: JavaScript Module)
- Clear browser cache (Ctrl+Shift+R or Cmd+Shift+R)
- Refresh the page
Verify files exist:
ls /config/www/community/pylontech-battery-card/You should see pylontech-battery-overview.js. If missing, reinstall from HACS.
- Verify the Pylontech BMS integration is installed and working
- Check sensors exist in Developer Tools → States
- Verify mini-graph-card is installed from HACS
- Clear browser cache (Ctrl+Shift+R or Cmd+Shift+R)
- Check browser console for errors (F12 → Console tab)
- Verify the resource is loaded (see above)
- Check entity prefix is correct (e.g.,
sensor.sok_rack_1) - Verify entities exist in Developer Tools → States
- Check pack numbering matches your actual packs
- Ensure entities follow the naming pattern:
{prefix}_pack_{N}_{metric}
- Ensure mini-graph-card is installed from HACS
- Verify mini-graph-card is in Lovelace resources
- Check browser console for errors (F12)
- Verify entities have recorded history data in Home Assistant
- Verify cell entities exist (e.g.,
sensor.sok_rack_1_pack_1_cell_0_voltage) - Check entity naming follows the expected pattern
- Ensure entities have valid numeric values
- Check browser console for errors
- Reduce number of packs displayed (split into multiple cards)
- Disable heatmaps by not clicking labels
- Check Home Assistant system resources
- Verify network connection is stable
- Clone the repository
- Make changes to
pylontech-battery-overview.js - Copy to
config/www/for testing - Refresh browser cache to see changes
This card is written in vanilla JavaScript and doesn't require a build step. Simply edit the .js file directly.
Test on multiple screen sizes:
- Desktop (1920x1080)
- Tablet (768x1024)
- Mobile (375x667)
- Issues: GitHub Issues
- Integration: Pylontech BMS Integration
- mini-graph-card: GitHub
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test on multiple screen sizes
- Submit a pull request
MIT License - see LICENSE file for details
- Created for use with the Pylontech BMS Integration
- History graphs powered by mini-graph-card by @kalkih
- Simplified: Removed single-pack card, overview card now handles all use cases
- Improved documentation and troubleshooting guides
- Clearer HACS installation instructions
- Better example configurations
- Added Battery Overview Card for multi-pack system monitoring
- Integrated mini-graph-card for history visualization
- Added interactive temperature and voltage heatmaps
- Implemented responsive design for mobile and desktop
- Added system-level statistics (total power, cycles, time estimates)