implemented bme680 with air quality
This commit is contained in:
@@ -505,7 +505,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
|
||||
elif sensor['temp_sensor_type'] == "bme280":
|
||||
temp, hum = self.read_bme280_temp(sensor['temp_sensor_address'])
|
||||
elif sensor['temp_sensor_type'] == "bme680":
|
||||
temp, hum = self.read_bme680_temp(sensor['temp_sensor_address'])
|
||||
temp, hum, airquality = self.read_bme680_temp(sensor['temp_sensor_address'])
|
||||
elif sensor['temp_sensor_type'] == "si7021":
|
||||
temp, hum = self.read_si7021_temp(sensor['temp_sensor_address'])
|
||||
elif sensor['temp_sensor_type'] == "tmp102":
|
||||
@@ -613,14 +613,15 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
|
||||
stdout = (Popen(cmd, shell=True, stdout=PIPE).stdout).read()
|
||||
if self._settings.get(["debug_temperature_log"]) is True:
|
||||
self._logger.debug("BME680 result: %s", stdout)
|
||||
temp, hum = stdout.split("|")
|
||||
return (self.to_float(temp.strip()), self.to_float(hum.strip()))
|
||||
temp, hum, airq = stdout.split("|")
|
||||
return (self.to_float(temp.strip()), self.to_float(hum.strip()), self.to_float(airq.strip()))
|
||||
except Exception as ex:
|
||||
self._logger.info(
|
||||
"Failed to execute python scripts, try disabling use SUDO on advanced section of the plugin.")
|
||||
self.log_error(ex)
|
||||
return (0, 0)
|
||||
|
||||
|
||||
|
||||
def read_si7021_temp(self, address):
|
||||
try:
|
||||
script = os.path.dirname(os.path.realpath(__file__)) + "/SI7021.py "
|
||||
@@ -1579,4 +1580,4 @@ def __plugin_load__():
|
||||
__plugin_hooks__ = {
|
||||
"octoprint.comm.protocol.gcode.queuing" : __plugin_implementation__.hook_gcode_queuing,
|
||||
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user