Error handling on system boot (#30)

Implements #3

Reviewed-on: #30
Co-authored-by: localhorst <localhorst@mosad.xyz>
Co-committed-by: localhorst <localhorst@mosad.xyz>
This commit was merged in pull request #30.
This commit is contained in:
2026-05-10 12:39:47 +02:00
committed by Hendrik Schutter
parent 085f5b4acb
commit a7d577a948
16 changed files with 930 additions and 399 deletions
+71 -97
View File
@@ -1,83 +1,41 @@
# smart-oil-heating-control-system
# Smart Oil Heating Control System
## Software
### Design
ESP32-based control system for oil-fired central heating with schedule-based temperature management, safety monitoring, and Prometheus metrics export.
## Features
- **Schedule Control**: Day/night temperature targets per weekday
- **Summer Mode**: Automatic heating disable based on outdoor temperature
- **Safety Monitoring**: Sensor sanity checks with automatic safe-state fallback
- **Prometheus Metrics**: HTTP endpoint at port 9100
## System Overview
```mermaid
classDiagram
Inputs <|-- Control
Outputs <|-- Control
Sntp <|-- Control
Inputs <|-- Safety
Outputs <|--|> Safety
flowchart TB
subgraph OUTSIDE[" "]
OT[/"🌡️ Outdoor Temp<br/>DS18B20"/]
end
Inputs <|-- Metrics
Outputs <|-- Metrics
Control <|-- Metrics
Safety <|-- Metrics
Sntp <|-- Metrics
subgraph BURNER["OIL BURNER"]
CT[/"🌡️ Chamber Temp<br/>DS18B20"/]
BF[["⚠️ Burner Fault<br/>GPIO19 INPUT"]]
BR(["🔥 Burner Relay<br/>GPIO14"])
SC(["🔌 Safety Contact<br/>GPIO12"])
end
class Inputs{
+initInputs()
-initMeasurement()
-updateAverage()
-updatePrediction()
-taskInput()
-linearRegressionPredict()
+getChamberTemperature()
+getOutdoorTemperature()
+getInletFlowTemperature()
+getReturnFlowTemperature()
+getBurnerError()
}
subgraph CIRCUIT["HEATING CIRCUIT"]
IT[/"🌡️ Inlet Temp<br/>DS18B20"/]
CP(["💧 Circulation Pump<br/>GPIO27"])
RT[/"🌡️ Return Temp<br/>DS18B20"/]
end
class Outputs{
+initOutputs()
+getCirculationPumpState()
+setCirculationPumpState()
+getBurnerState()
+setBurnerState()
+getSafetyControlState()
+setSafetyControlState()
}
RAD["🏠 Radiators"]
class Control{
initControl()
+taskControl()
+getControlCurrentWeekday()
-findControlCurrentTemperatureEntry()
+getControlCurrentTemperatureEntry()
-controlTable
+getControlState()
}
class Safety{
+initSafety()
-taskSafety()
-setSafeState()
-checkSensorSanity()
+getSensorSanityStates()
+getSafetyState()
}
class Wifi{
+initWifi()
}
class Sntp{
+initSntp()
+getSntpState()
}
class Metrics{
+initMetrics()
-taskMetrics()
-metrics
+event_handler()
+connect_wifi()
+setMetrics()
}
BURNER -->|"hot water"| IT
IT --> CP
CP --> RAD
RAD --> RT
RT -->|"cold water"| BURNER
```
### Prometheus Metrics
@@ -88,26 +46,26 @@ burner_fault_pending 1
circulation_pump_enabled 1
burner_enabled 0
safety_contact_enabled 1
chamber_temperature 37.250000
chamber_temperature_avg10 37.237499
chamber_temperature_avg60 37.438541
chamber_temperature_damped 42.185040
chamber_temperature_pred60 36.638443
inlet_flow_temperature 35.625000
inlet_flow_temperature_avg10 35.618752
inlet_flow_temperature_avg60 35.415627
inlet_flow_temperature_damped 39.431259
inlet_flow_temperature_pred60 36.078678
outdoor_temperature 14.687500
outdoor_temperature_avg10 14.662500
outdoor_temperature_avg60 14.646875
outdoor_temperature_damped 9.169084
outdoor_temperature_pred60 14.660233
return_flow_temperature 39.937500
return_flow_temperature_avg10 40.087502
return_flow_temperature_avg60 41.146873
return_flow_temperature_damped 32.385151
return_flow_temperature_pred60 37.311958
chamber_temperature 37.312500
chamber_temperature_avg10 37.393749
chamber_temperature_avg60 37.689583
chamber_temperature_damped 38.058098
chamber_temperature_pred60 36.697266
inlet_flow_temperature 34.562500
inlet_flow_temperature_avg10 34.587502
inlet_flow_temperature_avg60 34.880207
inlet_flow_temperature_damped 35.255993
inlet_flow_temperature_pred60 33.910374
outdoor_temperature 1.812500
outdoor_temperature_avg10 1.825000
outdoor_temperature_avg60 1.821875
outdoor_temperature_damped 2.390663
outdoor_temperature_pred60 1.840263
return_flow_temperature 34.125000
return_flow_temperature_avg10 34.162498
return_flow_temperature_avg60 34.304165
return_flow_temperature_damped 31.430506
return_flow_temperature_pred60 33.858772
chamber_temperature_state 0
outdoor_temperature_state 0
inlet_flow_temperature_state 0
@@ -115,13 +73,13 @@ return_flow_temperature_state 0
safety_state 0
control_state 3
control_current_weekday 5
control_current_entry_time 17100
control_current_entry_time 24300
control_current_entry_chamber_temperature 80.000000
control_current_entry_return_flow_temperature 30.000000
sntp_state 0
system_unixtime 1762012743
uptime_seconds 465229
wifi_rssi -72
system_unixtime 1768067412
uptime_seconds 344878
wifi_rssi -59
```
#### Status Encoding
@@ -180,4 +138,20 @@ wifi_rssi -72
| Input Burner Fault | IO19 | Digital Input IN1 |
| Input Temperature DS10B20 | IO04 | 1-Wire |
## Configuration
All parameters configurable via `idf.py menuconfig`:
- WiFi credentials and static IP
- GPIO pin assignments
- 1-Wire sensor addresses
- Temperature thresholds and limits
- Heating schedule (day/night per weekday)
- Damping factors
## Building
```bash
idf.py set-target esp32
idf.py menuconfig # Configure settings
idf.py build flash monitor
```