72 lines
1.9 KiB
Markdown
72 lines
1.9 KiB
Markdown
# 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
|
||
|
||
```bash
|
||
cd /config
|
||
wget https://gitea.hideawaygaming.com.au/jessikitty/ha-template-migration/raw/branch/main/migrate_templates.py
|
||
python3 migrate_templates.py
|
||
```
|
||
|
||
Then:
|
||
```bash
|
||
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
|
||
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](https://gitea.hideawaygaming.com.au/jessikitty/ha-template-migration).
|
||
|
||
## 🎯 Result
|
||
|
||
After running, all 67 repair warnings will be cleared! ✅
|