Skip to content

Commit 6af321e

Browse files
authored
Fix notify open file mode
1 parent 68181d5 commit 6af321e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

custom_components/file_plusplus/notify.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def send_message(self, message: str, title: str | None = None) -> None:
4949
file: TextIO
5050
filepath = self._file_path
5151
try:
52-
with open(filepath, "a", encoding="utf8") as file:
52+
# File++ - Mode to 'w'
53+
with open(filepath, "w", encoding="utf8") as file:
5354
# File++ - Delete header
5455
if self._add_timestamp:
5556
text = f"{dt_util.utcnow().isoformat()} {message}\n"
@@ -61,4 +62,4 @@ def send_message(self, message: str, title: str | None = None) -> None:
6162
translation_domain=DOMAIN,
6263
translation_key="write_access_failed",
6364
translation_placeholders={"filename": filepath, "exc": f"{exc!r}"},
64-
) from exc
65+
) from exc

0 commit comments

Comments
 (0)