Skip to content

Instantly share code, notes, and snippets.

@andrewgodwin
Created December 12, 2021 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewgodwin/5b5d857980a243c6d90d0421a6f80274 to your computer and use it in GitHub Desktop.
Save andrewgodwin/5b5d857980a243c6d90d0421a6f80274 to your computer and use it in GitHub Desktop.
Coffee Finger ESPHome Config
esphome:
name: coffeefinger
platform: ESP32
board: m5stick-c
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ""
ota:
password: ""
wifi:
ssid: "ssidhere"
password: "passwordhere"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Coffeefinger Fallback Hotspot"
password: "fallbackpasswordhere"
captive_portal:
servo:
- id: finger_servo
output: servo_output
transition_length: 1s
output:
- platform: ledc
id: servo_output
pin: 22
frequency: 50 Hz
- platform: template
id: servo_script
type: binary
write_action:
- if:
condition:
lambda: return (state > 0);
then:
- servo.write:
id: finger_servo
level: 0.3
- delay: 1s
- servo.write:
id: finger_servo
level: 0.7
- delay: 1s
- servo.write:
id: finger_servo
level: -1
- light.turn_off: coffee_machine
binary_sensor:
- platform: gpio
pin:
number: GPIO39
inverted: True
name: "Coffee button"
filters:
- delayed_on_off: 50ms
on_press:
then:
- servo.write:
id: finger_servo
level: 0.3
- light.turn_on:
id: indicator
effect: "Play"
- delay: 1s
- servo.write:
id: finger_servo
level: 0.7
- delay: 1s
- servo.write:
id: finger_servo
level: -1
- light.turn_off:
id: indicator
light:
# Why is it a light not a switch? So you can schedule it with Google Home!
- platform: binary
name: "Coffee Machine"
id: coffee_machine
output: servo_script
- platform: fastled_clockless
id: indicator
chipset: NEOPIXEL
pin: GPIO27
num_leds: 25
name: "Coffee indicator"
effects:
- addressable_lambda:
name: "Tick"
update_interval: 5ms
lambda: |-
int pixels[] = {9,12,15,17,21};
it.all() = Color(0, 0, 0);
for (int i: pixels) it[i] = Color(0, 100, 0);
- addressable_lambda:
name: "Cross"
update_interval: 5ms
lambda: |-
int pixels[] = {0,4,6,8,12,16,18,20,24};
it.all() = Color(0, 0, 0);
for (int i: pixels) it[i] = Color(100, 0, 0);
- addressable_lambda:
name: "Play"
update_interval: 5ms
lambda: |-
int pixels[] = {1,6,7,11,12,13,16,17,21};
it.all() = Color(0, 0, 0);
for (int i: pixels) it[i] = Color(0, 100, 0);
- addressable_lambda:
name: "Pause"
update_interval: 5ms
lambda: |-
int pixels[] = {2,7,12,17,22};
it.all() = Color(100, 80, 0);
for (int i: pixels) it[i] = Color(0, 0, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment