Merge pull request #260 from mitte2/mitte2-patch-1

current sensor unit
This commit is contained in:
Jack Kingsman
2026-05-14 08:58:28 -07:00
committed by GitHub
@@ -212,7 +212,7 @@ export const LPP_UNIT_MAP: Record<string, string> = {
humidity: '%',
barometer: 'hPa',
voltage: 'V',
current: 'mA',
current: 'A',
luminosity: 'lux',
altitude: 'm',
power: 'W',
@@ -235,6 +235,9 @@ export function lppDisplayUnit(
if (typeName === 'temperature' && unitPref === 'imperial') {
return { unit: '°F', value: (value * 9) / 5 + 32 };
}
if (typeName === 'current') {
if (value <= 1) return { unit: 'mA', value: value * 1000 };
}
return { unit: LPP_UNIT_MAP[typeName] ?? '', value };
}