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 # 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 **No Python required** - Works directly in SSH add-on!
Home Assistant 2026.6 will remove support for legacy template syntax. This script automatically migrates all your templates to the modern format.
## 🚀 Quick Start ## 🚀 Quick Start
```bash ```bash
cd /config cd /config
wget https://gitea.hideawaygaming.com.au/jessikitty/ha-template-migration/raw/branch/main/migrate_templates.py wget https://gitea.hideawaygaming.com.au/jessikitty/ha-template-migration/raw/branch/main/migrate_templates.sh
python3 migrate_templates.py chmod +x migrate_templates.sh
bash migrate_templates.sh
``` ```
Then: Then:
@@ -20,37 +19,59 @@ ha core check # Verify configuration
ha core restart # Apply changes 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 ## 📊 What It Does
Scans all YAML files for legacy templates Pure Bash - no Python dependencies
✅ Scans all YAML files
✅ Creates timestamped backups ✅ Creates timestamped backups
✅ Converts to modern `template:` syntax ✅ Converts to modern syntax
Preserves all template features Updates configuration.yaml
✅ Updates `configuration.yaml`
✅ Generates restore script ✅ Generates restore script
## 🛡️ Safety Features ## 🛡️ Safety Features
- **Automatic Backups**: All files backed up before changes - **No Dependencies** - Works in SSH add-on without Python
- **Easy Restore**: One command to rollback if needed - **Automatic Backups** - All files backed up before changes
- **No Data Loss**: Preserves all template configurations - **Exit on Error** - Stops if any step fails
- **Validation**: Check config before restart - **Easy Restore** - One command rollback
- **No Data Loss** - Preserves all configurations
## 📝 Expected Output ## 📝 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: Found 67 legacy template entities:
- 15 sensor(s) - 15 sensor(s)
- 52 binary_sensor(s) - 52 binary_sensor(s)
Creating backups...
✓ Backed up: sensor.yaml
✓ Backed up: binary_sensor.yaml
✓ MIGRATION COMPLETE ✓ MIGRATION COMPLETE
Migrated: 67 template entities Migrated: 67 template entities
``` ```
@@ -62,10 +83,17 @@ bash /config/backups/template_migration_YYYYMMDD_HHMMSS/restore.sh
ha core restart 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 ## 🎯 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