Skip to content

Commit 512f6b9

Browse files
authored
Fix state sensor incorrect color (librenms#18089)
* Fix state sensor incorrect color * Fix state sensor incorrect color
1 parent db5c202 commit 512f6b9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/Models/StateTranslation.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ class StateTranslation extends Model implements Keyable
4545

4646
public function severity(): Severity
4747
{
48-
return Severity::tryFrom((int) $this->state_generic_value) ?? Severity::Unknown;
48+
return match ((int) $this->getAttribute('state_generic_value')) {
49+
0 => Severity::Ok,
50+
1 => Severity::Warning,
51+
2 => Severity::Error,
52+
default => Severity::Unknown,
53+
};
4954
}
5055

5156
/**

0 commit comments

Comments
 (0)