Last active
December 31, 2024 17:33
-
-
Save mc3k/5b889804f63c73fe0d8fd2631c05bed4 to your computer and use it in GitHub Desktop.
Log ThermoPro TP350S temperature and humidity in Linux
This file contains hidden or 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
import sys, os, logging, datetime | |
from tp357tool import * | |
temp, humid = None, None | |
mac = 'MY:MA:CA:DD:RE:SS' | |
# Read data from ThermoPro | |
device, read, write = bt_setup(mac) | |
temp, humid = wait_for_temp(read, write) | |
if temp is not None: | |
format = "%Y-%m-%d,%H:%M:%S" | |
today = datetime.datetime.today() | |
s = today.strftime(format) | |
output = s+' '+str(temp[0])+' '+str(humid[0])+'\n' | |
with open('tp350.log', 'a') as f: | |
f.write(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment