Skip to content

fix: use dot instead of colon for microsecond separator of last_replaced in strftime (Python 3.14 compatibility)#4391

Merged
andrew-codechimp merged 1 commit intoandrew-codechimp:mainfrom
rtasarz:main
Feb 4, 2026
Merged

fix: use dot instead of colon for microsecond separator of last_replaced in strftime (Python 3.14 compatibility)#4391
andrew-codechimp merged 1 commit intoandrew-codechimp:mainfrom
rtasarz:main

Conversation

@rtasarz
Copy link
Contributor

@rtasarz rtasarz commented Feb 4, 2026

Python 3.14 datetime.fromisoformat() became stricter and no longer accepts microsecond part with colon (:%f).
Changed to dot separator (.%f) to restore compatibility.

Solves following exception, that prevents Battery Notes to initialize:

ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Battery Notes for battery_notes
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.14/site-packages/homeassistant/config_entries.py", line 762, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ha/.homeassistant/custom_components/battery_notes/init.py", line 176, in async_setup_entry
coordinator = BatteryNotesSubentryCoordinator(hass, config_entry, subentry)
File "/home/ha/.homeassistant/custom_components/battery_notes/coordinator.py", line 209, in init
self.last_replaced = datetime.fromisoformat(last_replaced)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
ValueError: Invalid isoformat string: '2026-01-26T17:34:28:192804'

@andrew-codechimp
Copy link
Owner

andrew-codechimp commented Feb 4, 2026

Thanks for pointing this out, would have taken me a while to track that one down.
Lint issue is my doing so all good :smiling

Just released 3.3.1 to beta with this fix in it.

@andrew-codechimp andrew-codechimp merged commit e6e97c5 into andrew-codechimp:main Feb 4, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants