Sensor: Only post to eventlog when specific columns change (#16370)

This commit is contained in:
Tony Murray 2024-09-06 20:49:56 -05:00 committed by GitHub
parent f54e38f4fe
commit 3da691277a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -122,7 +122,10 @@ class SensorObserver
echo 'U'; echo 'U';
} }
EventLog::log('Sensor Updated: ' . $sensor->sensor_class . ' ' . $sensor->sensor_type . ' ' . $sensor->sensor_index . ' ' . $sensor->sensor_descr, $sensor->device_id, 'sensor', Severity::Notice, $sensor->sensor_id); // only post eventlog when relevant columns change
if ($sensor->isDirty(['sensor_class', 'sensor_oid', 'sensor_index', 'sensor_type', 'sensor_descr', 'group', 'sensor_divisor', 'sensor_multiplier', 'entPhysicalIndex', 'entPhysicalIndex_measured', 'user_func'])) {
EventLog::log('Sensor Updated: ' . $sensor->sensor_class . ' ' . $sensor->sensor_type . ' ' . $sensor->sensor_index . ' ' . $sensor->sensor_descr, $sensor->device_id, 'sensor', Severity::Notice, $sensor->sensor_id);
}
} }
public function deleted(): void public function deleted(): void