Created
February 21, 2022 04:47
-
-
Save makvoid/3c82c04cce83a52f90eb47e80b2dfca5 to your computer and use it in GitHub Desktop.
AHT20 collect method
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
@click.command() | |
@click.option('--location', required=True, help='Sensor location name') | |
def collect(location): | |
# Collect data and convert/round | |
temperature = round_num(c_to_f(sensor.temperature)) | |
humidity = round_num(sensor.relative_humidity) | |
# Save entry | |
try: | |
save_entry(location, temperature, humidity) | |
except Exception as e: | |
# Print error traceback | |
print(traceback.format_exc()) | |
sys.exit(1) | |
print('Entry saved:', temperature, 'F,', humidity, '% H') | |
if __name__ == '__main__': | |
collect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment