def processF016TH(sLine): if (config.SWDEBUG): sys.stdout.write('Processing F016TH data' + '\n') sys.stdout.write('This is the raw data: ' + sLine + '\n') var = json.loads(sLine) state.mainID = var["device"] + var["channel"] state.lastIndoorReading = nowStr() if (state.previousIndoorReading == "Never"): pclogging.systemlog(config.INFO, "Indoor Weather Sensor Found") print("Indoor Weather Sensors Found") state.previousIndoorReading = state.lastIndoorReading state.IndoorTemperature = round( ((var["temperature_F"] - 32.0) / (9.0 / 5.0)), 2) state.IndoorHumidity = var["humidity"] state.lastIndoorReading = var["time"] state.insideID = var["channel"] indoorTH.addITReading(var["device"], var["channel"], state.IndoorTemperature, var["humidity"], var["battery"], var["time"]) #print("looking for buildJSONSemaphore acquire") state.buildJSONSemaphore.acquire() #print("buildJSONSemaphore acquired") state.StateJSON = buildJSON.getStateJSON() #if (config.SWDEBUG): # print("currentJSON = ", state.StateJSON) state.buildJSONSemaphore.release()
def processF016TH(sLine): if (config.SWDEBUG): sys.stdout.write('Processing F016TH data'+'\n') sys.stdout.write('This is the raw data: ' + sLine + '\n') var = json.loads(sLine) IT = round(((var["temperature_F"] - 32.0)/(9.0/5.0)),2) # check for bad read (not caught by checksum for some reason) # may be related to low battery if ((IT > 100.00) or (IT < -35)): # bad temperatures / Humidity #skip read return state.mainID = var["device"] + var["channel"] state.lastIndoorReading = nowStr() if (config.MQTT_Enable == True): mqtt_publish_single(sLine, f"F016TH/{var['channel']}") if (state.previousIndoorReading == "Never"): pclogging.systemlog(config.INFO,"Indoor Weather Sensor Found") print("Indoor Weather Sensors Found") state.previousIndoorReading = state.lastIndoorReading state.IndoorTemperature = IT state.IndoorHumidity = var["humidity"] state.lastIndoorReading = var["time"] state.insideID = var["channel"] indoorTH.addITReading(var["device"], var["channel"], state.IndoorTemperature, var["humidity"], var["battery"], var["time"]) #print("looking for buildJSONSemaphore acquire") state.buildJSONSemaphore.acquire() #print("buildJSONSemaphore acquired") state.StateJSON = buildJSON.getStateJSON() #if (config.SWDEBUG): # print("currentJSON = ", state.StateJSON) # pass state.buildJSONSemaphore.release()