Repository navigation
Commit 81fef2c
feat: Comprehensive diagnostic sensor with all decision variables (v0.9.13)
USER REQUEST: "Print inside all the controlled variables you use to make decision"
PROBLEM:
Diagnostic sensor only showed ERROR states, no visibility into:
- Why charger isn't starting
- What values automation is seeing
- Which conditions are blocking charging
- Current Priority Balancer state
- Configuration being used
THE SOLUTION:
Diagnostic sensor now updates on EVERY check with 45+ attributes showing complete automation state.
COMPREHENSIVE ATTRIBUTES:
1. Control Flags:
- forza_ricarica (ON/OFF)
- night_smart_charge_active (true/false)
- charging_profile (current profile name)
- charger_status (charger_free, charger_wait, etc.)
- charger_switch_state (ON/OFF)
2. Priority Balancer:
- priority (EV, HOME, EV_Free)
- priority_balancer_enabled (true/false)
- current_ev_soc (current EV battery %)
- target_ev_soc (target EV battery %)
- current_home_soc (current home battery %)
- target_home_soc (target home battery %)
- priority_reason (explanation text)
3. Sensor Values (with entity IDs):
- solar_production_w + entity
- home_consumption_w + entity
- grid_import_w + entity
- surplus_w (calculated)
- surplus_a (calculated, in amps)
4. Charging State:
- current_charging_a (0 if OFF, actual amps if ON)
- target_charging_a (what it should be based on surplus)
- charger_current_entity
5. Configuration:
- grid_import_threshold_w
- grid_import_delay_s
- surplus_drop_delay_s
- use_home_battery (true/false)
- home_battery_min_soc
- home_battery_current_soc
6. Decision Logic:
- grid_import_exceeds_threshold (true/false)
- surplus_sufficient_for_charging (true/false)
- decision_pending (status text)
SENSOR STATES:
State shows context at a glance:
- "SKIPPED: Forza Ricarica ON" - Override enabled
- "SKIPPED: Night Smart Charge Active" - Night mode active
- "SKIPPED: Wrong Profile" - Profile not solar_surplus
- "CHECKING: 6000W surplus (26.1A)" - Active evaluation
- "ERROR: Invalid sensor values" - Shows which sensors broken
EXAMPLE OUTPUT:
```yaml
state: "CHECKING: 6000W surplus (26.1A)"
attributes:
last_check: "2025-10-29T14:30:45.123456"
forza_ricarica: "OFF"
charging_profile: "solar_surplus"
charger_status: "charger_wait"
charger_switch_state: "OFF"
priority: "EV_Free"
priority_balancer_enabled: true
current_ev_soc: 70
target_ev_soc: 70
current_home_soc: 69
target_home_soc: 50
solar_production_w: 6000
home_consumption_w: 1500
grid_import_w: 0
surplus_w: 4500
surplus_a: 19.57
current_charging_a: 0
target_charging_a: 16
```
TECHNICAL IMPLEMENTATION:
Added diagnostic sensor updates at key decision points:
- Line 403: Forza Ricarica check
- Line 422: Night Smart Charge check
- Line 443: Profile check
- Line 704: Comprehensive state after sensor parsing (MAIN UPDATE)
Moved target_amps calculation earlier (line 702) to include in diagnostic.
Removed duplicate calculation at line 786.
IMPACT:
✅ User can see EXACTLY why charger isn't starting
✅ All sensor values visible without checking logs
✅ Priority Balancer decision logic transparent
✅ Configuration settings confirmed
✅ Real-time troubleshooting in Developer Tools → States
✅ Easy to share sensor state for support/debugging
✅ No more guessing what automation is seeing
USER EXPERIENCE:
Open Developer Tools → States → search "solar_surplus_diagnostic"
See complete state of automation with all variables in one place!
Files Changed:
- custom_components/ev_smart_charger/solar_surplus.py
- custom_components/ev_smart_charger/manifest.json (version 0.9.13)
- README.md (version + comprehensive changelog)
🎯 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 0c51d16 commit 81fef2c
3 files changed
Lines changed: 153 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
729 | 729 | | |
730 | 730 | | |
731 | 731 | | |
732 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
733 | 796 | | |
734 | 797 | | |
735 | 798 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
402 | 413 | | |
403 | 414 | | |
404 | 415 | | |
| |||
407 | 418 | | |
408 | 419 | | |
409 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
410 | 433 | | |
411 | 434 | | |
412 | 435 | | |
| |||
416 | 439 | | |
417 | 440 | | |
418 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
419 | 455 | | |
420 | 456 | | |
421 | 457 | | |
| |||
662 | 698 | | |
663 | 699 | | |
664 | 700 | | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
665 | 751 | | |
666 | 752 | | |
667 | 753 | | |
| |||
697 | 783 | | |
698 | 784 | | |
699 | 785 | | |
700 | | - | |
701 | | - | |
| 786 | + | |
702 | 787 | | |
703 | 788 | | |
704 | 789 | | |
| |||
0 commit comments