๐ง Feature Release: v0.3.2 - Smart Time Sensors
Time sensors are now intelligent! They show N/A when values don't make sense for the current device state.
โจ New Features
Smart Time Sensor Logic
Time to Full and Time to Empty sensors now adapt based on what your device is doing:
| Device State | Time to Full | Time to Empty |
|---|---|---|
| ๐ CHARGING (plugged in, no load) | โ Shows time | โ N/A |
| ๐ DISCHARGING (on battery, load active) | โ N/A | โ Shows time |
| โก UPS MODE (plugged in + load) | โ Shows time | โ Shows runtime* |
| ๐ค IDLE (no power flow) | โ N/A | โ N/A |
* In UPS mode, "Time to Empty" shows how long the battery would last if input power disconnected
Always Visible
- Both time sensors always appear (no more disappearing based on TSL)
- Show "Unavailable" only when truly N/A for current state
- Zero values (0 minutes) indicate battery full/empty, not errors
Robust Edge Case Handling
โ
Missing property values โ N/A
โ
Negative power (measurement errors) โ Treated as 0
โ
None/missing power values โ Treated as 0
โ
Small power values (1W) โ Still trigger state logic
๐งช Quality Assurance
- 18 new comprehensive unit tests covering all scenarios
- Device states: idle, charging, discharging, UPS mode
- Edge cases: missing properties, zero/negative/None values
- All 43 tests passing (25 original + 18 new)
๐ฆ Upgrade
Via HACS:
- Update to v0.3.2
- Reload integration (Settings โ Devices & Services โ Pecron โ Reload)
Via Manual:
- Download and extract
- Copy to
custom_components/pecron - Restart Home Assistant
Full Changelog: https://github.com/jsight/ha-pecron/blob/main/CHANGELOG.md
Enjoy smarter time sensors! ๐