main #3

Merged
moltox merged 15 commits from main into dev 2024-05-07 14:16:42 +00:00
3 changed files with 20 additions and 5 deletions
Showing only changes of commit e59712a7f9 - Show all commits

View File

@ -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)

View File

@ -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'])

View File

@ -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']))