alarms: targets need to be str

This commit is contained in:
Iain Learmonth 2022-06-17 13:20:07 +01:00
parent 1b8a64725f
commit 5f7733d064

View file

@ -38,7 +38,7 @@ class Alarm(db.Model): # type: ignore
self.state_changed = datetime.utcnow()
activity = Activity(activity_type="alarm_state",
text=f"{self.alarm_state.name}->{state.name}! State changed for "
f"{self.aspect} on {self.target}: {text}")
f"{self.aspect} on {str(self.target)}: {text}")
if (self.alarm_state.name in ["WARNING", "CRITICAL"]
or state.name in ["WARNING", "CRITICAL", "UNKNOWN"]):
# Notifications are only sent on recovery from warning/critical state or on entry