From 654b6ee6fc496ee1f20ab5e6fa5f9b360c4dcc87 Mon Sep 17 00:00:00 2001 From: 3D <3d@n3rd3d.com> Date: Fri, 23 Dec 2022 01:39:41 +0100 Subject: [PATCH] change pins and add functions to popcorn --- .../templates/config/esphome_popcorn.yaml | 176 +++++++++++++++--- 1 file changed, 147 insertions(+), 29 deletions(-) diff --git a/intern/docker_esphome/templates/config/esphome_popcorn.yaml b/intern/docker_esphome/templates/config/esphome_popcorn.yaml index 68c0b90e..f8780efa 100644 --- a/intern/docker_esphome/templates/config/esphome_popcorn.yaml +++ b/intern/docker_esphome/templates/config/esphome_popcorn.yaml @@ -1,5 +1,88 @@ {% set devicename = "esphome_popcorn" %} +on_boot: + - priority: 600 + then: + - display.page.show: page1 + - priority: 250 + then: + - light.addressable_set: + id: status_led + range_from: 0 + range_to: 2 + red: 0% + green: 100% + blue: 0% + - priority: -100 + then: + - if: + condition: + binary_sensor.is_on: heat_button + then: + - light.addressable_set: + id: status_led + range_from: 1 + range_to: 1 + red: 100% + green: 0% + blue: 0% + - if: + condition: + binary_sensor.is_off: heat_button + then: + - light.addressable_set: + id: status_led + range_from: 1 + range_to: 1 + red: 0% + green: 0% + blue: 0% + - if: + condition: + binary_sensor.is_on: turn_button + then: + - light.addressable_set: + id: status_led + range_from: 2 + range_to: 2 + red: 100% + green: 0% + blue: 0% + - if: + condition: + binary_sensor.is_off: turn_button + then: + - light.addressable_set: + id: status_led + range_from: 2 + range_to: 2 + red: 0% + green: 0% + blue: 0% + - if: + condition: + binary_sensor.is_on: warmlight_button + then: + - light.addressable_set: + id: status_led + range_from: 0 + range_to: 0 + red: 100% + green: 0% + blue: 0% + - if: + condition: + binary_sensor.is_off: warmlight_button + then: + - light.addressable_set: + id: status_led + range_from: 0 + range_to: 0 + red: 0% + green: 0% + blue: 0% + - display.page.show: page3 + {% include "/includes/ansible.inc.yaml" %} {% include "/includes/board.esp32-doit-devkit-v1.inc.yaml" %} @@ -52,11 +135,6 @@ climate: kp: 0.49460 ki: 0.00487 kd: 12.56301 - output_averaging_samples: 5 # smooth the output over 5 samples - derivative_averaging_samples: 5 # smooth the derivative value over 10 samples - deadband_parameters: - threshold_high: 1°C # deadband within +/-1°C of target_temperature - threshold_low: -1°C visual: min_temperature: 0 max_temperature: 275 @@ -123,12 +201,22 @@ sensor: output: - platform: slow_pwm - pin: GPIO33 + pin: GPIO12 id: pot_heater period: 15s - platform: ledc pin: GPIO3 - id: gpio_4_backlight_pwm + id: backlight_pwm + +switch: + - platform: gpio + pin: GPIO15 + name: "TurnMotor" + id: turnmotor + - platform: gpio + pin: GPIO4 + name: "WarmLight" + id: warmlight binary_sensor: - platform: gpio @@ -147,18 +235,36 @@ binary_sensor: mode: "OFF" - light.addressable_set: id: status_led - range_from: 0 - range_to: 0 + range_from: 1 + range_to: 1 red: 0% green: 0% blue: 0% + on_press: + then: + - climate.control: + id: pid_heater + mode: HEAT + target_temperature: 264 - light.addressable_set: id: status_led range_from: 1 range_to: 1 - red: 0% + red: 100% green: 0% blue: 0% +- platform: gpio + pin: + number: GPIO33 + inverted: true + mode: + input: true + pullup: true + name: "Turn Button" + id: turn_button + on_release: + then: + - switch.turn_off: turnmotor - light.addressable_set: id: status_led range_from: 2 @@ -168,31 +274,43 @@ binary_sensor: blue: 0% on_press: then: - - climate.control: - id: pid_heater - mode: HEAT - target_temperature: 264 + - switch.turn_on: turnmotor + - light.addressable_set: + id: status_led + range_from: 2 + range_to: 2 + red: 100% + green: 0% + blue: 0% +- platform: gpio + pin: + number: GPIO19 + inverted: true + mode: + input: true + pullup: true + name: "WarmLight Button" + id: warmlight_button + on_release: + then: + - switch.turn_off: warmlight - light.addressable_set: id: status_led range_from: 0 range_to: 0 red: 0% green: 0% - blue: 100% + blue: 0% + on_press: + then: + - switch.turn_on: warmlight - light.addressable_set: id: status_led - range_from: 1 - range_to: 1 + range_from: 0 + range_to: 0 red: 100% green: 0% blue: 0% - - light.addressable_set: - id: status_led - range_from: 2 - range_to: 2 - red: 0% - green: 100% - blue: 0% font: - file: "gfonts://Roboto" @@ -257,9 +375,9 @@ time: light: - platform: monochromatic - output: gpio_4_backlight_pwm + output: backlight_pwm name: "ILI9341 Display Backlight" - id: back_light + id: backlight restore_mode: ALWAYS_ON internal: True - platform: fastled_spi @@ -271,6 +389,7 @@ light: num_leds: 3 name: "NeoPixel Light" internal: True + restore_mode: ALWAYS_OFF effects: - addressable_color_wipe: name: BootUp @@ -283,7 +402,7 @@ light: green: 0% blue: 0% num_leds: 3 - add_led_interval: 500ms + add_led_interval: 100ms reverse: False text_sensor: @@ -304,5 +423,4 @@ text_sensor: else { return {"ERROR see Display"}; } - update_interval: 5s - \ No newline at end of file + update_interval: 5s \ No newline at end of file -- GitLab