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")
|
subject = payload.get("Subject")
|
||||||
state_value = payload.get("NewStateValue", "unknown")
|
state_value = payload.get("NewStateValue", "unknown")
|
||||||
|
|
||||||
plain = f"{subject}\n{description}"
|
|
||||||
if state_value == "ALARM":
|
if state_value == "ALARM":
|
||||||
color = COLOR_ALARM
|
color = COLOR_ALARM
|
||||||
elif state_value == "OK":
|
elif state_value == "OK":
|
||||||
color = COLOR_OK
|
color = COLOR_OK
|
||||||
else:
|
else:
|
||||||
color = COLOR_UNKNOWN
|
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
|
return plain, formatted
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue