Auto-detect frequency on first hub startup. If frequency is 50Hz, assume 230V. (This should work for 95% of cases)

This commit is contained in:
MarkBryanMilligan
2022-02-10 13:21:18 -06:00
parent 94ebf5fa93
commit a892c7f0e8
13 changed files with 143 additions and 86 deletions

View File

@@ -185,6 +185,14 @@ public class BreakerConfig implements IIdentical<BreakerConfig> {
return null;
}
public Meter getMeterForHub(int _hub) {
Meter m = null;
Breaker b = CollectionUtils.filterOne(getAllBreakers(), _b->_b.getHub() == _hub);
if (b != null)
m = CollectionUtils.filterOne(meters, _m->_m.getIndex() == b.getMeter());
return (m != null) ? m : new Meter(getAccountId(), 0, "Main");
}
public BreakerGroup findParentGroup(BreakerGroup _group) {
for (BreakerGroup group : CollectionUtils.makeNotNull(breakerGroups)) {
BreakerGroup parent = group.findParentGroup(_group);

View File

@@ -11,6 +11,15 @@ public class Meter implements IIdentical<Meter> {
private int index;
private String name;
public Meter() {
}
public Meter(int _accountId, int _index, String _name) {
accountId = _accountId;
index = _index;
name = _name;
}
public int getAccountId() {
return accountId;
}