-
-
Save adlerweb/72c4d117c8db3afc5489255a7c93ade3 to your computer and use it in GitHub Desktop.
651
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| esphome: | |
| name: backofentest | |
| friendly_name: Backofentest | |
| esp32: | |
| board: esp32dev | |
| framework: | |
| type: arduino | |
| logger: | |
| api: | |
| encryption: | |
| key: !secret backofentest_key | |
| ota: | |
| - platform: esphome | |
| password: !secret backofentest_ota | |
| wifi: | |
| ssid: !secret wifi_ssid | |
| password: !secret wifi_password | |
| ap: | |
| ssid: "Backofentest Fallback Hotspot" | |
| password: "6qNQsE6dp1TY" | |
| captive_portal: | |
| web_server: | |
| port: 80 | |
| version: 3.0 | |
| # Beware: Pin numbers must be changed. | |
| globals: | |
| - id: burner1_enabled | |
| type: bool | |
| initial_value: "false" | |
| restore_value: no | |
| - id: burner1_power | |
| type: float | |
| initial_value: "0" | |
| restore_value: no | |
| - id: fan_is_on | |
| type: bool | |
| initial_value: 'false' | |
| - id: heater_is_on | |
| type: bool | |
| initial_value: 'false' | |
| one_wire: | |
| platform: gpio | |
| pin: 1 | |
| id: onewire | |
| spi: | |
| miso_pin: 5 | |
| clk_pin: 16 | |
| sensor: | |
| - platform: max6675 | |
| name: "Temperatur Backraum" | |
| cs_pin: 17 | |
| update_interval: 1s | |
| id: temperature_stove | |
| - platform: dallas_temp | |
| id: temperature_e | |
| one_wire_id: onewire | |
| name: "Elektronik" | |
| icon: mdi:developer-board | |
| update_interval: 6s | |
| - platform: rotary_encoder | |
| pin_a: 21 | |
| pin_b: 18 | |
| name: "Encoder Platte" | |
| id: encoder_burner1 | |
| on_value: | |
| then: | |
| - lambda: |- | |
| float out = (((out = fmod(id(encoder_burner1).state, 20) - 2) < 0) ? 0 : (out > 15) ? 0 : out); | |
| ESP_LOGD("burner1", "Burner1 Normalized Encoder: %f.2", out); | |
| out = (float)0.75/15 * out; | |
| id(burner1_power) = out; | |
| ESP_LOGD("burner1", "Burner1 Target Power: %f.2", id(burner1_power)); | |
| if (id(burner1_enabled)) { | |
| auto call = id(burner1_ssr_ui).make_call(); | |
| call.set_state(true); | |
| call.set_brightness(out); | |
| call.perform(); | |
| id(relay_on).turn_on(); | |
| } else { | |
| id(relay_on).turn_off(); | |
| id(burner1_ssr_ui).turn_off(); | |
| } | |
| - platform: rotary_encoder | |
| pin_a: 26 | |
| pin_b: 27 | |
| name: "Encoder Backofen" | |
| id: encoder_oven | |
| on_value: | |
| then: | |
| - lambda: |- | |
| float out = (((out = fmod(id(encoder_burner1).state, 20) - 2) < 0) ? 0 : out); | |
| ESP_LOGD("burner1", "Oven Normalized Encoder: %f.2", out); | |
| out = (float)15 * out; | |
| if(out <= 0) { | |
| auto call = id(climate_oven).make_call(); | |
| call.set_mode("OFF"); | |
| call.target_temperature(0); | |
| call.perform(); | |
| }else{ | |
| auto call = id(climate_oven).make_call(); | |
| call.set_mode("Heat"); | |
| call.target_temperature(out); | |
| call.perform(); | |
| } | |
| - platform: template | |
| name: "Burner 1 Enabled Status" | |
| id: burner1_enabled_sensor | |
| update_interval: 1s | |
| lambda: |- | |
| return id(burner1_enabled); | |
| - platform: template | |
| name: "Burner 1 Target Power" | |
| id: burner1_target_sensor | |
| update_interval: 1s | |
| lambda: |- | |
| return id(burner1_power); | |
| binary_sensor: | |
| - platform: gpio | |
| pin: | |
| number: 19 | |
| mode: INPUT_PULLUP | |
| inverted: True | |
| name: "Taster Platte" | |
| id: switch_burner1 | |
| on_press: | |
| then: | |
| - lambda: |- | |
| // Toggle the burner state. | |
| id(burner1_enabled) = !id(burner1_enabled); | |
| ESP_LOGD("burner1", "Burner 1 enabled: %s", id(burner1_enabled) ? "true" : "false"); | |
| float duty = 0.0; | |
| if (id(burner1_enabled)) { | |
| duty = id(burner1_power); | |
| } | |
| ESP_LOGD("burner1", "Burner 1 power: %f.2", duty); | |
| if (duty > 0.0) { | |
| id(relay_on).turn_on(); | |
| auto call = id(burner1_ssr_ui).make_call(); | |
| call.set_state(true); | |
| call.set_brightness(duty); | |
| call.perform(); | |
| } else { | |
| id(relay_on).turn_off(); | |
| id(burner1_ssr_ui).turn_off(); | |
| } | |
| - platform: template | |
| name: "Lüfter Elektronik" | |
| id: relay_fan_e_state | |
| icon: mdi:fan | |
| lambda: |- | |
| return id(fan_is_on); | |
| - platform: template | |
| name: "Heizung ein" | |
| id: heater_state | |
| icon: mdi:gas-burner | |
| lambda: |- | |
| return id(heater_is_on); | |
| output: | |
| - platform: slow_pwm | |
| pin: 23 | |
| period: 20s | |
| id: ssr_burner1 | |
| - platform: gpio | |
| id: heater | |
| pin: 4 | |
| - platform: gpio | |
| pin: 2 | |
| id: relay_fan_e | |
| switch: | |
| - platform: gpio | |
| pin: 22 | |
| name: "Relay Betrieb" | |
| id: relay_on | |
| icon: mdi:stove | |
| - platform: template | |
| name: "Fan Manual Override" | |
| id: fan_manual_override | |
| turn_on_action: # This is the correct way to define actions for a template switch | |
| - output.turn_on: relay_fan_e | |
| - globals.set: | |
| id: fan_is_on | |
| value: 'true' | |
| turn_off_action: # This is the correct way to define actions for a template switch | |
| - lambda: |- | |
| // When manual override is turned OFF, apply the automatic logic | |
| if (id(temperature_stove).state > 35 || id(temperature_e).state > 35 || id(climate_oven).mode == climate::CLIMATE_MODE_HEAT) { | |
| if (!id(fan_is_on)) { | |
| id(relay_fan_e).turn_on(); | |
| id(fan_is_on) = true; | |
| } | |
| } else { | |
| if (id(fan_is_on)) { | |
| id(relay_fan_e).turn_off(); | |
| id(fan_is_on) = false; | |
| } | |
| } | |
| interval: | |
| - interval: 10s | |
| then: | |
| - lambda: |- | |
| if (id(fan_manual_override).state) { | |
| // No action needed here as the manual override takes precedence. | |
| } else { | |
| // Automatic control | |
| if (id(temperature_stove).state > 35 || id(temperature_e).state > 35 || id(climate_oven).mode == climate::CLIMATE_MODE_HEAT) { | |
| if (!id(fan_is_on)) { | |
| id(relay_fan_e).turn_on(); | |
| id(fan_is_on) = true; | |
| } | |
| } else { | |
| if (id(fan_is_on)) { | |
| id(relay_fan_e).turn_off(); | |
| id(fan_is_on) = false; | |
| } | |
| } | |
| } | |
| light: | |
| - platform: monochromatic | |
| output: ssr_burner1 | |
| name: "Burner 1 SSR" | |
| id: burner1_ssr_ui | |
| icon: mdi:gas-burner | |
| climate: | |
| - platform: thermostat | |
| name: "Backofen" | |
| id: climate_oven | |
| sensor: temperature_stove | |
| heat_action: | |
| - output.turn_on: heater | |
| - globals.set: | |
| id: heater_is_on | |
| value: 'true' | |
| idle_action: | |
| - output.turn_off: heater | |
| - globals.set: | |
| id: heater_is_on | |
| value: 'false' | |
| min_idle_time: 20s | |
| min_heating_off_time: 20s | |
| min_heating_run_time: 10s | |
| visual: | |
| min_temperature: 0 | |
| max_temperature: 250 | |
| temperature_step: | |
| target_temperature: 5 | |
| current_temperature: 0.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment