def getCabinConditions(): """get current conditions inside the car/cabin""" currentReadings = CurrentReadings.CurrentReadings('temp.data') digoleDisplay.printByFontColorPosition( 18, 254, 90, 55, "Inside: " + str(int(currentReadings.temp)) + chr(176) + " / " + str(int(currentReadings.hmidty)) + "%", getframeinfo(currentframe()))
currentScrolledPosition = 0 prevPhoneMessage = currentPhoneMessage except (Exception): pass try: # turn the WiFi icon on / off depending toggleWifiIcon() except (Exception): pass try: # update inside tempurature data tempInfo = data.getJSONFromDataFile('temp.data') if tempInfo == "": tempInfo = CurrentReadings.CurrentReadings() tempInfo = json.loads(tempInfo.to_JSON()) # update inside and outside weather insideTemp = str(tempInfo['temp']) + "f" if int(tempInfo['temp']) == 0: insideTemp = "--f" except (Exception): insideTemp = "--f" try: # get outside weather info weatherInfo = data.getJSONFromDataFile('weather.data') if weatherInfo == "": weatherInfo = WeatherDetails.WeatherDetails() weatherInfo = json.loads(weatherInfo.to_JSON())
#!/usr/bin/python # Get local temp from DHT11 humidistat # Kevin Hinds http://www.kevinhinds.com # License: GPL 2.0 import Adafruit_DHT import os, time, json import includes.data as data import info.CurrentReadings as CurrentReadings # set to use DHT11 sensor sensor = Adafruit_DHT.DHT22 pin = 22 # start logging temp while True: try: humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) if humidity is not None and temperature is not None: # convert to imperial units, save to JSON file and wait one second temperature = 9.0/5.0 * temperature + 32 currentReadings = CurrentReadings.CurrentReadings('temp.data') currentReadings.temp = str(int(temperature)) currentReadings.hmidty = str(int(humidity)) currentReadings.saveData() except (Exception): pass time.sleep(1)
#!/usr/bin/python # Get local temp from DHT11 humidistat # Kevin Hinds http://www.kevinhinds.com # License: GPL 2.0 import Adafruit_DHT import os, time, json import includes.data as data import info.CurrentReadings as CurrentReadings import includes.settings as settings # set to use DHT11 sensor sensor = Adafruit_DHT.DHT11 pin = 25 # start logging temp data.removeJSONFile('temp.data') while True: humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) if humidity is not None and temperature is not None: # convert to imperial units, save to JSON file and wait one second # @todo compensating for the temp right next to the pi (extra heat [*0.90]) temperature = (9.0/5.0 * temperature + 32) * 0.90 currentReadings = CurrentReadings.CurrentReadings() currentReadings.temp = int(temperature) currentReadings.hmidty = int(humidity) data.saveJSONObjToFile('temp.data', currentReadings) time.sleep(1)