Commit d5796e5
fix: parse last_activity_date as datetime for HA timestamp sensor
SensorDeviceClass.TIMESTAMP requires a datetime object, not a string.
The value_fn was returning the raw ISO string from start_utc, causing
a ValueError on entity registration.
- Add _last_activity_datetime() helper using dt_util.parse_datetime
- Returns None for missing or unparseable dates (graceful degradation)
- Add tests for None start_utc and unparseable date strings
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 2c23f2d commit d5796e5
2 files changed
+29
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
58 | 68 | | |
59 | 69 | | |
60 | 70 | | |
| |||
245 | 255 | | |
246 | 256 | | |
247 | 257 | | |
248 | | - | |
| 258 | + | |
249 | 259 | | |
250 | 260 | | |
251 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
649 | 651 | | |
650 | 652 | | |
651 | 653 | | |
652 | | - | |
| 654 | + | |
| 655 | + | |
653 | 656 | | |
654 | 657 | | |
655 | 658 | | |
| |||
658 | 661 | | |
659 | 662 | | |
660 | 663 | | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
661 | 678 | | |
662 | 679 | | |
663 | 680 | | |
| |||
0 commit comments