From e486f0efc939c4ac035fac53827531a921778256 Mon Sep 17 00:00:00 2001 From: jessikitty Date: Tue, 23 Dec 2025 12:31:13 +1100 Subject: [PATCH] Update README for bash script version --- README.md | 76 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 7848bb5..0e11225 100644 --- a/README.md +++ b/README.md @@ -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