Added some extra counter settings to setup.py

This commit is contained in:
Maximilian Giller 2023-11-25 17:12:32 +01:00
parent 16ebe4a670
commit 23d2add388
4 changed files with 12 additions and 9 deletions

View file

@ -1,8 +1,7 @@
from sensors.people_counter import PeopleCounter
import logging
from setup import sensor
from setup import counter
counter = PeopleCounter(sensor)
peopleCount = 0

View file

@ -1,10 +1,12 @@
from sensors import VL53L1XSensor, VL53L3CXSensor
from sensors import VL53L1XSensor, VL53L3CXSensor, PeopleCounter
from datetime import time
import logging
LOG_FILE_PATH = "log.txt" # Path for logs
logging.getLogger().setLevel(logging.INFO)
sensor = VL53L3CXSensor()
# If the distance (in cm) is lower or equal to this value, the people counter will trigger
MAX_TRIGGER_DISTANCE = 110
# Should lights already turn on where there is any kind of motion in the sensor
ENABLE_MOTION_TRIGGERED_LIGHT = True
@ -26,3 +28,7 @@ hue_conf = {
# If file exists, application is considered 'registered' at the bridge
"registered_file": "smart_light_registered.bridge",
} # Custom configuration for philips hue
sensor = VL53L3CXSensor()
counter: PeopleCounter = PeopleCounter(sensor, MAX_TRIGGER_DISTANCE) # Sensor object

View file

@ -3,11 +3,10 @@ from services.philips_hue import PhilipsHue
from sensors.people_counter import PeopleCounter
import logging
import json
from setup import sensor, hue_conf, LOG_FILE_PATH
from setup import hue_conf, LOG_FILE_PATH, counter
hue: PhilipsHue = PhilipsHue(hue_conf) # Light interface
counter: PeopleCounter = PeopleCounter(sensor) # Sensor object
peopleCount: int = 0 # Global count of people on the inside

View file

@ -1,15 +1,14 @@
from datetime import datetime, time, timedelta
from typing import Optional
from services.philips_hue import PhilipsHue
from sensors import PeopleCounter, Directions, VL53L1XSensor
from sensors import Directions
import logging
import json
from timeloop import Timeloop
from setup import sensor, hue_conf, LOG_FILE_PATH, SCHEDULE, ENABLE_SCHEDULE_TRIGGERS
from setup import hue_conf, LOG_FILE_PATH, SCHEDULE, ENABLE_SCHEDULE_TRIGGERS, counter
hue: PhilipsHue = PhilipsHue(hue_conf) # Light interface
counter: PeopleCounter = PeopleCounter(sensor) # Sensor object
peopleCount: int = 0 # Global count of people on the inside
motion_triggered_lights = False # Is light on because of any detected motion
timeloop: Timeloop = Timeloop() # Used for time triggered schedule