You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently in status.go, we have this bit of code, which parses the ALARMDEL value:
case keyAlarmDel:
// No alarm delay configured.
if v == "No alarm" {
break
}
s.AlarmDel, err = parse()
this accounts for the ALARMDEL having a value of "No alarm". Otherwise, it parses it as a time.Duration. However, this won't always work because there are two other possible non-duration values, per the apcupsd library's source (apcstatus.c):
case 'T':
s_write(ups, "ALARMDEL : 30 Seconds\n");
break;
case 'L':
s_write(ups, "ALARMDEL : Low Battery\n");
break;
case 'N':
s_write(ups, "ALARMDEL : No alarm\n");
break;
case '0':
s_write(ups, "ALARMDEL : 5 Seconds\n");
break;
default:
s_write(ups, "ALARMDEL : Always\n");
break;
}
So, the two that aren't handled currently are 'Always' and 'Low Battery', with 'Always' meaning that alarms should sound immediately and continuously upon power fail, and 'Low Battery' meaning that the alarm should sound only after power fails and battery becomes low. (source).
So I guess 'Always' could be converted to just a '0' duration, but 'Low Battery' is unclear. So it seems like we'd either need to change the status.AlarmDel value to a string, or would have to come up with some duration number for 'Low Battery'?
Let me know what makes sense and I could test it out and make a PR. This is currently causing errors in a Telegraf plugin (influxdata/telegraf#8521).
The text was updated successfully, but these errors were encountered:
Hello,
Currently in status.go, we have this bit of code, which parses the ALARMDEL value:
this accounts for the ALARMDEL having a value of "No alarm". Otherwise, it parses it as a time.Duration. However, this won't always work because there are two other possible non-duration values, per the apcupsd library's source (apcstatus.c):
So, the two that aren't handled currently are 'Always' and 'Low Battery', with 'Always' meaning that alarms should sound immediately and continuously upon power fail, and 'Low Battery' meaning that the alarm should sound only after power fails and battery becomes low. (source).
So I guess 'Always' could be converted to just a '0' duration, but 'Low Battery' is unclear. So it seems like we'd either need to change the
status.AlarmDel
value to astring
, or would have to come up with some duration number for 'Low Battery'?Let me know what makes sense and I could test it out and make a PR. This is currently causing errors in a Telegraf plugin (influxdata/telegraf#8521).
The text was updated successfully, but these errors were encountered: