From 979227916535ec9f20000b09bfdea804d221308b Mon Sep 17 00:00:00 2001
From: 3D <3d@n3rd3d.com>
Date: Sun, 18 Dec 2022 00:43:41 +0100
Subject: [PATCH] add functionality to the popcorn maker

---
 .../templates/config/esphome_popcorn.yaml     | 66 +++++++++++++++----
 1 file changed, 55 insertions(+), 11 deletions(-)

diff --git a/intern/docker_esphome/templates/config/esphome_popcorn.yaml b/intern/docker_esphome/templates/config/esphome_popcorn.yaml
index 2e1da231..fa55114a 100644
--- a/intern/docker_esphome/templates/config/esphome_popcorn.yaml
+++ b/intern/docker_esphome/templates/config/esphome_popcorn.yaml
@@ -2,6 +2,12 @@
 
 {% include "/includes/ansible.inc.yaml" %}
 {% include "/includes/board.d1_mini.inc.yaml" %}
+  on_boot:
+    priority: 250
+    then:
+      - climate.control:
+          id: pid_heater
+          mode: "OFF"
 {% include "/includes/common.inc.yaml" %}
 
 
@@ -11,34 +17,72 @@ spi:
 
 climate:
   - platform: pid
-    id: pid_climate
-    name: "PID Climate Controller"
+    id: pid_heater
+    name: "PID Heater Controller"
     sensor: pot_sensor
-    default_target_temperature: 21°C
-    heat_output: heater
+    default_target_temperature: 264
+    heat_output: pot_heater
     control_parameters:
       kp: 0.0
       ki: 0.0
       kd: 0.0
+    visual:
+      min_temperature: 0
+      max_temperature: 275
+      temperature_step: 1
 
 button:
   - platform: template
-    name: "PID Climate Autotune"
+    name: "PID Heater Autotune"
     on_press:
-      - climate.pid.autotune: pid_climate
+      - climate.pid.autotune: pid_heater
 
 sensor:
-  - platform: pid
-    name: "PID Climate Result"
-    type: RESULT
   - platform: max31855
     name: "Pot Temperature"
     id: pot_sensor
     cs_pin: GPIO15
     update_interval: 30s
+  - platform: pid
+    name: "PID Heater Result"
+    type: RESULT
+  - platform: pid
+    name: "PID PROPORTIONAL Result"
+    type: PROPORTIONAL
+  - platform: pid
+    name: "PID INTEGRAL Result"
+    type: INTEGRAL
+  - platform: pid
+    name: "PID DERIVATIVE Result"
+    type: DERIVATIVE
+  - platform: pid
+    name: "PID HEAT Result"
+    type: HEAT
 
 output:
   - platform: slow_pwm
     pin: GPIO0
-    id: heater
-    period: 15s
\ No newline at end of file
+    id: pot_heater
+    period: 15s
+
+binary_sensor:
+- platform: gpio
+  pin: 
+    number: GPIO13
+    inverted: true
+    mode:
+      input: true
+      pullup: true
+  name: "Heat Button"
+  id: heat_button
+  on_release:
+    then:
+      - climate.control:
+          id: pid_heater
+          mode: "OFF"
+  on_press:
+    then:
+      - climate.control:
+          id: pid_heater
+          mode: HEAT
+          target_temperature: 264
\ No newline at end of file
-- 
GitLab