github jsight/ha-pecron v0.3.4
v0.3.4: Enhanced Switch State Sync

latest releases: v0.5.0, v0.4.1, v0.4.0...
3 months ago

🔄 Enhanced Fix: v0.3.4 - Guaranteed Switch State Sync

Since optimistic updates alone didn't work, added scheduled polling to ensure UI syncs!

🛠️ What Changed

Multi-Layer Approach

When you toggle a switch, we now do 4 things to ensure the UI updates:

  1. Instant (0s): Optimistic UI update → Immediate feedback ⚡
  2. Immediate (0s): Trigger coordinator refresh → Try to sync now
  3. Delayed (5s): Scheduled refresh → Device has time to process 🕐
  4. Confirmation (15s): Final refresh → Catch slow responses ✅

Why This Works

  • Optimistic update: Instant visual feedback (even if it doesn't always trigger)
  • 5 second refresh: Gives device time to actually change state
  • 15 second refresh: Confirmation that state persisted
  • Catches edge cases: Slow device responses, API delays, UI glitches

📊 Timeline Example

0s:  You toggle AC Output ON
     → UI shows ON (optimistic)
     → Request refresh (immediate)
     
5s:  → Scheduled refresh polls device
     → Device confirms: AC is ON
     → UI confirms: ON ✓
     
15s: → Final refresh (confirmation)
     → State: ON ✓

📦 Upgrade

This should definitely fix the UI sync issue!

  1. Update to v0.3.4 via HACS
  2. Reload integration
  3. Toggle switches → UI should update within 5 seconds max

Full Changelog: https://github.com/jsight/ha-pecron/blob/main/CHANGELOG.md

Try it out! The UI should sync reliably now. 🎯

Don't miss a new ha-pecron release

NewReleases is sending notifications on new releases.