Skip to content

Instantly share code, notes, and snippets.

@niektemme
Created July 31, 2015 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niektemme/775ce397efdb1fe270db to your computer and use it in GitHub Desktop.
Save niektemme/775ce397efdb1fe270db to your computer and use it in GitHub Desktop.
Smart Thermostat Raspberry PI - part delete
def fdel():
"""
Deletes old data from local tables at Raspberry PI.
Runs as a sperate thread.
"""
while True:
time.sleep(5)
try:
logging.debug("del started")
fvcurtime = time.time()
fdvepoch = int(fvcurtime) - 120 #keep sensor values for two minues
dbd = dbc.cursor()
dbd.execute("DELETE FROM sensvals WHERE vepoch < %i" % fdvepoch)
dbd.close()
except Exception:
logging.exception("fdel")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment