-
-
Save machinechat/65368853a2c6239f0e5a022f27990b0a to your computer and use it in GitHub Desktop.
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 | |
# SendBMEtoJEDI.py - JEDI One Custom Plug-in Python script for Raspberry Pi with i2c attached BME280 | |
# Makes values available to JEDI One | |
# Requires installing Adafruit library - sudo pip3 install adafruit-circuitpython-bme280 | |
# | |
# v0.3 DRM 05/04/2022 | |
import board | |
import time | |
from adafruit_bme280 import basic as adafruit_bme280 | |
# Create library object using our Bus I2C port | |
i2c = board.I2C() | |
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c, 0x77) | |
# Some BME280 sensors are strapped for 0x76 address. Change 0x77 to 0x76 above | |
# If an error occurs saying no device found at 0x77 | |
# Device ID, Create a unique device name so Jedi knows the source of the data | |
devID = "BME280Sensor1" | |
#New print statements that have Jedi tags | |
print("metric:id=%s,n=Temperature,vd=%0.1f,u=C" % (devID, bme280.temperature)) | |
print("metric:id=%s,n=Humidity,vd=%0.1f,u=%%" % (devID, bme280.humidity)) | |
print("metric:id=%s,n=Pressure,vd=%0.1f,u=hPa" % (devID, bme280.pressure)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment