private void UpdateSensorValue(MPowerDevice device, [AllowNull] string label, int port, DeviceType deviceType, double value) { if (!device.EnabledTypes.Contains(deviceType)) { return; } if (!device.Resolution.TryGetValue(deviceType, out var resolutionValue)) { resolutionValue = PluginConfig.GetDefaultResolution(deviceType); } var deviceIdentifier = new DeviceIdentifier(rootDeviceId, port, deviceType); string address = deviceIdentifier.Address; if (!currentChildDevices.ContainsKey(address)) { CreateDevice(label, deviceIdentifier); } var childDevice = currentChildDevices[address]; value /= childDevice.Denominator; double roundedValue = Math.Round(value / resolutionValue, 0, MidpointRounding.AwayFromZero) * resolutionValue; childDevice.Update(HS, roundedValue); }