Files
demeter/esp/config.py

59 lines
1.9 KiB
Python

"""
Demeter ESP Sensor Node - Configuration
Edit this file for your specific deployment.
"""
# ── WiFi ──
WIFI_SSID = "YourSSID"
WIFI_PASS = "YourPassword"
# ── Device Identity ──
# Unique ID for this device (used in CoAP payloads and server registry)
DEVICE_ID = "esp32-plant-01"
FIRMWARE_VERSION = "0.1.0"
# ── CoAP Server ──
COAP_PORT = 5683
# ── Sensor Configuration ──
# Set pin numbers according to your wiring. Set to None to disable a sensor.
# Analog soil moisture sensor (capacitive recommended)
# Reads 0-4095 on ESP32 ADC, mapped to 0-100%
SOIL_MOISTURE_PIN = 34 # ADC1 channel (GPIO 34)
SOIL_MOISTURE_DRY = 3200 # ADC reading when completely dry
SOIL_MOISTURE_WET = 1400 # ADC reading when fully saturated
# Temperature sensor (DS18B20 OneWire or DHT22)
# Set TEMP_SENSOR_TYPE to "ds18b20" or "dht22"
TEMP_SENSOR_PIN = 4
TEMP_SENSOR_TYPE = "dht22" # "ds18b20" or "dht22"
# Water level sensor (analog)
WATER_LEVEL_PIN = 35 # ADC1 channel (GPIO 35)
WATER_LEVEL_MIN = 0 # ADC reading at minimum
WATER_LEVEL_MAX = 4095 # ADC reading at maximum
# Digital trigger input (e.g., float switch, door sensor)
TRIGGER_PIN = 5 # GPIO with internal pullup
TRIGGER_EDGE = "falling" # "rising", "falling", or "both"
# ── Timing ──
# Interval between sensor readings (seconds)
DEFAULT_POLL_INTERVAL = 30
# Observe notification: only send if value changed by more than threshold
SOIL_MOISTURE_THRESHOLD = 2.0 # percent
TEMPERATURE_THRESHOLD = 0.5 # degrees C
WATER_LEVEL_THRESHOLD = 2.0 # percent
# Max-Age for Observe notifications (seconds)
# Tells the observer how long the value is considered fresh
OBSERVE_MAX_AGE = 60
# ── Deep Sleep (for battery-operated nodes) ──
# Set to True for battery operation (disables Observe server, uses push model)
DEEP_SLEEP_ENABLED = False
DEEP_SLEEP_SECONDS = 300 # 5 minutes