BUG: Typo in /opt/librenms/app/Models/WirelessSensor.php

Hello, not quite sure how to report a bug, but I noticed what I believe is a typo on line 30 of /opt/librenms/app/Models/WirelessSensor.php:
the line is currently:
protected $primaryKey = ‘sensors_id’
However, it think it should be singular:
protected $primaryKey = ‘sensor_id’

I discovered this when running an alert template with the following line:
{{ $value[‘sensor_descr’] }} {{ $value[‘sensor_class’] }}: {{ \App\Models\WirelessSensor::find($value[‘sensor_id’])->sensor_current }}

When this template runs, it generates the following error:
Warning! Fallback template used due to error in template Wireless Client Count: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘wireless_sensors.sensors_id’ in ‘where clause’ (Connection: mysql, SQL: select * from wireless_sensors where wireless_sensors.sensors_id = 1 limit 1) (View: /opt/librenms/storage/framework/views/5c8803782286d32eaafd0eedadc65f57.blade.php)

1 Like

Hi,

If you don’t have a github account, you can create one.
Then edit the file on librenms github and save.
It will automatically fork the repo on your profile, create a branch, and propose you to create a pull request on LibreNMS master branch.
You will be asked to accept that the code you write for the LibreNMS project is OpenSource, and someone will approve your change.

Will do, thanks for pointing me in the right direciton.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.