bugfix
This commit is contained in:
@@ -40,7 +40,18 @@ public class SetRelay extends Action {
|
||||
@Override
|
||||
public Action load(JSONObject json) {
|
||||
super.load(json);
|
||||
if (json.has(RELAY)) relay = BaseClass.get(new Id(json.getString(RELAY)));
|
||||
if (json.has(RELAY)) {
|
||||
String relayId = json.getString(RELAY);
|
||||
relay = BaseClass.get(new Id(relayId));
|
||||
if (isNull(relay)) new Thread() { // if relay not loaded, yet: wait one sec and try again
|
||||
public void run() {
|
||||
try {
|
||||
sleep(1000);
|
||||
} catch (InterruptedException e) {}
|
||||
relay = BaseClass.get(new Id(relayId));
|
||||
};
|
||||
}.start();
|
||||
}
|
||||
if (json.has(Relay.STATE)) state = json.getBoolean(Relay.STATE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -137,10 +137,10 @@ public class Relay extends Tile implements Device{
|
||||
}
|
||||
formInputs.add(t("Decoder address"),div);
|
||||
formInputs.add(t("Address"),new Input(ADDRESS, address).numeric());
|
||||
formInputs.add(t("Port for state A"),new Input(PORT_A, portA).numeric());
|
||||
formInputs.add(t("Label for state A"),new Input(LABEL_A, stateLabelA));
|
||||
formInputs.add(t("Port for state B"),new Input(PORT_B, portB).numeric());
|
||||
formInputs.add(t("Label for state B"),new Input(LABEL_B, stateLabelB));
|
||||
formInputs.add(t("Label for state {}","A"),new Input(LABEL_A, stateLabelA));
|
||||
formInputs.add(t("Label for state {}","B"),new Input(LABEL_B, stateLabelB));
|
||||
formInputs.add(t("Port for state {}",stateLabelA),new Input(PORT_A, portA).numeric());
|
||||
formInputs.add(t("Port for state {}",stateLabelB),new Input(PORT_B, portB).numeric());
|
||||
return super.properties(preForm, formInputs, postForm);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user