5171723a05a905d74ec330ba2f6e7baee789aad1
Safe and reliable bash-only implementation: - Works in SSH add-on without Python - Uses awk for YAML parsing (reliable and fast) - Automatic timestamped backups - Extracts legacy template definitions - Converts to modern template: syntax - Removes legacy platform: template blocks - Adds modern templates to configuration.yaml - Generates restore script for rollback - Exit on error for safety (set -e) - Temp directory cleanup with trap Fixes all 67 template deprecation warnings without Python dependencies.
Home Assistant Legacy Template Migration
Automated script to fix all 67 template deprecation warnings by migrating from legacy platform: template syntax to modern template: syntax.
⚠️ What This Fixes
Home Assistant 2026.6 will remove support for legacy template syntax. This script automatically migrates all your templates to the modern format.
🚀 Quick Start
cd /config
wget https://gitea.hideawaygaming.com.au/jessikitty/ha-template-migration/raw/branch/main/migrate_templates.py
python3 migrate_templates.py
Then:
ha core check # Verify configuration
ha core restart # Apply changes
📊 What It Does
✅ Scans all YAML files for legacy templates
✅ Creates timestamped backups
✅ Converts to modern template: syntax
✅ Preserves all template features
✅ Updates configuration.yaml
✅ Generates restore script
🛡️ Safety Features
- Automatic Backups: All files backed up before changes
- Easy Restore: One command to rollback if needed
- No Data Loss: Preserves all template configurations
- Validation: Check config before restart
📝 Expected Output
======================================================================
Home Assistant Legacy Template Migration
======================================================================
ℹ Found 67 legacy template entities:
- 15 sensor(s)
- 52 binary_sensor(s)
ℹ Creating backups...
✓ Backed up: sensor.yaml
✓ Backed up: binary_sensor.yaml
✓ MIGRATION COMPLETE
Migrated: 67 template entities
🔄 Restore if Needed
bash /config/backups/template_migration_YYYYMMDD_HHMMSS/restore.sh
ha core restart
📚 Full Documentation
See detailed examples, troubleshooting, and conversion patterns in the full documentation.
🎯 Result
After running, all 67 repair warnings will be cleared! ✅
Description
Automated migration script for Home Assistant legacy template syntax to modern template: syntax. Fixes all 67 template deprecation warnings.
Languages
Shell
53.2%
Python
46.8%