Sensor Discovery in APC ATS


I have an issue in APC ATS discovery.

After adding several APC ATS in LibreNMS, i had the following discovery error :

Current: APC PowerNet-MIB ATS Error discovering sensors module for xatsx. DivisionByZeroError: Division by zero in /opt/librenms/includes/discovery/sensors/current/
Stack trace:
#0 /opt/librenms/includes/discovery/ include()
#1 /opt/librenms/includes/discovery/ sensors()
#2 /opt/librenms/includes/discovery/ include(’…’)
#3 /opt/librenms/discovery.php(106): discover_device()
#4 {main}
Division by zero {“exception”:"[object] (DivisionByZeroError(code: 0): Division by zero at /opt/librenms/includes/discovery/sensors/current/"}

Looking at the file /opt/librenms/includes/discovery/sensors/current/, line 203, i found a division by the variable “$precision” that is not declared.

After adding “$precision = ‘10’ ;”, few lines before, just after “$type = ‘apc’;”, it worked again.

Can you check and add this correction to the next update ?