Skip to content
Snippets Groups Projects
Commit 24ec3998 authored by David Hammer's avatar David Hammer
Browse files

Mention which warning has been lifted

parent b6376318
No related branches found
No related tags found
1 merge request!23Check timeserver per train
...@@ -47,13 +47,16 @@ class ContextWarningLamp: ...@@ -47,13 +47,16 @@ class ContextWarningLamp:
if (warn_type not in self._active_warnings) or ( if (warn_type not in self._active_warnings) or (
not only_print_once and message != self._active_warnings[warn_type] not only_print_once and message != self._active_warnings[warn_type]
): ):
self._device.log_status_warn(message) self._device.log_status_warn(f"{warn_type.name}: {message}")
self._new_warnings.add(warn_type) self._new_warnings.add(warn_type)
self._active_warnings[warn_type] = message self._active_warnings[warn_type] = message
def update_state(self, on_success="NORMAL", on_error="ERROR"): def update_state(self, on_success="NORMAL", on_error="ERROR"):
for now_okay in self._new_tested - self._new_warnings: for warn_type_lifted in self._active_warnings.keys() & (
self._active_warnings.pop(now_okay, None) self._new_tested - self._new_warnings
):
del self._active_warnings[warn_type_lifted]
self._device.log_status_info(f"Lifted warning: {warn_type_lifted.name}")
current_state = self._device.unsafe_get(self._schema_key) current_state = self._device.unsafe_get(self._schema_key)
if self._active_warnings and current_state != on_error: if self._active_warnings and current_state != on_error:
self._device.set(self._schema_key, on_error) self._device.set(self._schema_key, on_error)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment