@@ -242,11 +242,11 @@ async def run(self) -> None:
242242 return
243243
244244 results = await asyncio .gather (* (patch .apply () for patch in self ._patches ))
245- updates = results .count (True )
245+ updates = [
246+ patch .config for index , patch in enumerate (self ._patches ) if results [index ]
247+ ]
246248 if updates :
247- LOGGER .warning (
248- f"{ updates } core file { 's were' if updates > 1 else 'was' } patched."
249- )
249+ self ._applied (updates )
250250 if self ._config [CONF_RESTART ]:
251251 LOGGER .warning ("Restarting HA core." )
252252 await self ._hass .services .async_call (
@@ -268,9 +268,28 @@ def _repair(self, files: list[PatchType]) -> None:
268268 "patch_file_base_mismatch_" + str (int (dt_util .now ().timestamp ())),
269269 is_fixable = False ,
270270 learn_more_url = "https://github.com/amitfin/patch#configuration" ,
271- severity = ir .IssueSeverity .WARNING ,
271+ severity = ir .IssueSeverity .ERROR ,
272272 translation_key = "base_mismatch" ,
273273 translation_placeholders = {
274274 "files" : message ,
275275 },
276276 )
277+
278+ def _applied (self , files : list [PatchType ]) -> None :
279+ """Report the system was patched."""
280+ count = len (files )
281+ LOGGER .warning (f"{ count } core file { 's were' if count > 1 else 'was' } patched." )
282+
283+ ir .async_create_issue (
284+ self ._hass ,
285+ DOMAIN ,
286+ "system_was_patched" ,
287+ is_fixable = False ,
288+ is_persistent = True ,
289+ learn_more_url = "https://github.com/amitfin/patch#configuration" ,
290+ severity = ir .IssueSeverity .WARNING ,
291+ translation_key = "system_update" ,
292+ translation_placeholders = {
293+ "files" : ", " .join (f'"{ file [CONF_DESTINATION ]} "' for file in files ),
294+ },
295+ )
0 commit comments