Skip to content

Instantly share code, notes, and snippets.

@ninjacato
Created December 31, 2016 18:35
Show Gist options
  • Save ninjacato/a4000afdc06b5108fef08e3343583df3 to your computer and use it in GitHub Desktop.
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!)
#!/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