Scene Controller Build – Part 3

I was able to dig up a Micro USB cable to finally program this thing.

Here is the ESPHome code I am currently using. I plan to add more on a later date but for now I can control the buttons.

esphome:
  name: scene-control
  platform: ESP32
  board: esp32dev

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "PASSWORD"

wifi:
  ssid: "WIFI-SSID"
  password: "PASSWORD"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Scene-Control Fallback Hotspot"
    password: "PASSWORD"

captive_portal:

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO13
      mode:
        input: true
#        pullup: true
        pulldown: true
      inverted: true
    name: "Scene1"

  - platform: gpio
    pin:
      number: GPIO12
      mode:
        input: true
#        pullup: true
        pulldown: true
      inverted: true
    name: "Scene2"

  - platform: gpio
    pin:
      number: GPIO14
      mode:
        input: true
#        pullup: true
        pulldown: true
      inverted: true
    name: "Scene3"

  - platform: gpio
    pin:
      number: GPIO27
      mode:
        input: true
#        pullup: true
        pulldown: true
      inverted: true
    name: "Scene4"

  - platform: gpio
    pin:
      number: GPIO33
      mode:
        input: true
#        pullup: true
        pulldown: true
      inverted: true
    name: "Scene5"

  - platform: gpio
    pin:
      number: GPIO32
      mode:
        input: true
#        pullup: true
        pulldown: true
      inverted: true
    name: "Scene6"

time:
  - platform: homeassistant
    id: esptime

sensor:
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 60s
  - platform: uptime
    name: Uptime Sensor
    id: uptime_sensor
    update_interval: 60s

In Home Assistant I am using a Automation to make use of the Scene Controller. For a example to control the Garage Light as a Toggle.

alias: Scene Control 1
description: 'Button 1'
trigger:
  - platform: state
    entity_id: binary_sensor.scene1
    from: 'on'
    to: 'off'
condition: []
action:
  - type: toggle
    entity_id: switch.garage_light
    domain: switch
mode: single

Works like a charm and it’s instant as well.

I had to make a quick hardware change and not use the Resistor Array, it caused the pins to jump high and low constantly. Might work fine for some house party lights lol.

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