main #3
|
|
@ -17,14 +17,22 @@ class DeviceInfo:
|
||||||
{
|
{
|
||||||
'type': 'moisture',
|
'type': 'moisture',
|
||||||
'pin_int': 26
|
'pin_int': 26
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'type': 'dht22',
|
'type': 'ambilight',
|
||||||
'pin_int': 15
|
'pin_int': 8, # for compatibility only
|
||||||
}
|
'pin_int_sda': 8,
|
||||||
|
'pin_int_scl': 9
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
# {
|
||||||
|
# 'type': 'dht22',
|
||||||
|
# 'pin_int': 15
|
||||||
|
# }
|
||||||
]
|
]
|
||||||
|
|
||||||
read_secs = 60
|
read_secs = 5
|
||||||
# Device Infos End
|
# Device Infos End
|
||||||
|
|
||||||
wlan = network.WLAN(network.STA_IF)
|
wlan = network.WLAN(network.STA_IF)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import time
|
import time
|
||||||
from moisture_sensor import MoistureSensor
|
from moisture_sensor import MoistureSensor
|
||||||
from dht22 import TemperatureHumiditySensor
|
from dht22 import TemperatureHumiditySensor
|
||||||
|
from ambilight_sensor import AmbilightSensor
|
||||||
from sensor_data_manager import SensorDataManager
|
from sensor_data_manager import SensorDataManager
|
||||||
from grow_system_api import GrowSystemApi
|
from grow_system_api import GrowSystemApi
|
||||||
from device_info import DeviceInfo
|
from device_info import DeviceInfo
|
||||||
|
|
@ -35,6 +36,9 @@ class GrowSystem:
|
||||||
elif sensor_type == 'dht22':
|
elif sensor_type == 'dht22':
|
||||||
print("Found sensor of type DHT22")
|
print("Found sensor of type DHT22")
|
||||||
self.sensors.append(TemperatureHumiditySensor(sensor))
|
self.sensors.append(TemperatureHumiditySensor(sensor))
|
||||||
|
elif sensor_type == 'ambilight':
|
||||||
|
print("Found sensor of type GY302/BH1750")
|
||||||
|
self.sensors.append(AmbilightSensor(sensor))
|
||||||
else:
|
else:
|
||||||
print("No sensor type configured for: " + sensor['type'])
|
print("No sensor type configured for: " + sensor['type'])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,12 @@ class Sensors:
|
||||||
# this is a parent class for the Sensor classes
|
# this is a parent class for the Sensor classes
|
||||||
sensor_pin_int = -1
|
sensor_pin_int = -1
|
||||||
|
|
||||||
|
sensor = None
|
||||||
|
|
||||||
type = "unset"
|
type = "unset"
|
||||||
|
|
||||||
def __init__(self, settings):
|
def __init__(self, settings):
|
||||||
self.type = settings['type']
|
self.type = settings['type']
|
||||||
|
print("Initialize " + self.type + " sensor. Sensor pin is: " + str(settings['pin_int']))
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue