Fix openhab#15514: Temperature sensors in JSON from shelly may not be in order (#15530)
Signed-off-by: Anton Hattendorf <anton@hattendoerfer.de>
This commit is contained in:
parent
756b32d988
commit
f1ccd728a6
@ -126,7 +126,10 @@ public class ShellyDeviceProfile {
|
|||||||
initFromThingType(thingType);
|
initFromThingType(thingType);
|
||||||
|
|
||||||
String json = jsonIn;
|
String json = jsonIn;
|
||||||
if (json.contains("\"ext_temperature\":{\"0\":[{")) {
|
// It is not guaranteed, that the array entries are in order. Check all
|
||||||
|
// possible variants. See openhab#15514.
|
||||||
|
if (json.contains("\"ext_temperature\":{\"0\":[{") || json.contains("\"ext_temperature\":{\"1\":[{")
|
||||||
|
|| json.contains("\"ext_temperature\":{\"2\":[{")) {
|
||||||
// Shelly UNI uses ext_temperature array, reformat to avoid GSON exception
|
// Shelly UNI uses ext_temperature array, reformat to avoid GSON exception
|
||||||
json = json.replace("ext_temperature", "ext_temperature_array");
|
json = json.replace("ext_temperature", "ext_temperature_array");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user