User Tools

Site Tools


emrp:ws2025:agv

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
emrp:ws2025:agv [2026/02/27 04:37] 23553_students.hsrwemrp:ws2025:agv [2026/02/27 21:39] (current) – [4.5.2 Automations] 23553_students.hsrw
Line 60: Line 60:
  
   * T_in ≥ 29 °C AND T_out < T_in − 0.5%   * T_in ≥ 29 °C AND T_out < T_in − 0.5%
- 
-Stop fans when: 
- 
-  * T_in ≤ 28.5 °C 
  
 No humidity/dew point checks here. This is “save the plants” mode. No humidity/dew point checks here. This is “save the plants” mode.
Line 74: Line 70:
   * AND T_out < T_in − 0.5%   * AND T_out < T_in − 0.5%
   * AND DP_out ≤ DP_in + 1%   * AND DP_out ≤ DP_in + 1%
- 
-Stop fans when: 
-  * T_in ≤ 26.8 °C OR outside is no longer favorable 
  
 This allows cooling even if outside dew point is slightly higher, but blocks cases where outside air is much wetter. This allows cooling even if outside dew point is slightly higher, but blocks cases where outside air is much wetter.
Line 87: Line 80:
   * AND T_out ≤ 27 °C   * AND T_out ≤ 27 °C
   * AND outside air is truly drier: DP_out < DP_in − 0.7%   * AND outside air is truly drier: DP_out < DP_in − 0.7%
- 
-Stop fans when: 
-  * RH_in < 68% 
-  * OR T_out > 27 °C 
-  * OR DP_out ≥ DP_in − ΔDP (outside no longer helps) 
  
 If outside dew point is lower, exchanging air will reduce moisture even if outside is warmer. If outside dew point is lower, exchanging air will reduce moisture even if outside is warmer.
 +
 +If one of these three conditions is true for 1 minute the fans start, if they are false fo 2 minutes the fans turn off.
  
 ===== 3. Components ===== ===== 3. Components =====
Line 250: Line 240:
 </imgcaption> </imgcaption>
  
-Because the electronics enclosure is mounted on the greenhouse door while the Ethernet feed and the inside sensor cable are routed to fixed pointsboth cables are installed with sufficient slack to accommodate the door movement without putting strain on connectors or wiring.+The electronics enclosure is installed next to the greenhouse door (rather than on the door itself) and remains stationary. The Ethernet feed and the DHT11 sensors are therefore routed to this fixed mounting pointwhile only the fan wiring requires sufficient slack to accommodate the door’s movement without putting strain on the connectors or cables.
  
 ==== 4.4 Software setup ==== ==== 4.4 Software setup ====
Line 408: Line 398:
 To add automatic calculations of the dew points for inside and outside Templates are used. [S3] To add automatic calculations of the dew points for inside and outside Templates are used. [S3]
  
-Following the quickling in the Template Documentation or under ''Settings -> Devices & services -> Helpers -> + Create helper -> Template -> Sensor'' we fill in Name, State (shown below), Unit of measurement (°C), Device class (Temperature), State class (Measurement) and select our ESPHome as device. This adds a sensor we can access with ''sensor.<Name>'' that calculates the dew point.+Following the quick link in the Template Documentation or under ''Settings -> Devices & services -> Helpers -> + Create helper -> Template -> Sensor'' we fill in Name, State (shown below), Unit of measurement (°C), Device class (Temperature), State class (Measurement) and select our ESPHome as device. This adds a sensor we can access with ''sensor.<Name>'' that calculates the dew point.
  
-<file script inside dew point.txt>+<file script inside_dew_point.txt>
 {% set T = states('sensor.agv_esp32_greenhouse_inside_temperature')|float(none) %} {% set T = states('sensor.agv_esp32_greenhouse_inside_temperature')|float(none) %}
           {% set RH = states('sensor.agv_esp32_greenhouse_inside_humidity')|float(none) %}           {% set RH = states('sensor.agv_esp32_greenhouse_inside_humidity')|float(none) %}
Line 420: Line 410:
           {% else %}           {% else %}
             {{ none }}             {{ none }}
 +          {% endif %}
 +</file>
 +
 +A second template is used for checking if the control condition for venting are met. Instead of a ''Sensor'' this is a ''Binary Sensor'' with state:
 +
 +<file script should_vent.txt>
 +{% set tin  = states('sensor.agv_esp32_greenhouse_inside_temperature') | float(none) %}
 +          {% set tout = states('sensor.agv_esp32_greenhouse_outside_temperature') | float(none) %}
 +          {% set hin  = states('sensor.agv_esp32_greenhouse_inside_humidity') | float(none) %}
 +          {% set dpin  = states('sensor.greenhouse_dew_point_inside') | float(none) %}
 +          {% set dpout = states('sensor.greenhouse_dew_point_outside') | float(none) %}
 +
 +          {% if None in [tin, tout, hin, dpin, dpout] %}
 +            false
 +          {% else %}
 +            {% set dT = 0.5 %}
 +            {% set dp_max = 1.0 %}
 +            {% set dp_margin = 0.7 %}
 +
 +            {% set extreme_temp = (tin >= 29 and tout < (tin - dT)) %}
 +            {% set normal_temp  = (tin > 27 and tin < 29 and tout < (tin - dT) and dpout <= (dpin + dp_max)) %}
 +            {% set humidity     = (hin > 70 and tout <= 27 and dpout < (dpin - dp_margin)) %}
 +
 +            {{ extreme_temp or normal_temp or humidity }}
           {% endif %}           {% endif %}
 </file> </file>
