Glowforge / ESPHome / Home-Assistant Light Color Controller

With another baby on the way, it’s time to clear out the nursery. That means we need to turn the guest bedroom into my daughter’s new bedroom. She loves bright colors and color changing lights are super cool. She’s 3, so no Google/Alexa/smartphone… That makes big tough physical buttons important. As far as I can tell, there is literally nothing like this on the market and that makes me sad.

Designed in Autodesk Fusion360, cut on a Glowforge Basic, using 3mm Acrylic. Decorated with Cricut cut vinyl. Uses 30mm arcade push buttons, connected to an ESP32-s, programmed with ESPHome, controlling Home-Assistant connected lights.

Full materials list (with links) and SVG files (Free Download) are available at the end of this post.

Case Assembly

Physical build is pretty straight-forward. Designed in Fusion 360, I end up re-watching Jason Lichtman’s amazing tutorial 360 LIVE: Mastering Wooden Living Hinges every time I design something with a living hinge. Assembly is just putting the bottom and top arch together, then inserting those tabs into the front piece and glue with weld-on. Apply the vinyl, then glue on the clouds. The back screws on with M2.5 screws.

Wiring:

Wiring is super simple. Chain ground to one pin of each button, then connect the other pin to GPIO pins. This is how I connected everything. As long as you’re using “mode: INPUT_PULLUP” no other components are required!

To make wiring go more quickly, I cut the end off a set of rainbow dupont connector wires, and crimped on the spade connectors. The ground side is just thin black hookup wire chained to all of the buttons. Pictured is a temporary back panel used to keep the sides straight while debugging.

Programming:

“Programming” if you can call it that is super easy as well. I’m already running Home-Assistant and ESPHome. There are a lot of great tutorials on YouTube for getting started with them.

The entire premise here is that each button is a binary sensor with 100ms delay for debounce. That sensor is used to trigger one automation per button/light color. When the button is pressed (binary sensor is activated) set the light to the color specified.

Below are the relevant configurations from ESPHome and Home-Assistant Automations.

ESPHome Config

esphome:
  name: cloudbutton
  platform: ESP32
  board: nodemcu-32s

wifi:
  ssid: "SSID_REDACTED"
  password: "PASSWORD_REDACTED"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Cloudbutton Fallback Hotspot"
    password: "PASSWORD_REDACTED"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "PASSWORD_REDACTED"

ota:
  password: "PASSWORD_REDACTED"


binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO23
      mode: INPUT_PULLUP
      inverted: True
    filters:
      delayed_on_off: 100ms
    name: "cloudbutton-red"
  - platform: gpio
    pin: 
      number: GPIO22
      mode: INPUT_PULLUP
      inverted: True
    filters:
      delayed_on_off: 100ms
    name: "cloudbutton-orange"
  - platform: gpio
    pin: 
      number: GPIO21
      mode: INPUT_PULLUP
      inverted: True
    filters:
      delayed_on_off: 100ms
    name: "cloudbutton-yellow"
  - platform: gpio
    pin: 
      number: GPIO19
      mode: INPUT_PULLUP
      inverted: True
    filters:
      delayed_on_off: 100ms
    name: "cloudbutton-green"
  - platform: gpio
    pin: 
      number: GPIO18
      mode: INPUT_PULLUP
      inverted: True
    filters:
      delayed_on_off: 100ms
    name: "cloudbutton-blue"
  - platform: gpio
    pin: 
      number: GPIO05
      mode: INPUT_PULLUP
      inverted: True
    filters:
      delayed_on_off: 100ms
    name: "cloudbutton-purple"
  - platform: gpio
    pin: 
      number: GPIO17
      mode: INPUT_PULLUP
      inverted: True
    filters:
      delayed_on_off: 100ms
    name: "cloudbutton-pink"
  - platform: gpio
    pin: 
      number: GPIO16
      mode: INPUT_PULLUP
      inverted: True
    filters:
      delayed_on_off: 100ms
    name: "cloudbutton-white"
  - platform: gpio
    pin: 
      number: GPIO04
      mode: INPUT_PULLUP
      inverted: True
    filters:
      delayed_on_off: 100ms
    name: "cloudbutton-off"

Home-Assistant Automations:

- id: kid_room_light_off
  alias: Kid Room CloudButton Off
  trigger:
    entity_id: binary_sensor.cloudbutton_off
    platform: state
    from: 'off'
    to: 'on'
  action:
    service: light.turn_off
    entity_id:
      - light.kid_room_bulb

- id: kid_room_light_white
  alias: Kid Room CloudButton White
  trigger:
    entity_id: binary_sensor.cloudbutton_white
    platform: state
    from: 'off'
    to: 'on'
  action:
    service: light.turn_on
    data:
      brightness: 50
      rgb_color: [255, 255, 255]
      entity_id:
        - light.kid_room_bulb

- id: kid_room_light_red
  alias: Kid Room CloudButton Red
  trigger:
    entity_id: binary_sensor.cloudbutton_red
    platform: state
    from: 'off'
    to: 'on'
  action:
    service: light.turn_on
    data:
      brightness: 50
      rgb_color: [255, 0, 0]
      entity_id:
        - light.kid_room_bulb

- id: kid_room_light_orange
  alias: Kid Room CloudButton Orange
  trigger:
    entity_id: binary_sensor.cloudbutton_orange
    platform: state
    from: 'off'
    to: 'on'
  action:
    service: light.turn_on
    data:
      brightness: 50
      rgb_color: [255, 126, 0]
      entity_id:
        - light.kid_room_bulb

- id: kid_room_light_yellow
  alias: Kid Room CloudButton Yellow
  trigger:
    entity_id: binary_sensor.cloudbutton_yellow
    platform: state
    from: 'off'
    to: 'on'
  action:
    service: light.turn_on
    data:
      brightness: 50
      rgb_color: [255, 254, 0]
      entity_id:
        - light.kid_room_bulb

- id: kid_room_light_green
  alias: Kid Room CloudButton Green
  trigger:
    entity_id: binary_sensor.cloudbutton_green
    platform: state
    from: 'off'
    to: 'on'
  action:
    service: light.turn_on
    data:
      brightness: 50
      rgb_color: [0, 255, 0]
      entity_id:
        - light.kid_room_bulb

- id: kid_room_light_blue
  alias: Kid Room CloudButton Blue
  trigger:
    entity_id: binary_sensor.cloudbutton_blue
    platform: state
    from: 'off'
    to: 'on'
  action:
    service: light.turn_on
    data:
      brightness: 50
      rgb_color: [0, 0, 255]
      entity_id:
        - light.kid_room_bulb

- id: kid_room_light_purple
  alias: Kid Room CloudButton Purple
  trigger:
    entity_id: binary_sensor.cloudbutton_purple
    platform: state
    from: 'off'
    to: 'on'
  action:
    service: light.turn_on
    data:
      brightness: 50
      rgb_color: [255, 0, 255]
      entity_id:
        - light.kid_room_bulb

- id: kid_room_light_pink
  alias: Kid Room CloudButton Pink
  trigger:
    entity_id: binary_sensor.cloudbutton_pink
    platform: state
    from: 'off'
    to: 'on'
  action:
    service: light.turn_on
    data:
      brightness: 50
      rgb_color: [255, 35, 144]
      entity_id:
        - light.kid_room_bulb

Materials Used:

Download Files:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: