Corrected sensor name BCM600 --> BME680
This commit is contained in:
		| @@ -11,7 +11,7 @@ relays: | |||||||
|   pin: 24 |   pin: 24 | ||||||
|  |  | ||||||
| sensors: | sensors: | ||||||
| - !bcm600 | - !bme680 | ||||||
|   location: inside |   location: inside | ||||||
|   interval: 2 |   interval: 2 | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ import yaml | |||||||
| from flask import Flask, request, render_template, send_file, redirect, send_from_directory | from flask import Flask, request, render_template, send_file, redirect, send_from_directory | ||||||
|  |  | ||||||
| import source # take a look in source/__init__.py | import source # take a look in source/__init__.py | ||||||
| from brewSensor import BCM600Sensor, DHT11Sensor, BrewSensor | from brewSensor import BME680Sensor, DHT11Sensor, BrewSensor | ||||||
| from brewCamera import BrewCamera | from brewCamera import BrewCamera | ||||||
| from brewRelay import BrewRelay | from brewRelay import BrewRelay | ||||||
|  |  | ||||||
| @@ -14,7 +14,7 @@ brewCamera = BrewCamera(20) | |||||||
| def readYaml(filePath): | def readYaml(filePath): | ||||||
|   loader = yaml.SafeLoader |   loader = yaml.SafeLoader | ||||||
|   loader.add_constructor('!Relay', BrewRelay.fromYaml) |   loader.add_constructor('!Relay', BrewRelay.fromYaml) | ||||||
|   loader.add_constructor('!bcm600', BCM600Sensor.fromYaml) |   loader.add_constructor('!bme680', BME680Sensor.fromYaml) | ||||||
|   loader.add_constructor('!dht11', DHT11Sensor.fromYaml) |   loader.add_constructor('!dht11', DHT11Sensor.fromYaml) | ||||||
|   return yaml.load(open(filePath, "rb"), Loader=loader) |   return yaml.load(open(filePath, "rb"), Loader=loader) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -75,7 +75,7 @@ class DHT11Sensor(BrewSensor): | |||||||
|     def fromYaml(loader, node): |     def fromYaml(loader, node): | ||||||
|         return DHT11Sensor(**loader.construct_mapping(node)) |         return DHT11Sensor(**loader.construct_mapping(node)) | ||||||
|  |  | ||||||
| class BCM600Sensor(BrewSensor): | class BME680Sensor(BrewSensor): | ||||||
|     def __init__(self, location, interval): |     def __init__(self, location, interval): | ||||||
|         super().__init__(location, interval) |         super().__init__(location, interval) | ||||||
|  |  | ||||||
| @@ -176,7 +176,7 @@ class BCM600Sensor(BrewSensor): | |||||||
|  |  | ||||||
|     @staticmethod |     @staticmethod | ||||||
|     def fromYaml(loader, node): |     def fromYaml(loader, node): | ||||||
|         return BCM600Sensor(**loader.construct_mapping(node)) |         return BME680Sensor(**loader.construct_mapping(node)) | ||||||
|  |  | ||||||
|     def __repr__(self): |     def __repr__(self): | ||||||
|         return "{0:.2f} C,{1:.2f} hPa,{2:.2f} %RH".format(self.temp, self.pressure, self.humidity) |         return "{0:.2f} C,{1:.2f} hPa,{2:.2f} %RH".format(self.temp, self.pressure, self.humidity) | ||||||
| @@ -184,7 +184,7 @@ class BCM600Sensor(BrewSensor): | |||||||
|  |  | ||||||
| if __name__ == '__main__': | if __name__ == '__main__': | ||||||
| #    brewSensor = DHT11Sensor(13, 'outside', 30) | #    brewSensor = DHT11Sensor(13, 'outside', 30) | ||||||
|     brewSensor = BCM600Sensor('inside', 2)  |     brewSensor = BME680Sensor('inside', 2) | ||||||
|  |  | ||||||
|     while True: |     while True: | ||||||
|         print(brewSensor.temp) |         print(brewSensor.temp) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user