Update README for bash script version

This commit is contained in:
2025-12-23 12:31:13 +11:00
parent 5171723a05
commit e486f0efc9

View File

@@ -1,17 +1,16 @@
# 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.
**Pure Bash 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.
**No Python required** - Works directly in SSH add-on!
## 🚀 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
wget https://gitea.hideawaygaming.com.au/jessikitty/ha-template-migration/raw/branch/main/migrate_templates.sh
chmod +x migrate_templates.sh
bash migrate_templates.sh
```
Then:
@@ -20,37 +19,59 @@ ha core check # Verify configuration
ha core restart # Apply changes
```
## ⚠️ What This Fixes
Home Assistant 2026.6 will remove support for legacy template syntax.
**Before (deprecated):**
```yaml
binary_sensor:
- platform: template
sensors:
router_authenticated:
friendly_name: "Router Authenticated"
value_template: "{{ states('input_text.router_token') != '' }}"
```
**After (modern):**
```yaml
template:
- binary_sensor:
- name: "Router Authenticated"
state: "{{ states('input_text.router_token') != '' }}"
unique_id: router_authenticated
```
## 📊 What It Does
Scans all YAML files for legacy templates
Pure Bash - no Python dependencies
✅ Scans all YAML files
✅ Creates timestamped backups
✅ Converts to modern `template:` syntax
Preserves all template features
✅ Updates `configuration.yaml`
✅ Converts to modern syntax
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
- **No Dependencies** - Works in SSH add-on without Python
- **Automatic Backups** - All files backed up before changes
- **Exit on Error** - Stops if any step fails
- **Easy Restore** - One command rollback
- **No Data Loss** - Preserves all configurations
## 📝 Expected Output
```
======================================================================
Home Assistant Legacy Template Migration
Home Assistant Legacy Template Migration (Bash)
======================================================================
✓ Created backup: /config/backups/template_migration_20251223_123456
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
```
@@ -62,10 +83,17 @@ 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! ✅
After running, all **67 repair warnings will be cleared!**
## 💡 Why Bash?
✅ Works in SSH add-on without installing packages
✅ Faster execution
✅ No dependency issues
✅ Native YAML parsing with awk
---
**Repository:** https://gitea.hideawaygaming.com.au/jessikitty/ha-template-migration