Skip to content

Commit 50fc192

Browse files
committed
Change variable order to better detect missing data
1 parent cece127 commit 50fc192

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

WeatherStationCoreLink/main.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,22 +121,18 @@ def looprequest():
121121
return False
122122

123123
#print(str(chr(response[1])) + str(chr(response[2])) + str(chr(response[3]))) #Should be LOO
124-
125-
if data["windSpeed"] > 80 or data["temperatureC"] > 50 or data["humidity"] > 100 or data["windDirection"] > 360:
126-
log(data["windSpeed"])
127-
log(data['temperatureC'])
128-
log(data['humidity'])
129-
log(data['windDirection'])
130-
log("[INFO] Ignoring data because it's a bit wierd")
124+
if data["windSpeed"] == 255 and data["humidity"] == 255: # This happens when console in setup mode
125+
log("[ERROR] CONSOLE IN SETUP MENU OR STATION DISCONNECTED (Ignoring data because of 255 speed and humidity)")
126+
time.sleep(30) #Wait 30 seconds in an attempt to stop it being spammed over the winter
127+
errorcount = errorcount + 1
128+
return False # Ignore - there's very little we can do remotely :(
129+
elif data["windSpeed"] > 80 or data["temperatureC"] > 50 or data["humidity"] > 100 or data["windDirection"] > 360:
130+
log("[INFO] Ignoring data because it's a bit weird")
131131
return False
132132
elif data["windSpeed"] == 0 and data["windDirection"] == 0: #This indicates it's struggling for data so ignore
133133
log("[INFO] Ignoring data because of 0 wind direction and speed")
134134
errorcount = errorcount + 1
135135
return False
136-
elif data["windSpeed"] == 255 and data["wind10MinAverage"] == 255: #This happens when console in setup mode
137-
log("[ERROR] CONSOLE IN SETUP MENU (Ignoring data because of 255 direction, speed and average)")
138-
errorcount = errorcount + 1
139-
return False #Ignore - there's very little we can do remotely :(
140136
else:
141137
if data["wind10MinAverage"] == 255:
142138
data["wind10MinAverage"] = data["windSpeed"]

0 commit comments

Comments
 (0)