Line 428: Line 442:
 === 4.5.2 Automations === === 4.5.2 Automations ===
  
-The ventilation control logic is implemented using Home Assistant automations. This includes temperature-driven ventilation and humidity-driven ventilation rules based on comparing inside vs. outside conditions.+The ventilation control logic is implemented using Home Assistant automations using the template created in the previous step.
  
 <imgcaption image12|> <imgcaption image12|>
Line 439: Line 453:
  
 The following YAML file specifies the criteria that Home Assistant uses to determine when to activate the ventilation system based on 2.2 Control concept. The following YAML file specifies the criteria that Home Assistant uses to determine when to activate the ventilation system based on 2.2 Control concept.
 +
 <file yaml automation.yaml> <file yaml automation.yaml>
-alias: Greenhouse ventilation (temp+humidity instant on, delayed off)+alias: Greenhouse Ventilation 
 +description: >- 
 +  Vent switch follows binary_sensor.greenhouse_should_vent with anti-flip-flop 
 +  delays.
 triggers: triggers:
-  - idvent_on +  - entity_id: 
-    for: "00:00:30+      - binary_sensor.greenhouse_should_vent 
-    value_template> +    to: 
-      {% set tin = +      - "on
-      states('sensor.agv_esp32_greenhouse_inside_temperature')|float(0) %} {% +    for
-      set tout = +      hours: 
-      states('sensor.agv_esp32_greenhouse_outside_temperature')|float(0) %} {% +      minutes: 1 
-      set hin = states('sensor.agv_esp32_greenhouse_inside_humidity')|float(0) +      seconds: 
-      %} {% set hout = +    trigger: state 
-      states('sensor.agv_esp32_greenhouse_outside_humidity')|float(0) %} {{ +  - entity_id: 
-        (tin > 27 and tout < 27) +      - binary_sensor.greenhouse_should_vent 
-        or +    to: 
-        (hin > 70 and hout < 70 and tout < 27) +      - "off
-      }} +    for
-    trigger: template +      hours: 
-  - idvent_off +      minutes: 2 
-    for: "00:02:00+      seconds: 
-    value_template> +    trigger: state
-      {% set tin = +
-      states('sensor.agv_esp32_greenhouse_inside_temperature')|float(0) %} {% +
-      set tout = +
-      states('sensor.agv_esp32_greenhouse_outside_temperature')|float(0) %} {% +
-      set hin = states('sensor.agv_esp32_greenhouse_inside_humidity')|float(0) +
-      %} {% set hout = +
-      states('sensor.agv_esp32_greenhouse_outside_humidity')|float(0) %} +
- +
-      {% set temp_reason_gone = (tin < 26.8) or (tout >= 27) %} {% set +
-      hum_reason_gone  = (hin < 68) or (hout >= 70) or (tout >= 27) %} +
- +
-      {{ temp_reason_gone and hum_reason_gone }} +
-    trigger: template+
 actions: actions:
-  - choose+  - target
-      - conditions: +      entity_id: switch.agv_esp32_greenhouse_ventilation 
-          - condition: trigger +    action: switch.turn_{{ trigger.to_state.state }}
-            id: vent_on +
-        sequence: +
-          - target: +
-              entity_id: switch.agv_esp32_greenhouse_ventilation +
-            action: switch.turn_on +
-      - conditions: +
-          - condition: trigger +
-            id: vent_off +
-        sequence: +
-          - target: +
-              entity_id: switch.agv_esp32_greenhouse_ventilation +
-            action: switch.turn_off+
 mode: single mode: single
 +
 </file> </file>
 +
 +To prevent the ventilation system from switching on or off due to brief sensor spikes or small fluctuations around the thresholds, the "on" conditions must be met for one minute and the "off" conditions for two minutes.
 ===== 5. Testing & Validation ===== ===== 5. Testing & Validation =====
 ==== 5.1 Test plan ==== ==== 5.1 Test plan ====
Line 522: Line 518:
   * Testing was performed in a bathroom rather than a real greenhouse, so airflow patterns, heat capacity, and leakage behavior differ significantly.   * Testing was performed in a bathroom rather than a real greenhouse, so airflow patterns, heat capacity, and leakage behavior differ significantly.
   * The controlled tests mainly covered cases where the “inside” environment was hotter and/or more humid than the “outside” reference. Conditions such as rain events, strong solar radiation, and rapid outside fluctuations were not fully represented.   * The controlled tests mainly covered cases where the “inside” environment was hotter and/or more humid than the “outside” reference. Conditions such as rain events, strong solar radiation, and rapid outside fluctuations were not fully represented.
- +  * DHT11 sensors are low accuracy, especially for humidity (often ±5% RH or worse, plus slow response).
-Sensor limitations: +
-DHT11 sensors are low accuracy, especially for humidity (often ±5% RH or worse, plus slow response).+
  
 ===== 7. Future Work Ideas ===== ===== 7. Future Work Ideas =====
emrp/ws2025/agv.1772163445.txt.gz · Last modified: 2026/02/27 04:37 by 23553_students.hsrw