Created
December 31, 2016 18:35
-
-
Save ninjacato/a4000afdc06b5108fef08e3343583df3 to your computer and use it in GitHub Desktop.
Super-hacky DS18B20 C.H.I.P to Dweet.io/Freeboard.io Python script (DISCLAIMER: This piece of shit code does not represent me or my company, promises precious!)
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
#!/usr/bin/python3 | |
import requests | |
lines = [line.rstrip('\n') for line in open('/sys/devices/w1_bus_master1/28-041623a503ff/w1_slave')] # Replace with own device | |
crc = lines[0].endswith('YES') | |
# Insert precision | |
temp = lines[1][29:][:2] + "." + lines[1][29:][2:] | |
if crc is True: | |
requests.post('https://dweet.io/dweet/for/thingie?some-key=' + temp) | |
print("Sending temp: " + temp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment