Skip to content

Commit

Permalink
ac1100 reports in mA :/
Browse files Browse the repository at this point in the history
  • Loading branch information
mplogas committed Sep 20, 2024
1 parent e71d50f commit b7ee42d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Ecowitt.Controller/Mapping/SensorBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public partial class SensorBuilder
case "ac_voltage":
return BuildVoltageSensor(propertyName, "AC Voltage", propertyValue);
case "ac_current":
return BuildCurrentSensor(propertyName, "AC Current", propertyValue);
return BuildCurrentSensor(propertyName, "AC Current", propertyValue, true);
case "water_status":
return BuildBinarySensor(propertyName, "Water Status", propertyValue);
case "water_action":
Expand Down
9 changes: 5 additions & 4 deletions src/Ecowitt.Controller/Mapping/SensorBuilderLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ public partial class SensorBuilder
: null;
}

private static Sensor<int>? BuildCurrentSensor(string propertyName, string alias, string propertyValue)
private static Sensor<int>? BuildCurrentSensor(string propertyName, string alias, string propertyValue, bool isMilliAmp = false)
{
return int.TryParse(propertyValue, out var value)
? new Sensor<int>(propertyName, alias, value, "A", SensorType.Current)
return int.TryParse(propertyValue, out var value)
? new Sensor<int>(propertyName, alias, isMilliAmp ? value / 1000 : value, "A", SensorType.Current)
: null;
}
}


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

0 comments on commit b7ee42d

Please sign in to comment.