Skip to content

Instantly share code, notes, and snippets.

@edwork
Created January 9, 2025 04:04
Show Gist options
  • Save edwork/2816444fe618ecad76febc4f29d0eedb to your computer and use it in GitHub Desktop.
Save edwork/2816444fe618ecad76febc4f29d0eedb to your computer and use it in GitHub Desktop.
RATGDO 2.5 using WT32-ETH01 (esp-wrover-kit)
substitutions:
name: ratgdo-main-ethernet
friendly_name: RATGDO Main Ethernet
id_prefix: ratgdov2
uart_tx_pin: GPIO15 # CFG
uart_rx_pin: GPIO14
input_obst_pin: GPIO4
external_components:
- source:
type: git
url: https://github.com/ratgdo/esphome-ratgdo
ref: 17a74f8a298cafbd7f82aab4fb34e16549cd9bc3
refresh: 1s
web_server:
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: true
project:
name: ratgdo.esphome
version: "2.0"
esp32:
board: esp-wrover-kit
# Sync time with Home Assistant.
time:
- platform: homeassistant
id: homeassistant_time
ota:
platform: esphome
logger:
level: DEBUG
api:
id: api_server
encryption:
key: supersecretsecurekey=
services:
- service: wipe_devices_from_gdo_memory
variables:
devices_to_wipe: string
then:
- lambda: !lambda |-
if(devices_to_wipe.compare("all") == 0) {
id($id_prefix).clear_paired_devices(ratgdo::PairedDevice::ALL);
} else if (devices_to_wipe.compare("remote") == 0) {
id($id_prefix).clear_paired_devices(ratgdo::PairedDevice::REMOTE);
} else if (devices_to_wipe.compare("keypad") == 0) {
id($id_prefix).clear_paired_devices(ratgdo::PairedDevice::KEYPAD);
} else if (devices_to_wipe.compare("wall") == 0) {
id($id_prefix).clear_paired_devices(ratgdo::PairedDevice::WALL_CONTROL);
} else if (devices_to_wipe.compare("accessory") == 0) {
id($id_prefix).clear_paired_devices(ratgdo::PairedDevice::ACCESSORY);
}
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO0_IN
phy_addr: 1
power_pin: GPIO16
use_address: 172.21.6.29
manual_ip:
static_ip: 172.21.6.29
gateway: 172.21.6.1
subnet: 255.255.255.0
preferences:
flash_write_interval: 1min
ratgdo:
id: ${id_prefix}
input_gdo_pin: ${uart_rx_pin}
output_gdo_pin: ${uart_tx_pin}
input_obst_pin: ${input_obst_pin}
on_sync_failed:
then:
- homeassistant.service:
service: persistent_notification.create
data:
title: "${friendly_name} sync failed"
message: "Failed to communicate with garage opener on startup."
notification_id: "esphome_ratgdo_${id_prefix}_sync_failed"
sensor:
- platform: ratgdo
id: ${id_prefix}_openings
type: openings
entity_category: diagnostic
ratgdo_id: ${id_prefix}
name: "Openings"
unit_of_measurement: "openings"
icon: mdi:open-in-app
- platform: ratgdo
id: ${id_prefix}_paired_devices_total
type: paired_devices_total
entity_category: diagnostic
ratgdo_id: ${id_prefix}
name: "Paired Devices"
icon: mdi:remote
lock:
- platform: ratgdo
id: ${id_prefix}_lock_remotes
ratgdo_id: ${id_prefix}
name: "Lock remotes"
switch:
- platform: ratgdo
id: "${id_prefix}_learn"
type: learn
ratgdo_id: ${id_prefix}
name: "Learn"
icon: mdi:plus-box
entity_category: config
binary_sensor:
- platform: ratgdo
type: motion
id: ${id_prefix}_motion
ratgdo_id: ${id_prefix}
name: "Motion"
device_class: motion
- platform: ratgdo
type: obstruction
id: ${id_prefix}_obstruction
ratgdo_id: ${id_prefix}
name: "Obstruction"
device_class: problem
- platform: ratgdo
type: button
id: ${id_prefix}_button
ratgdo_id: ${id_prefix}
name: "Button"
entity_category: diagnostic
- platform: ratgdo
type: motor
id: ${id_prefix}_motor
ratgdo_id: ${id_prefix}
name: "Motor"
device_class: running
entity_category: diagnostic
- platform: gpio
pin:
number: GPIO12
mode:
input: true
pullup: true
inverted: true
name: "Garage Green"
internal: false
id: garagegreen
- platform: gpio
pin:
number: GPIO2
mode:
input: true
pullup: true
inverted: true
name: "Garage Blue"
internal: false
id: garageblue
number:
- platform: ratgdo
id: ${id_prefix}_rolling_code_counter
type: rolling_code_counter
entity_category: config
ratgdo_id: ${id_prefix}
name: "Rolling code counter"
mode: box
unit_of_measurement: "codes"
- platform: ratgdo
id: ${id_prefix}_opening_duration
type: opening_duration
entity_category: config
ratgdo_id: ${id_prefix}
name: "Opening duration"
unit_of_measurement: "s"
- platform: ratgdo
id: ${id_prefix}_closing_duration
type: closing_duration
entity_category: config
ratgdo_id: ${id_prefix}
name: "Closing duration"
unit_of_measurement: "s"
- platform: ratgdo
id: ${id_prefix}_client_id
type: client_id
entity_category: config
ratgdo_id: ${id_prefix}
name: "Client ID"
mode: box
cover:
- platform: ratgdo
id: ${id_prefix}_garage_door
device_class: garage
name: "Door"
ratgdo_id: ${id_prefix}
light:
- platform: ratgdo
id: ${id_prefix}_light
name: "Light"
ratgdo_id: ${id_prefix}
button:
- platform: restart
id: ${id_prefix}_restart
name: "Restart"
- platform: safe_mode
id: ${id_prefix}_safe_mode
name: "Safe mode boot"
entity_category: diagnostic
- platform: template
id: ${id_prefix}_query_status
entity_category: diagnostic
name: "Query status"
on_press:
then:
lambda: !lambda |-
id($id_prefix).query_status();
- platform: template
id: ${id_prefix}_query_openings
name: "Query openings"
entity_category: diagnostic
on_press:
then:
lambda: !lambda |-
id($id_prefix).query_openings();
- platform: template
id: ${id_prefix}_sync
name: "Sync"
entity_category: diagnostic
on_press:
then:
lambda: !lambda |-
id($id_prefix).sync();
- platform: template
id: ${id_prefix}_toggle_door
name: "Toggle door"
on_press:
then:
lambda: !lambda |-
id($id_prefix).door_toggle();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment