I think the easiest way is to have your python program read the database.
import sqlite3
from sqlite3 import Error
import datetime
import time
import json
Connected = False
database = r"C:\users\peter\weewx.sdb"
try:
conn = sqlite3.connect(database)
except Error as e:
pass
querystring = "SELECT dateTime,
barometer,inTemp,extraTemp2,outTemp,pm2_5,pm10_0 from archive where
dateTime>?"
lasttime = 1644172560
while True:
cur = conn.cursor()
column_name=[col[0] for col in cur]
cur.execute(querystring,(str(lasttime),))
try:
row = [ dict(line) for line in [zip([ column[0] for column in
cur.description], row) for row in cur.fetchall()] ]
print ("------")
*<<do something here>>*
lasttime = (row[len(row)-1]["dateTime"])
print (lasttime)
except:
print ("error")
time.sleep(10)
On Sat, Sep 21, 2024 at 12:50 PM Jan Hoogendoorn <[email protected]>
wrote:
> I have successfully weewx running with a Davis Ventage Pro2 on a Raspberry
> Pi 3. I want to the weewx readings in a Python script. I scrolled through
> the documentation, however, it is not clear to me how to get de weather
> station readings imported in my own Python program. As far as I could find
> relevant information in the documentation, it is not clear to me how to use
> it. Is is possible to give some examples of how to get weewx readings from
> a weather station imported into a Python program?
>
> Kind regards,
> Jan.
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/e97592df-38f5-401c-9318-142eff4ce674n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/e97592df-38f5-401c-9318-142eff4ce674n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
Peter Quinn
(415)794-2264
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/CAA1SM22EYgxmpYQwBSAqh3ws7XUXoM2oGPLSJXYYsOZoFY1H7A%40mail.gmail.com.