-
-
Save niektemme/775ce397efdb1fe270db to your computer and use it in GitHub Desktop.
Smart Thermostat Raspberry PI - part delete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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