Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Publish BME280 data from Raspberry Pi to ThingSpeak
import thingspeak # from
import bme280 # from
# return the Pi CPU/GPU temperature in degree Celcius; it's a SoC and thus there's no need to read both, see
def get_temp():
with open('/sys/class/thermal/thermal_zone0/temp', 'r') as infile:
return float( * 1e-3
ch = thingspeak.Channel(275145, "*********", "*********")
temperature, pressure, humidity = bme280.readBME280All()
data = {"field1": temperature, "field2": humidity, "field3": pressure, "field4": get_temp()}
# print(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.