mirror of
https://github.com/zyphlar/LanternPowerMonitor.git
synced 2024-03-08 14:07:47 +00:00
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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user