We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am not sure if you still are using the AirPi?!
I try to add a new sensor based on your template (SHT31 temperature and humidity sensor) with no luck so far.
Could you please give some advice?
`#!/usr/bin/python
import sensor import time import smbus
class SHT31(sensor.Sensor): requiredData = [] optionalData = []
def __init__(self,data): """ Initialisation. Any initialisation code goes here. """ self.readingtype = "temperature" self.sensorname = "SHT31" self.valname = "Temperature" self.valunit = "Degrees Celsius" self.valsymbol = "C" self.description = "SHT31 Sensor for Temperature and Humidity." return def getval(self): try: bus = smbus.SMBus(1) bus.write_i2c_block_data(0x44, 0x2C, [0x06]) time.sleep(0.5) data = bus.read_i2c_block_data(0x44, 0x00, 6) ctemp = data[0] * 256 + data[1] temp = -45 + (175 * ctemp / 65535.0) except TypeError as terr: pass return temp`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am not sure if you still are using the AirPi?!
I try to add a new sensor based on your template (SHT31 temperature and humidity sensor) with no luck so far.
Could you please give some advice?
`#!/usr/bin/python
import sensor
import time
import smbus
class SHT31(sensor.Sensor):
requiredData = []
optionalData = []
The text was updated successfully, but these errors were encountered: