Add RSSI channel to intesisHome and fixed some NPEs (#13244)
Signed-off-by: Hans-Jörg Merk <github@hmerk.de>
This commit is contained in:
parent
e4c9a40d03
commit
9b128c2f7d
@ -42,7 +42,7 @@ The binding uses the following configuration parameters.
|
|||||||
| outdoorTemperature | Number:Temperature | (Readonly) The outdoor air temperature (if applicable) | |
|
| outdoorTemperature | Number:Temperature | (Readonly) The outdoor air temperature (if applicable) | |
|
||||||
| errorStatus | String | (Readonly) The error status of the device | OK,ERR |
|
| errorStatus | String | (Readonly) The error status of the device | OK,ERR |
|
||||||
| errorCode | String | (Readonly) The error code if an error encountered | not documented |
|
| errorCode | String | (Readonly) The error code if an error encountered | not documented |
|
||||||
| wifiSignal | Number | (Readonly) WiFi signal strength (IntesisBox only) | 4=excellent, 3=very good, 2=good, 1=acceptable, 0=low |
|
| wifiSignal | Number | (Readonly) WiFi signal strength | 4=excellent, 3=very good, 2=good, 1=acceptable, 0=low |
|
||||||
|
|
||||||
Note that individual A/C units may not support all channels, or all possible values for those channels.
|
Note that individual A/C units may not support all channels, or all possible values for those channels.
|
||||||
|
|
||||||
|
|||||||
@ -34,8 +34,6 @@ import org.osgi.service.component.ComponentContext;
|
|||||||
import org.osgi.service.component.annotations.Activate;
|
import org.osgi.service.component.annotations.Activate;
|
||||||
import org.osgi.service.component.annotations.Component;
|
import org.osgi.service.component.annotations.Component;
|
||||||
import org.osgi.service.component.annotations.Reference;
|
import org.osgi.service.component.annotations.Reference;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link IntesisHandlerFactory} is responsible for creating things and thing
|
* The {@link IntesisHandlerFactory} is responsible for creating things and thing
|
||||||
@ -47,7 +45,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
@Component(configurationPid = "binding.intesis", service = ThingHandlerFactory.class)
|
@Component(configurationPid = "binding.intesis", service = ThingHandlerFactory.class)
|
||||||
public class IntesisHandlerFactory extends BaseThingHandlerFactory {
|
public class IntesisHandlerFactory extends BaseThingHandlerFactory {
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(IntesisHandlerFactory.class);
|
|
||||||
private final HttpClient httpClient;
|
private final HttpClient httpClient;
|
||||||
private final IntesisDynamicStateDescriptionProvider intesisStateDescriptionProvider;
|
private final IntesisDynamicStateDescriptionProvider intesisStateDescriptionProvider;
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,7 @@ import org.openhab.binding.intesis.internal.gson.IntesisHomeJSonDTO.Dpval;
|
|||||||
import org.openhab.binding.intesis.internal.gson.IntesisHomeJSonDTO.Id;
|
import org.openhab.binding.intesis.internal.gson.IntesisHomeJSonDTO.Id;
|
||||||
import org.openhab.binding.intesis.internal.gson.IntesisHomeJSonDTO.Info;
|
import org.openhab.binding.intesis.internal.gson.IntesisHomeJSonDTO.Info;
|
||||||
import org.openhab.binding.intesis.internal.gson.IntesisHomeJSonDTO.Response;
|
import org.openhab.binding.intesis.internal.gson.IntesisHomeJSonDTO.Response;
|
||||||
|
import org.openhab.core.library.types.DecimalType;
|
||||||
import org.openhab.core.library.types.OnOffType;
|
import org.openhab.core.library.types.OnOffType;
|
||||||
import org.openhab.core.library.types.QuantityType;
|
import org.openhab.core.library.types.QuantityType;
|
||||||
import org.openhab.core.library.types.StringType;
|
import org.openhab.core.library.types.StringType;
|
||||||
@ -222,8 +223,12 @@ public class IntesisHomeHandler extends BaseThingHandler {
|
|||||||
"{\"command\":\"login\",\"data\":{\"username\":\"Admin\",\"password\":\"" + config.password + "\"}}",
|
"{\"command\":\"login\",\"data\":{\"username\":\"Admin\",\"password\":\"" + config.password + "\"}}",
|
||||||
resp -> {
|
resp -> {
|
||||||
Data data = gson.fromJson(resp.data, Data.class);
|
Data data = gson.fromJson(resp.data, Data.class);
|
||||||
Id id = gson.fromJson(data.id, Id.class);
|
if (data != null) {
|
||||||
sessionId[0] = id.sessionID.toString();
|
Id id = gson.fromJson(data.id, Id.class);
|
||||||
|
if (id != null) {
|
||||||
|
sessionId[0] = id.sessionID.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (sessionId[0] != null && !sessionId[0].isEmpty()) {
|
if (sessionId[0] != null && !sessionId[0].isEmpty()) {
|
||||||
updateStatus(ThingStatus.ONLINE);
|
updateStatus(ThingStatus.ONLINE);
|
||||||
@ -243,13 +248,45 @@ public class IntesisHomeHandler extends BaseThingHandler {
|
|||||||
public void populateProperties() {
|
public void populateProperties() {
|
||||||
postRequest("{\"command\":\"getinfo\",\"data\":\"\"}", resp -> {
|
postRequest("{\"command\":\"getinfo\",\"data\":\"\"}", resp -> {
|
||||||
Data data = gson.fromJson(resp.data, Data.class);
|
Data data = gson.fromJson(resp.data, Data.class);
|
||||||
Info info = gson.fromJson(data.info, Info.class);
|
if (data != null) {
|
||||||
properties.put(PROPERTY_VENDOR, "Intesis");
|
Info info = gson.fromJson(data.info, Info.class);
|
||||||
properties.put(PROPERTY_MODEL_ID, info.deviceModel);
|
if (info != null) {
|
||||||
properties.put(PROPERTY_SERIAL_NUMBER, info.sn);
|
properties.put(PROPERTY_VENDOR, "Intesis");
|
||||||
properties.put(PROPERTY_FIRMWARE_VERSION, info.fwVersion);
|
properties.put(PROPERTY_MODEL_ID, info.deviceModel);
|
||||||
properties.put(PROPERTY_MAC_ADDRESS, info.wlanSTAMAC);
|
properties.put(PROPERTY_SERIAL_NUMBER, info.sn);
|
||||||
updateStatus(ThingStatus.ONLINE);
|
properties.put(PROPERTY_FIRMWARE_VERSION, info.fwVersion);
|
||||||
|
properties.put(PROPERTY_MAC_ADDRESS, info.wlanSTAMAC);
|
||||||
|
updateStatus(ThingStatus.ONLINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getWiFiSignal() {
|
||||||
|
postRequest("{\"command\":\"getinfo\",\"data\":\"\"}", resp -> {
|
||||||
|
Data data = gson.fromJson(resp.data, Data.class);
|
||||||
|
if (data != null) {
|
||||||
|
Info info = gson.fromJson(data.info, Info.class);
|
||||||
|
if (info != null) {
|
||||||
|
String rssi = info.rssi;
|
||||||
|
int dbm = Integer.valueOf(rssi);
|
||||||
|
int strength = -1;
|
||||||
|
if (dbm > -60) {
|
||||||
|
strength = 4;
|
||||||
|
} else if (dbm > -70) {
|
||||||
|
strength = 3;
|
||||||
|
} else if (dbm > -80) {
|
||||||
|
strength = 2;
|
||||||
|
} else if (dbm > -90) {
|
||||||
|
strength = 1;
|
||||||
|
} else {
|
||||||
|
strength = 0;
|
||||||
|
}
|
||||||
|
DecimalType signalStrength = new DecimalType(strength);
|
||||||
|
updateState(CHANNEL_TYPE_RSSI, signalStrength);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,11 +316,14 @@ public class IntesisHomeHandler extends BaseThingHandler {
|
|||||||
String response = api.postRequest(config.ipAddress, request);
|
String response = api.postRequest(config.ipAddress, request);
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
Response resp = gson.fromJson(response, Response.class);
|
Response resp = gson.fromJson(response, Response.class);
|
||||||
boolean success = resp.success;
|
if (resp != null) {
|
||||||
if (success) {
|
boolean success = resp.success;
|
||||||
handler.accept(resp);
|
if (success) {
|
||||||
} else {
|
handler.accept(resp);
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Request unsuccessful");
|
} else {
|
||||||
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
|
||||||
|
"Request unsuccessful");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "No Response");
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "No Response");
|
||||||
@ -308,105 +348,118 @@ public class IntesisHomeHandler extends BaseThingHandler {
|
|||||||
private void handleDataPointsResponse(Response response) {
|
private void handleDataPointsResponse(Response response) {
|
||||||
try {
|
try {
|
||||||
Data data = gson.fromJson(response.data, Data.class);
|
Data data = gson.fromJson(response.data, Data.class);
|
||||||
Dp dp = gson.fromJson(data.dp, Dp.class);
|
if (data != null) {
|
||||||
Datapoints[] datapoints = gson.fromJson(dp.datapoints, Datapoints[].class);
|
Dp dp = gson.fromJson(data.dp, Dp.class);
|
||||||
for (Datapoints datapoint : datapoints) {
|
if (dp != null) {
|
||||||
Descr descr = gson.fromJson(datapoint.descr, Descr.class);
|
Datapoints[] datapoints = gson.fromJson(dp.datapoints, Datapoints[].class);
|
||||||
String channelId = "";
|
if (datapoints != null) {
|
||||||
String itemType = "String";
|
for (Datapoints datapoint : datapoints) {
|
||||||
switch (datapoint.uid) {
|
Descr descr = gson.fromJson(datapoint.descr, Descr.class);
|
||||||
case 2:
|
String channelId = "";
|
||||||
List<String> opModes = new ArrayList<>();
|
String itemType = "String";
|
||||||
for (String modString : descr.states) {
|
switch (datapoint.uid) {
|
||||||
switch (modString) {
|
case 2:
|
||||||
case "0":
|
if (descr != null) {
|
||||||
opModes.add("AUTO");
|
List<String> opModes = new ArrayList<>();
|
||||||
|
for (String modString : descr.states) {
|
||||||
|
switch (modString) {
|
||||||
|
case "0":
|
||||||
|
opModes.add("AUTO");
|
||||||
|
break;
|
||||||
|
case "1":
|
||||||
|
opModes.add("HEAT");
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
opModes.add("DRY");
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
opModes.add("FAN");
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
opModes.add("COOL");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
properties.put("supported modes", opModes.toString());
|
||||||
|
channelId = CHANNEL_TYPE_MODE;
|
||||||
|
addChannel(channelId, itemType, opModes);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "1":
|
case 4:
|
||||||
opModes.add("HEAT");
|
if (descr != null) {
|
||||||
|
List<String> fanLevels = new ArrayList<>();
|
||||||
|
for (String fanString : descr.states) {
|
||||||
|
if ("AUTO".contentEquals(fanString)) {
|
||||||
|
fanLevels.add("AUTO");
|
||||||
|
} else {
|
||||||
|
fanLevels.add(fanString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
properties.put("supported fan levels", fanLevels.toString());
|
||||||
|
channelId = CHANNEL_TYPE_FANSPEED;
|
||||||
|
addChannel(channelId, itemType, fanLevels);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "2":
|
case 5:
|
||||||
opModes.add("DRY");
|
case 6:
|
||||||
|
List<String> swingModes = new ArrayList<>();
|
||||||
|
if (descr != null) {
|
||||||
|
for (String swingString : descr.states) {
|
||||||
|
if ("AUTO".contentEquals(swingString)) {
|
||||||
|
swingModes.add("AUTO");
|
||||||
|
} else if ("10".contentEquals(swingString)) {
|
||||||
|
swingModes.add("SWING");
|
||||||
|
} else if ("11".contentEquals(swingString)) {
|
||||||
|
swingModes.add("SWIRL");
|
||||||
|
} else if ("12".contentEquals(swingString)) {
|
||||||
|
swingModes.add("WIDE");
|
||||||
|
} else {
|
||||||
|
swingModes.add(swingString);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (datapoint.uid) {
|
||||||
|
case 5:
|
||||||
|
channelId = CHANNEL_TYPE_VANESUD;
|
||||||
|
properties.put("supported vane up/down modes", swingModes.toString());
|
||||||
|
addChannel(channelId, itemType, swingModes);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
channelId = CHANNEL_TYPE_VANESLR;
|
||||||
|
properties.put("supported vane left/right modes", swingModes.toString());
|
||||||
|
addChannel(channelId, itemType, swingModes);
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "3":
|
case 9:
|
||||||
opModes.add("FAN");
|
channelId = CHANNEL_TYPE_TARGETTEMP;
|
||||||
|
itemType = "Number:Temperature";
|
||||||
|
addChannel(channelId, itemType, null);
|
||||||
break;
|
break;
|
||||||
case "4":
|
case 10:
|
||||||
opModes.add("COOL");
|
channelId = CHANNEL_TYPE_AMBIENTTEMP;
|
||||||
|
itemType = "Number:Temperature";
|
||||||
|
addChannel(channelId, itemType, null);
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
channelId = CHANNEL_TYPE_ERRORSTATUS;
|
||||||
|
itemType = "Switch";
|
||||||
|
addChannel(channelId, itemType, null);
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
channelId = CHANNEL_TYPE_ERRORCODE;
|
||||||
|
itemType = "String";
|
||||||
|
addChannel(channelId, itemType, null);
|
||||||
|
break;
|
||||||
|
case 37:
|
||||||
|
channelId = CHANNEL_TYPE_OUTDOORTEMP;
|
||||||
|
itemType = "Number:Temperature";
|
||||||
|
addChannel(channelId, itemType, null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
properties.put("supported modes", opModes.toString());
|
}
|
||||||
channelId = CHANNEL_TYPE_MODE;
|
|
||||||
addChannel(channelId, itemType, opModes);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
List<String> fanLevels = new ArrayList<>();
|
|
||||||
for (String fanString : descr.states) {
|
|
||||||
if ("AUTO".contentEquals(fanString)) {
|
|
||||||
fanLevels.add("AUTO");
|
|
||||||
} else {
|
|
||||||
fanLevels.add(fanString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
properties.put("supported fan levels", fanLevels.toString());
|
|
||||||
channelId = CHANNEL_TYPE_FANSPEED;
|
|
||||||
addChannel(channelId, itemType, fanLevels);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
List<String> swingModes = new ArrayList<>();
|
|
||||||
for (String swingString : descr.states) {
|
|
||||||
if ("AUTO".contentEquals(swingString)) {
|
|
||||||
swingModes.add("AUTO");
|
|
||||||
} else if ("10".contentEquals(swingString)) {
|
|
||||||
swingModes.add("SWING");
|
|
||||||
} else if ("11".contentEquals(swingString)) {
|
|
||||||
swingModes.add("SWIRL");
|
|
||||||
} else if ("12".contentEquals(swingString)) {
|
|
||||||
swingModes.add("WIDE");
|
|
||||||
} else {
|
|
||||||
swingModes.add(swingString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (datapoint.uid) {
|
|
||||||
case 5:
|
|
||||||
channelId = CHANNEL_TYPE_VANESUD;
|
|
||||||
properties.put("supported vane up/down modes", swingModes.toString());
|
|
||||||
addChannel(channelId, itemType, swingModes);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
channelId = CHANNEL_TYPE_VANESLR;
|
|
||||||
properties.put("supported vane left/right modes", swingModes.toString());
|
|
||||||
addChannel(channelId, itemType, swingModes);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
channelId = CHANNEL_TYPE_TARGETTEMP;
|
|
||||||
itemType = "Number:Temperature";
|
|
||||||
addChannel(channelId, itemType, null);
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
channelId = CHANNEL_TYPE_AMBIENTTEMP;
|
|
||||||
itemType = "Number:Temperature";
|
|
||||||
addChannel(channelId, itemType, null);
|
|
||||||
break;
|
|
||||||
case 14:
|
|
||||||
channelId = CHANNEL_TYPE_ERRORSTATUS;
|
|
||||||
itemType = "Switch";
|
|
||||||
addChannel(channelId, itemType, null);
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
channelId = CHANNEL_TYPE_ERRORCODE;
|
|
||||||
itemType = "String";
|
|
||||||
addChannel(channelId, itemType, null);
|
|
||||||
break;
|
|
||||||
case 37:
|
|
||||||
channelId = CHANNEL_TYPE_OUTDOORTEMP;
|
|
||||||
itemType = "Number:Temperature";
|
|
||||||
addChannel(channelId, itemType, null);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (JsonSyntaxException e) {
|
} catch (JsonSyntaxException e) {
|
||||||
@ -423,90 +476,96 @@ public class IntesisHomeHandler extends BaseThingHandler {
|
|||||||
private void getAllUidValues() {
|
private void getAllUidValues() {
|
||||||
postRequestInSession(sessionId -> "{\"command\":\"getdatapointvalue\",\"data\":{\"sessionID\":\"" + sessionId
|
postRequestInSession(sessionId -> "{\"command\":\"getdatapointvalue\",\"data\":{\"sessionID\":\"" + sessionId
|
||||||
+ "\", \"uid\":\"all\"}}", this::handleDataPointValues);
|
+ "\", \"uid\":\"all\"}}", this::handleDataPointValues);
|
||||||
|
getWiFiSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleDataPointValues(Response response) {
|
private void handleDataPointValues(Response response) {
|
||||||
try {
|
try {
|
||||||
Data data = gson.fromJson(response.data, Data.class);
|
Data data = gson.fromJson(response.data, Data.class);
|
||||||
Dpval[] dpval = gson.fromJson(data.dpval, Dpval[].class);
|
if (data != null) {
|
||||||
for (Dpval element : dpval) {
|
Dpval[] dpval = gson.fromJson(data.dpval, Dpval[].class);
|
||||||
logger.trace("UID : {} ; value : {}", element.uid, element.value);
|
if (dpval != null) {
|
||||||
switch (element.uid) {
|
for (Dpval element : dpval) {
|
||||||
case 1:
|
logger.trace("UID : {} ; value : {}", element.uid, element.value);
|
||||||
updateState(CHANNEL_TYPE_POWER,
|
switch (element.uid) {
|
||||||
String.valueOf(element.value).equals("0") ? OnOffType.OFF : OnOffType.ON);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
switch (element.value) {
|
|
||||||
case 0:
|
|
||||||
updateState(CHANNEL_TYPE_MODE, StringType.valueOf("AUTO"));
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
updateState(CHANNEL_TYPE_MODE, StringType.valueOf("HEAT"));
|
updateState(CHANNEL_TYPE_POWER,
|
||||||
|
String.valueOf(element.value).equals("0") ? OnOffType.OFF : OnOffType.ON);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
updateState(CHANNEL_TYPE_MODE, StringType.valueOf("DRY"));
|
switch (element.value) {
|
||||||
break;
|
case 0:
|
||||||
case 3:
|
updateState(CHANNEL_TYPE_MODE, StringType.valueOf("AUTO"));
|
||||||
updateState(CHANNEL_TYPE_MODE, StringType.valueOf("FAN"));
|
break;
|
||||||
|
case 1:
|
||||||
|
updateState(CHANNEL_TYPE_MODE, StringType.valueOf("HEAT"));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
updateState(CHANNEL_TYPE_MODE, StringType.valueOf("DRY"));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
updateState(CHANNEL_TYPE_MODE, StringType.valueOf("FAN"));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
updateState(CHANNEL_TYPE_MODE, StringType.valueOf("COOL"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
updateState(CHANNEL_TYPE_MODE, StringType.valueOf("COOL"));
|
if ((element.value) == 0) {
|
||||||
|
updateState(CHANNEL_TYPE_FANSPEED, StringType.valueOf("AUTO"));
|
||||||
|
} else {
|
||||||
|
updateState(CHANNEL_TYPE_FANSPEED,
|
||||||
|
StringType.valueOf(String.valueOf(element.value)));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
if ((element.value) == 0) {
|
|
||||||
updateState(CHANNEL_TYPE_FANSPEED, StringType.valueOf("AUTO"));
|
|
||||||
} else {
|
|
||||||
updateState(CHANNEL_TYPE_FANSPEED, StringType.valueOf(String.valueOf(element.value)));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
State state;
|
|
||||||
if ((element.value) == 0) {
|
|
||||||
state = StringType.valueOf("AUTO");
|
|
||||||
} else if ((element.value) == 10) {
|
|
||||||
state = StringType.valueOf("SWING");
|
|
||||||
} else if ((element.value) == 11) {
|
|
||||||
state = StringType.valueOf("SWIRL");
|
|
||||||
} else if ((element.value) == 12) {
|
|
||||||
state = StringType.valueOf("WIDE");
|
|
||||||
} else {
|
|
||||||
state = StringType.valueOf(String.valueOf(element.value));
|
|
||||||
}
|
|
||||||
switch (element.uid) {
|
|
||||||
case 5:
|
case 5:
|
||||||
updateState(CHANNEL_TYPE_VANESUD, state);
|
|
||||||
break;
|
|
||||||
case 6:
|
case 6:
|
||||||
updateState(CHANNEL_TYPE_VANESLR, state);
|
State state;
|
||||||
|
if ((element.value) == 0) {
|
||||||
|
state = StringType.valueOf("AUTO");
|
||||||
|
} else if ((element.value) == 10) {
|
||||||
|
state = StringType.valueOf("SWING");
|
||||||
|
} else if ((element.value) == 11) {
|
||||||
|
state = StringType.valueOf("SWIRL");
|
||||||
|
} else if ((element.value) == 12) {
|
||||||
|
state = StringType.valueOf("WIDE");
|
||||||
|
} else {
|
||||||
|
state = StringType.valueOf(String.valueOf(element.value));
|
||||||
|
}
|
||||||
|
switch (element.uid) {
|
||||||
|
case 5:
|
||||||
|
updateState(CHANNEL_TYPE_VANESUD, state);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
updateState(CHANNEL_TYPE_VANESLR, state);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
int unit = Math.round((element.value) / 10);
|
||||||
|
State stateValue = QuantityType.valueOf(unit, SIUnits.CELSIUS);
|
||||||
|
updateState(CHANNEL_TYPE_TARGETTEMP, stateValue);
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
unit = Math.round((element.value) / 10);
|
||||||
|
stateValue = QuantityType.valueOf(unit, SIUnits.CELSIUS);
|
||||||
|
updateState(CHANNEL_TYPE_AMBIENTTEMP, stateValue);
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
updateState(CHANNEL_TYPE_ERRORSTATUS,
|
||||||
|
String.valueOf(element.value).equals("0") ? OnOffType.OFF : OnOffType.ON);
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
updateState(CHANNEL_TYPE_ERRORCODE, StringType.valueOf(String.valueOf(element.value)));
|
||||||
|
break;
|
||||||
|
case 37:
|
||||||
|
unit = Math.round((element.value) / 10);
|
||||||
|
stateValue = QuantityType.valueOf(unit, SIUnits.CELSIUS);
|
||||||
|
updateState(CHANNEL_TYPE_OUTDOORTEMP, stateValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case 9:
|
|
||||||
int unit = Math.round((element.value) / 10);
|
|
||||||
State stateValue = QuantityType.valueOf(unit, SIUnits.CELSIUS);
|
|
||||||
updateState(CHANNEL_TYPE_TARGETTEMP, stateValue);
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
unit = Math.round((element.value) / 10);
|
|
||||||
stateValue = QuantityType.valueOf(unit, SIUnits.CELSIUS);
|
|
||||||
updateState(CHANNEL_TYPE_AMBIENTTEMP, stateValue);
|
|
||||||
break;
|
|
||||||
case 14:
|
|
||||||
updateState(CHANNEL_TYPE_ERRORSTATUS,
|
|
||||||
String.valueOf(element.value).equals("0") ? OnOffType.OFF : OnOffType.ON);
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
updateState(CHANNEL_TYPE_ERRORCODE, StringType.valueOf(String.valueOf(element.value)));
|
|
||||||
break;
|
|
||||||
case 37:
|
|
||||||
unit = Math.round((element.value) / 10);
|
|
||||||
stateValue = QuantityType.valueOf(unit, SIUnits.CELSIUS);
|
|
||||||
updateState(CHANNEL_TYPE_OUTDOORTEMP, stateValue);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (JsonSyntaxException e) {
|
} catch (JsonSyntaxException e) {
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
<description>Represents a single IntesisHome WiFi adapter on the network, connected to an A/C unit.</description>
|
<description>Represents a single IntesisHome WiFi adapter on the network, connected to an A/C unit.</description>
|
||||||
<channels>
|
<channels>
|
||||||
<channel id="power" typeId="system.power"/>
|
<channel id="power" typeId="system.power"/>
|
||||||
|
<channel id="wifiSignal" typeId="system.signal-strength"/>
|
||||||
</channels>
|
</channels>
|
||||||
<config-description>
|
<config-description>
|
||||||
<parameter name="ipAddress" type="text" required="true">
|
<parameter name="ipAddress" type="text" required="true">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user