diff --git a/main.py b/main.py index f7ee0f8..54f0ec5 100755 --- a/main.py +++ b/main.py @@ -22,7 +22,7 @@ if __name__ == "__main__": # Setup for Hardware DHT22_PIN = 4 dht_device = adafruit_dht.DHT22(4) - file = '/home/pi/code/dht22/log.csv' + file = './log.csv' with open(file,'a') as f: @@ -31,7 +31,6 @@ if __name__ == "__main__": data = get_sensor_data(dht22=dht_device) if data: temperature, humidity = get_sensor_data(dht22=dht_device) -# current_time = datetime.now().strftime("%D %H:%M:%S") current_time = datetime.now(pytz.timezone('UTC')).strftime("%D %H:%M:%S") print(f'{humidity:.2f}% {temperature:.2f}degF') f.write(f'{current_time},{temperature:.2f},{humidity:.2f}\n') @@ -40,7 +39,8 @@ if __name__ == "__main__": "datetime": current_time, "temperature": temperature, "humidity": humidity, - "location": "basement" + # Be Sure To Edit Location + "location": "living_room" } creds = get_db_creds("./.creds.json") conn = connect_db(creds["db"], creds["host"], creds["user"], creds["passwd"]) diff --git a/setup.sh b/setup.sh index c5759c8..b76ecae 100644 --- a/setup.sh +++ b/setup.sh @@ -3,6 +3,3 @@ apt update && apt upgrade -y && apt install python3-dev python3-pip python3-psyc # Install Python modules. pip3 install RPi.GPIO psycopg2 adafruit-circuitpython-dht pytz - -# Start the python script. -/usr/bin/python3 main.py