34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
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)
|
|
|
|
# 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
|
|
|
|
# Should lights change when a certain time in the schedule is reached
|
|
ENABLE_SCHEDULE_TRIGGERS = (
|
|
False # Not working correctly at the moment, so turned off by default
|
|
)
|
|
|
|
# Schedule (Key is time after scene should be used. Value is scene name to be used.)
|
|
# Needs to be sorted chronologically
|
|
SCHEDULE: dict[time, str] = {}
|
|
|
|
# Philips Hue configuration
|
|
hue_conf = {
|
|
"bridge_ip": "",
|
|
"transition_time": 10, # seconds
|
|
"light_group": "",
|
|
# If file exists, application is considered 'registered' at the bridge
|
|
"registered_file": "smart_light_registered.bridge",
|
|
} # Custom configuration for philips hue
|
|
|
|
sensor = VL53L1XSensor()
|
|
|
|
counter: PeopleCounter = PeopleCounter(sensor, MAX_TRIGGER_DISTANCE) # Sensor object
|