Skip to content

Commit 774d27a

Browse files
author
Mark Heinis
committed
Fix issue with DewPoint NaN float #528
Fix issue with DewPoint NaN float #528
1 parent 0e46759 commit 774d27a

File tree

4 files changed

+38
-12
lines changed

4 files changed

+38
-12
lines changed

app/version.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Fri Jun 14 15:38:04 CEST 2019
2-
VERSION_BUILD=5910
1+
#Fri Jun 14 15:47:17 CEST 2019
2+
VERSION_BUILD=5911
33
VERSION_PATCH=110
44
VERSION_CODE=426

domoticzapi/src/main/java/nl/hnogames/domoticzapi/Containers/DevicesInfo.java

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,29 @@ public DevicesInfo(JSONObject row) throws JSONException {
119119
Chill = row.getString("Chill");
120120
if (row.has("Speed"))
121121
Speed = row.getString("Speed");
122-
if (row.has("DewPoint"))
123-
DewPoint = row.getLong("DewPoint");
124-
if (row.has("Temp"))
125-
Temp = row.getLong("Temp");
126-
if (row.has("Barometer"))
127-
Barometer = row.getInt("Barometer");
122+
123+
if (row.has("DewPoint")) {
124+
try {
125+
DewPoint = row.getLong("DewPoint");
126+
} catch (Exception ex) {
127+
DewPoint = 0;
128+
}
129+
}
130+
if (row.has("Temp")) {
131+
try {
132+
Temp = row.getLong("Temp");
133+
} catch (Exception ex) {
134+
Temp = 0;
135+
}
136+
}
137+
if (row.has("Barometer")) {
138+
try {
139+
Barometer = row.getInt("Barometer");
140+
} catch (Exception ex) {
141+
Barometer = 0;
142+
}
143+
}
144+
128145
if (row.has("Description"))
129146
Description = row.getString("Description");
130147

domoticzapi/src/main/java/nl/hnogames/domoticzapi/Containers/TemperatureInfo.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ public TemperatureInfo(JSONObject row) throws JSONException {
6565
try {
6666
if (row.has("Temp"))
6767
Temp = row.getDouble("Temp");
68-
}catch(Exception ex){}
68+
}catch(Exception ex){
69+
Temp = 0;
70+
}
6971

7072
if (row.has("LastUpdate"))
7173
LastUpdate = row.getString("LastUpdate");
@@ -75,8 +77,15 @@ public TemperatureInfo(JSONObject row) throws JSONException {
7577
TypeImg = row.getString("TypeImg");
7678
if (row.has("DirectionStr"))
7779
Direction = row.getString("DirectionStr");
78-
if (row.has("SetPoint"))
79-
setPoint = row.getDouble("SetPoint");
80+
81+
if (row.has("SetPoint")) {
82+
try {
83+
setPoint = row.getDouble("SetPoint");
84+
} catch (Exception ex) {
85+
setPoint = 0;
86+
}
87+
}
88+
8089
if (row.has("Name"))
8190
Name = row.getString("Name");
8291
if (row.has("Description"))

domoticzapi/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Fri Jun 14 15:38:04 CEST 2019
1+
#Fri Jun 14 15:47:17 CEST 2019
22
VERSION_BUILD=3675
33
VERSION_PATCH=219
44
VERSION_CODE=219

0 commit comments

Comments
 (0)