Skip to content

Commit b7ee42d

Browse files
committed
ac1100 reports in mA :/
1 parent e71d50f commit b7ee42d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Ecowitt.Controller/Mapping/SensorBuilder.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ public partial class SensorBuilder
379379
case "ac_voltage":
380380
return BuildVoltageSensor(propertyName, "AC Voltage", propertyValue);
381381
case "ac_current":
382-
return BuildCurrentSensor(propertyName, "AC Current", propertyValue);
382+
return BuildCurrentSensor(propertyName, "AC Current", propertyValue, true);
383383
case "water_status":
384384
return BuildBinarySensor(propertyName, "Water Status", propertyValue);
385385
case "water_action":

src/Ecowitt.Controller/Mapping/SensorBuilderLogic.cs

+5-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ public partial class SensorBuilder
2020
: null;
2121
}
2222

23-
private static Sensor<int>? BuildCurrentSensor(string propertyName, string alias, string propertyValue)
23+
private static Sensor<int>? BuildCurrentSensor(string propertyName, string alias, string propertyValue, bool isMilliAmp = false)
2424
{
25-
return int.TryParse(propertyValue, out var value)
26-
? new Sensor<int>(propertyName, alias, value, "A", SensorType.Current)
25+
return int.TryParse(propertyValue, out var value)
26+
? new Sensor<int>(propertyName, alias, isMilliAmp ? value / 1000 : value, "A", SensorType.Current)
2727
: null;
28-
}
28+
}
29+
2930

3031
private static Sensor<int>? BuildPowerSensor(string propertyName, string alias, string propertyValue)
3132
{

0 commit comments

Comments
 (0)