add ambilight sensor class
This commit is contained in:
parent
b36b1b3c90
commit
e59712a7f9
|
|
@ -19,12 +19,20 @@ class DeviceInfo:
|
|||
'pin_int': 26
|
||||
},
|
||||
{
|
||||
'type': 'dht22',
|
||||
'pin_int': 15
|
||||
}
|
||||
'type': 'ambilight',
|
||||
'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
|
||||
|
||||
wlan = network.WLAN(network.STA_IF)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import time
|
||||
from moisture_sensor import MoistureSensor
|
||||
from dht22 import TemperatureHumiditySensor
|
||||
from ambilight_sensor import AmbilightSensor
|
||||
from sensor_data_manager import SensorDataManager
|
||||
from grow_system_api import GrowSystemApi
|
||||
from device_info import DeviceInfo
|
||||
|
|
@ -35,6 +36,9 @@ class GrowSystem:
|
|||
elif sensor_type == 'dht22':
|
||||
print("Found sensor of type DHT22")
|
||||
self.sensors.append(TemperatureHumiditySensor(sensor))
|
||||
elif sensor_type == 'ambilight':
|
||||
print("Found sensor of type GY302/BH1750")
|
||||
self.sensors.append(AmbilightSensor(sensor))
|
||||
else:
|
||||
print("No sensor type configured for: " + sensor['type'])
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,12 @@ class Sensors:
|
|||
# this is a parent class for the Sensor classes
|
||||
sensor_pin_int = -1
|
||||
|
||||
sensor = None
|
||||
|
||||
type = "unset"
|
||||
|
||||
def __init__(self, settings):
|
||||
self.type = settings['type']
|
||||
print("Initialize " + self.type + " sensor. Sensor pin is: " + str(settings['pin_int']))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue