esphome:
name: philips-sniffer-3347
on_boot:
priority: 900
then:
- output.turn_off: display_trip
- delay: 350ms
- output.turn_on: display_trip
- delay: 1200ms
- output.turn_off: display_trip
- delay: 200ms
- output.turn_on: display_trip
esp8266:
board: d1_mini
logger:
baud_rate: 0
level: NONE
api:
ota:
- platform: esphome
wifi:
ssid: "Bakro 4G"
password: "Bakro@JW"
ap: {}
captive_portal:
external_components:
- source:
type: local
path: ./components
uart:
# Mainboard side
- id: uart_mainboard
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 115200
# Display side
- id: uart_display
tx_pin: GPIO15
rx_pin: GPIO13
baud_rate: 115200
philips_coffee_machine:
id: coffee_machine
display_uart: uart_display
mainboard_uart: uart_mainboard
power_pin: GPIO16
invert_power_pin: false
model: EP_3243
globals:
- id: last_drink
type: std::string
restore_value: no
initial_value: '"N/A"'
text_sensor:
- platform: philips_coffee_machine
controller_id: coffee_machine
id: status
name: "Status"
- platform: template
id: selected_drink
name: "Selected Drink"
update_interval: 1s
lambda: |-
std::string s = id(status).state;
std::string lower = s;
for (auto &c : lower) c = (char) tolower((unsigned char) c);
if (lower.find("iced coffee") != std::string::npos) return {"Iced Coffee"};
if (lower.find("latte") != std::string::npos) return {"Latte Macchiato"};
if (lower.find("cappuccino") != std::string::npos) return {"Cappuccino"};
if (lower.find("hot water") != std::string::npos) return {"Hot Water"};
if (lower.find("americano") != std::string::npos) return {"Americano"};
if (lower.find("espresso") != std::string::npos) return {"Espresso"};
if (lower.find("coffee") != std::string::npos) return {"Coffee"};
if (lower == "off") return {"Off"};
if (lower == "idle") return {"Idle"};
if (id(last_drink).empty()) return {"N/A"};
return {id(last_drink)};
- platform: template
id: selected_cup_size
name: "Selected Cup Size"
update_interval: 1s
lambda: |-
std::string d = id(selected_drink).state;
if (d == "Espresso" || d == "Coffee" || d == "Iced Coffee" ||
d == "Cappuccino" || d == "Latte Macchiato" || d == "Americano" ||
d == "Hot Water") {
int v = (int) id(cup_size_state).state;
if (v >= 1 && v <= 3) return {to_string(v)};
}
return {"N/A"};
- platform: template
id: selected_intensity
name: "Selected Intensity"
update_interval: 1s
lambda: |-
std::string d = id(selected_drink).state;
if (d == "Hot Water" || d == "Off" || d == "Idle" || d == "N/A")
return {"N/A"};
int v = (int) id(bean_strength_state).state;
if (v >= 1 && v <= 3) return {to_string(v)};
return {"N/A"};
- platform: template
id: selected_milk
name: "Selected Milk"
update_interval: 1s
lambda: |-
std::string d = id(selected_drink).state;
if (d == "Cappuccino" || d == "Latte Macchiato") {
int v = (int) id(milk_foam_state).state;
if (v >= 1 && v <= 3) return {to_string(v)};
}
return {"N/A"};
- platform: template
name: "Selection Summary"
update_interval: 1s
lambda: |-
std::string out = "Drink: " + id(selected_drink).state +
" | Size: " + id(selected_cup_size).state +
" | Intensity: " + id(selected_intensity).state +
" | Milk: " + id(selected_milk).state;
return {out};
number:
- platform: philips_coffee_machine
controller_id: coffee_machine
status_sensor_id: status
id: cup_size_state
type: SIZE
source: ANY
name: "Cup Size State"
- platform: philips_coffee_machine
controller_id: coffee_machine
status_sensor_id: status
id: bean_strength_state
type: BEAN
source: ANY
name: "Bean Strength State"
- platform: philips_coffee_machine
controller_id: coffee_machine
status_sensor_id: status
id: milk_foam_state
type: MILK
source: ANY
name: "Milk Foam State"
script:
- id: apply_max_defaults
then:
- delay: 150ms
- number.set:
id: cup_size_state
value: 3
- delay: 150ms
- number.set:
id: bean_strength_state
value: 3
- delay: 150ms
- number.set:
id: milk_foam_state
value: 3
button:
- platform: template
name: "Recover Display"
on_press:
- output.turn_off: display_trip
- delay: 300ms
- output.turn_on: display_trip
- delay: 800ms
- output.turn_off: display_trip
- delay: 200ms
- output.turn_on: display_trip
- platform: template
name: "Power On"
on_press:
- repeat:
count: 20
then:
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x0A, 0x01, 0x05, 0x01, 0x17, 0x00, 0x00, 0x00, 0x32, 0x23]
- repeat:
count: 20
then:
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x01, 0x01, 0x05, 0x01, 0x17, 0x00, 0x00, 0x00, 0x19, 0x16]
- output.turn_off: display_trip
- delay: 800ms
- output.turn_on: display_trip
- platform: template
name: "Power Off"
on_press:
- repeat:
count: 20
then:
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x00, 0x01, 0x05, 0x01, 0x17, 0x01, 0x00, 0x00, 0x21, 0x0A]
- platform: template
name: "Start Pause"
on_press:
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x00, 0x01, 0x05, 0x01, 0x17, 0x00, 0x00, 0x01, 0x25, 0x03]
- platform: template
name: "Espresso"
on_press:
- lambda: |-
id(last_drink) = "Espresso";
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x00, 0x01, 0x05, 0x01, 0x17, 0x02, 0x00, 0x00, 0x35, 0x1C]
- script.execute: apply_max_defaults
- platform: template
name: "Coffee"
on_press:
- lambda: |-
id(last_drink) = "Coffee";
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x00, 0x01, 0x05, 0x01, 0x17, 0x08, 0x00, 0x00, 0x05, 0x2D]
- script.execute: apply_max_defaults
- platform: template
name: "Iced Coffee"
on_press:
- lambda: |-
id(last_drink) = "Iced Coffee";
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x00, 0x01, 0x05, 0x01, 0x17, 0x20, 0x00, 0x00, 0x1C, 0x26]
- script.execute: apply_max_defaults
- platform: template
name: "Cappuccino"
on_press:
- lambda: |-
id(last_drink) = "Cappuccino";
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x00, 0x01, 0x05, 0x01, 0x17, 0x04, 0x00, 0x00, 0x1D, 0x30]
- script.execute: apply_max_defaults
- platform: template
name: "Latte Macchiato"
on_press:
- lambda: |-
id(last_drink) = "Latte Macchiato";
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x00, 0x01, 0x05, 0x01, 0x17, 0x10, 0x00, 0x00, 0x35, 0x17]
- script.execute: apply_max_defaults
- platform: template
name: "Hot Water"
on_press:
- lambda: |-
id(last_drink) = "Hot Water";
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x00, 0x01, 0x05, 0x01, 0x17, 0x00, 0x01, 0x00, 0x21, 0x0B]
- script.execute: apply_max_defaults
- platform: template
name: "Bean Strength"
on_press:
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x00, 0x01, 0x05, 0x01, 0x17, 0x00, 0x02, 0x00, 0x35, 0x1E]
- platform: template
name: "Milk Foam"
on_press:
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x00, 0x01, 0x05, 0x01, 0x17, 0x00, 0x08, 0x00, 0x07, 0x25]
- platform: template
name: "Cup Size"
on_press:
- uart.write:
id: uart_mainboard
data: [0xD5, 0x55, 0x00, 0x01, 0x05, 0x01, 0x17, 0x00, 0x04, 0x00, 0x1C, 0x34]
output:
- platform: gpio
pin: GPIO12
id: display_trip
This is what i currently have