Created
July 16, 2017 02:58
-
-
Save pgmot/050c73e8fa2cc549d940ebc8d688601e to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python | |
import sys | |
import Adafruit_DHT | |
from datetime import datetime | |
sensor = Adafruit_DHT.AM2302 | |
pin = 17 | |
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) | |
time = datetime.now().strftime('%s') | |
if humidity is not None and temperature is not None: | |
print('room.temperature\t{0}\t{1}'.format(temperature, time)) | |
print('room.humidity\t{0}\t{1}'.format(humidity, time)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment