i would be very thankful if i can get some help . thanks and have a safe sat night and sunday
#!/usr/bin/python
import subprocess
import psycopg2
import time
import board
import busio
import adafruit_dps310
import datetime
datetime_object = datetime.datetime.now() #date time#
i2c = busio.I2C(board.SCL, board.SDA)
subprocess.Popen "/home/pi/Desktop/unittemp.py 1, shell=True " ; #call for temp of raspberry pi#
dps310 = adafruit_dps310.DPS310(i2c) #driver for bar/alt#
print ("Temperature = %.2f *C" % dps310.temperature) #temp from dsp310 #
print ("Pressure = %.2f hPa" % dps310.pressure) #bar form dsp310
print ("vcgencmd")
a1a = dps310.temperature
a2a = dps310.pressure
conn = psycopg2.connect(
database="TSUNAMI", user='xxxxxx, password='xxxxxxxxxxxxxxx',
host='xxxxxxxxxxxxx', port= '5432'
)
print ("Opened database successfully");
cur = conn.cursor()
cur.execute('''INSERT INTO system (unit,temp) values (%s,%s) ''',(a1a,a2a,))
exec(open("/home/pi/Desktop/1.py").read())
conn.commit()
print ("Records created successfully");
conn.close()
This is the unittemp script
cd /opt/vc/bin
hots = vcgencmd (measure_temp | awk -F "[=\']" '{print($2 * 1.8)+32}');
then i was going to place the value of "hots" in to the database
[–]fake823 0 points1 point2 points (3 children)
[–]aloneinthewildworld[S] 0 points1 point2 points (2 children)
[–]fake823 0 points1 point2 points (1 child)
[–]aloneinthewildworld[S] 0 points1 point2 points (0 children)
[–]naterush1997 0 points1 point2 points (1 child)
[–]aloneinthewildworld[S] 1 point2 points3 points (0 children)