Automated chicken coop door using an ESP32 chip and a cheap battery powered door.

I got the parts, but I can't seem to get the ESPHome code onto it.
This is the code:
esphome:
name: esphome-web-a8b0d8
friendly_name: Chicken Coop Door
min_version: 2024.11.0
name_add_mac_suffix: false
esp32:
board: esp32dev
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
- platform: esphome
wifi:
ssid: WiFIName
password: Wifipassword
captive_portal:
output:
- platform: ledc
id: motor_1_a
pin: GPIO2 # Pin to IN1
- platform: ledc
id: motor_1_b
pin: GPIO4 # Pin to IN2
- platform: ledc
pin: GPIO5 # Pin to EAN
id: motor_enable
frequency: 1000Hz
fan:
- platform: hbridge
id: Door_Motor
name: "Door Motor"
pin_a: motor_1_a
pin_b: motor_1_b
decay_mode: SLOW
enable_pin: motor_enable
speed_count: 100

button:
- platform: template
name: "Door Up"
on_press:
then:
- fan.turn_on:
id: Door_Motor
direction: Forward
- delay: 5s
- fan.turn_off: Door_Motor
- platform: template
name: "Door Down"
on_press:
then:
- fan.turn_on:
id: Door_Motor
direction: REVERSE
- delay: 5s
- fan.turn_off: Door_Motor
But all it does is give me this error:
View attachment 4031285

Am I doing something wrong here?
I plugged into chatgpt (as much as I hate AI, I ended up doing this out of desperation), and it said the indentation was wrong and says it fixed it. It's compiling right now.
BYC doesn't appear to like the indentation.
 
I plugged into chatgpt (as much as I hate AI, I ended up doing this out of desperation), and it said the indentation was wrong and says it fixed it. It's compiling right now.
BYC doesn't appear to like the indentation.
Maybe, if you've got the code, upload the .yaml to google drive or something, then link it here.
 
I got the parts, but I can't seem to get the ESPHome code onto it.
This is the code:
esphome:
name: esphome-web-a8b0d8
friendly_name: Chicken Coop Door
min_version: 2024.11.0
name_add_mac_suffix: false
esp32:
board: esp32dev
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
- platform: esphome
wifi:
ssid: WiFIName
password: Wifipassword
captive_portal:
output:
- platform: ledc
id: motor_1_a
pin: GPIO2 # Pin to IN1
- platform: ledc
id: motor_1_b
pin: GPIO4 # Pin to IN2
- platform: ledc
pin: GPIO5 # Pin to EAN
id: motor_enable
frequency: 1000Hz
fan:
- platform: hbridge
id: Door_Motor
name: "Door Motor"
pin_a: motor_1_a
pin_b: motor_1_b
decay_mode: SLOW
enable_pin: motor_enable
speed_count: 100

button:
- platform: template
name: "Door Up"
on_press:
then:
- fan.turn_on:
id: Door_Motor
direction: Forward
- delay: 5s
- fan.turn_off: Door_Motor
- platform: template
name: "Door Down"
on_press:
then:
- fan.turn_on:
id: Door_Motor
direction: REVERSE
- delay: 5s
- fan.turn_off: Door_Motor
But all it does is give me this error:
View attachment 4031285

Am I doing something wrong here?

This is some sort of spacing or tab issue. YAML is space sensitive.
 
This is some sort of spacing or tab issue. YAML is space sensitive.
I got it to work, but how do I get the "up" and "down" controls to show?
1737255252872.png
 
Go to settings -> Devices

You should see your new ESP device under the "discovered" section. You still need to add it to your Home Assistant.
I did that. Maybe something in the code is bad?

Code:
esphome:
  name: esphome-web-a8b0d8
  friendly_name: Chicken Coop Door
  min_version: 2024.11.0
  name_add_mac_suffix: false

esp32:
  board: esp32dev
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

wifi:
  ssid: Dominica
  password: Lander2022

captive_portal:

output:
  - platform: ledc
    id: motor_1_a
    pin: GPIO2 # Pin to IN1
  - platform: ledc
    id: motor_1_b
    pin: GPIO4 # Pin to IN2
  - platform: ledc
    pin: GPIO5 # Pin to EAN
    id: motor_enable
    frequency: 1000Hz

fan:
  - platform: hbridge
    id: Door_Motor
    name: "Door Motor"
    pin_a: motor_1_a
    pin_b: motor_1_b
    decay_mode: SLOW
    enable_pin: motor_enable
    speed_count: 100

button:
  - platform: template
    name: "Door Up"
    on_press:
      then:
        - fan.turn_on:
            id: Door_Motor
            direction: FORWARD
        - delay: 5s
        - fan.turn_off: Door_Motor
  - platform: template
    name: "Door Down"
    on_press:
      then:
        - fan.turn_on:
            id: Door_Motor
            direction: REVERSE
        - delay: 5s
        - fan.turn_off: Door_Motor
 
1737256013672.png


In the ESPHome config, it should show up as a device. Then the buttons should be entities.

And if you click on the device you should see the entities you can control.

1737256103225.png


(and just to be clear, that "fingerme" automation is for a fingerprint sensor I'm working on).

Your code has the buttons defined.

You've compiled the code. Have you pushed it to the device? Once you have the device configured you can do it wirelessly, but at least once you have to push the code manually to the device.
 
View attachment 4031358

In the ESPHome config, it should show up as a device. Then the buttons should be entities.

And if you click on the device you should see the entities you can control.

View attachment 4031360

(and just to be clear, that "fingerme" automation is for a fingerprint sensor I'm working on).

Your code has the buttons defined.

You've compiled the code. Have you pushed it to the device? Once you have the device configured you can do it wirelessly, but at least once you have to push the code manually to the device.
I got it to be picked up in home assistant. How would I hook up all of the parts?
 

New posts New threads Active threads

Back
Top Bottom