Be explicit that an alarm was resolved
This commit is contained in:
parent
08f5b49b16
commit
cbc4b16f8f
1 changed files with 10 additions and 4 deletions
|
|
@ -34,16 +34,22 @@ def handle_json_notification(payload: Any, body: Any) -> Tuple[str, str]:
|
|||
subject = payload.get("Subject")
|
||||
state_value = payload.get("NewStateValue", "unknown")
|
||||
|
||||
plain = f"{subject}\n{description}"
|
||||
if state_value == "ALARM":
|
||||
color = COLOR_ALARM
|
||||
elif state_value == "OK":
|
||||
color = COLOR_OK
|
||||
else:
|
||||
color = COLOR_UNKNOWN
|
||||
formatted = (
|
||||
f"<strong><font color={color}>{subject}</font></strong>\n<p>{description}</p>"
|
||||
)
|
||||
|
||||
plain = f"{subject}"
|
||||
formatted = f"<strong><font color={color}>{subject}</font></strong>\n"
|
||||
|
||||
if state_value == "OK":
|
||||
plain += "\n(this alarm has been resolved!)"
|
||||
formatted += "\n<p>(this alarm has been resolved!)</p>"
|
||||
else:
|
||||
plain += "\n{description}"
|
||||
formatted += f"\n<p>{description}</p>"
|
||||
return plain, formatted
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue