2019-12-30 21:30:13 +00:00
|
|
|
substitutions:
|
|
|
|
device_id: coffee_maker
|
|
|
|
device_name: Coffee Maker
|
|
|
|
platform: ESP8266
|
|
|
|
board: nodemcuv2
|
2019-12-31 01:44:42 +00:00
|
|
|
ip_address: !secret coffee_maker_ip
|
|
|
|
ota_pwd: !secret coffee_maker_ota_pwd
|
|
|
|
api_pwd: !secret coffee_maker_api_pwd
|
|
|
|
ap_wifi_pwd: !secret coffee_maker_ap_wifi_pwd
|
2019-12-30 21:30:13 +00:00
|
|
|
|
|
|
|
esphome:
|
|
|
|
<<: !include common/esphome.yaml
|
|
|
|
|
|
|
|
<<: !include common/common.yaml
|
2020-02-14 02:59:08 +00:00
|
|
|
<<: !include common/logger/logger_none.yaml
|
2019-12-30 21:30:13 +00:00
|
|
|
|
|
|
|
binary_sensor:
|
2019-12-31 01:44:42 +00:00
|
|
|
- !include common/binary_sensor/status.yaml
|
2019-12-30 21:30:13 +00:00
|
|
|
- platform: gpio
|
|
|
|
id: power_light
|
|
|
|
pin:
|
|
|
|
number: D5
|
|
|
|
mode: INPUT
|
|
|
|
inverted: True
|
|
|
|
filters:
|
|
|
|
- delayed_on: 50ms
|
|
|
|
- delayed_off: 50ms
|
|
|
|
- platform: gpio
|
|
|
|
id: bold_light
|
|
|
|
pin:
|
|
|
|
number: D6
|
|
|
|
mode: INPUT
|
|
|
|
inverted: True
|
|
|
|
filters:
|
|
|
|
- delayed_on: 50ms
|
|
|
|
- delayed_off: 50ms
|
|
|
|
|
|
|
|
interval:
|
|
|
|
- interval: 1s
|
|
|
|
then:
|
|
|
|
- lambda: |-
|
|
|
|
// Coffee tastes better if allowed to "bloom" (wet the coffee and then let it sit for 30 seconds to release any trapped CO2 before completing brewing)
|
|
|
|
// This logic automates this process regardless of how the coffee maker was turned on
|
|
|
|
static int brewStage = 0; // 0=Off, 1=Pre-Wet, 2=Bloom, 3=Brew
|
|
|
|
static unsigned long brewStageChange = 0;
|
|
|
|
static bool isBoldBrew = false;
|
|
|
|
|
|
|
|
// Coffee maker was off but now is on so it is in the pre-wet stage
|
|
|
|
if (id(power_switch).state && brewStage == 0) {
|
|
|
|
brewStage = 1; //Pre-Wet
|
|
|
|
brewStageChange = millis() + 75000;
|
|
|
|
isBoldBrew = id(bold_switch).state;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Coffee should be wet now so turn off and let it bloom
|
|
|
|
else if (id(power_switch).state && brewStage == 1 && millis() >= brewStageChange) {
|
|
|
|
id(power_switch).turn_off();
|
|
|
|
brewStage = 2; //Bloom
|
|
|
|
brewStageChange = millis() + 45000;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Coffee has bloomed so turn back on to finish brewing
|
|
|
|
else if (!id(power_switch).state && brewStage == 2 && millis() >= brewStageChange) {
|
|
|
|
if (isBoldBrew && !id(bold_switch).state) {
|
|
|
|
id(bold_switch).turn_on();
|
|
|
|
}
|
|
|
|
id(power_switch).turn_on();
|
|
|
|
brewStage = 3; //Brew
|
|
|
|
}
|
|
|
|
|
|
|
|
// Manually powered off during Pre-Wet stage
|
|
|
|
else if (!id(power_switch).state && brewStage == 1) {
|
|
|
|
brewStage = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Manualy powered on during Bloom stage
|
|
|
|
else if (id(power_switch).state && brewStage == 2) {
|
|
|
|
brewStage = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Done brewing
|
|
|
|
else if (!id(power_switch).state && brewStage == 3) {
|
|
|
|
brewStage = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
sensor:
|
2019-12-31 01:44:42 +00:00
|
|
|
- !include common/sensor/uptime.yaml
|
|
|
|
- !include common/sensor/wifi.yaml
|
2019-12-30 21:30:13 +00:00
|
|
|
|
|
|
|
switch:
|
2019-12-31 01:44:42 +00:00
|
|
|
- !include common/switch/restart.yaml
|
2019-12-30 21:30:13 +00:00
|
|
|
- platform: template
|
|
|
|
id: power_switch
|
|
|
|
name: "Coffee Maker"
|
2019-12-31 01:44:42 +00:00
|
|
|
icon: mdi:coffee
|
2019-12-30 21:30:13 +00:00
|
|
|
lambda: 'return id(power_light).state;'
|
|
|
|
turn_on_action:
|
|
|
|
then:
|
|
|
|
- lambda: |-
|
|
|
|
if (!id(power_light).state) {
|
|
|
|
id(power_switch_physical).turn_on();
|
|
|
|
delay(200);
|
|
|
|
id(power_switch_physical).turn_off();
|
|
|
|
delay(100);
|
|
|
|
}
|
|
|
|
turn_off_action:
|
|
|
|
then:
|
|
|
|
- lambda: |-
|
|
|
|
if (id(power_light).state) {
|
|
|
|
id(power_switch_physical).turn_on();
|
|
|
|
delay(200);
|
|
|
|
id(power_switch_physical).turn_off();
|
|
|
|
delay(100);
|
|
|
|
}
|
|
|
|
- platform: gpio
|
|
|
|
id: power_switch_physical
|
|
|
|
pin: D0
|
|
|
|
inverted: true
|
|
|
|
- platform: template
|
|
|
|
id: bold_switch
|
|
|
|
name: "Coffee Maker Bold Setting"
|
2019-12-31 01:44:42 +00:00
|
|
|
icon: mdi:coffee
|
2019-12-30 21:30:13 +00:00
|
|
|
lambda: 'return id(bold_light).state;'
|
|
|
|
turn_on_action:
|
|
|
|
then:
|
|
|
|
- lambda: |-
|
|
|
|
if (!id(bold_light).state) {
|
|
|
|
id(bold_switch_physical).turn_on();
|
|
|
|
delay(200);
|
|
|
|
id(bold_switch_physical).turn_off();
|
|
|
|
delay(100);
|
|
|
|
}
|
|
|
|
turn_off_action:
|
|
|
|
then:
|
|
|
|
- lambda: |-
|
|
|
|
if (id(bold_light).state) {
|
|
|
|
id(bold_switch_physical).turn_on();
|
|
|
|
delay(200);
|
|
|
|
id(bold_switch_physical).turn_off();
|
|
|
|
delay(100);
|
|
|
|
}
|
|
|
|
- platform: gpio
|
|
|
|
id: bold_switch_physical
|
|
|
|
pin: D1
|
|
|
|
inverted: true
|
|
|
|
|
|
|
|
text_sensor:
|
2019-12-31 01:44:42 +00:00
|
|
|
- !include common/text_sensor/version.yaml
|
|
|
|
- !include common/text_sensor/wifi.yaml
|