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 Feb 4, 2026
Conversation
Owner
|
Thanks for pointing this out, would have taken me a while to track that one down. Just released 3.3.1 to beta with this fix in it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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'