esphome-ratgdo/base.yaml

178 lines
4.4 KiB
YAML

---
external_components:
- source:
type: git
url: https://github.com/esphome-ratgdo/esphome-ratgdo
ref: dev
refresh: 1s
ratgdo:
id: ${id_prefix}
uart:
tx_pin:
number: ${uart_tx_pin} # red control terminal / GarageDoorOpener (UART1 TX) pin is D4 on D1 Mini
inverted: true
rx_pin:
number: ${uart_rx_pin} # red control terminal / GarageDoorOpener (UART1 RX) pin is D2 on D1 Mini
inverted: true
baud_rate: 9600
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
switch:
- platform: ratgdo
id: ${id_prefix}_lock_remotes
type: lock
entity_category: config
ratgdo_id: ${id_prefix}
name: "Lock remotes"
- platform: gpio
id: "${id_prefix}_status_door"
internal: true
pin:
number: ${status_door_pin} # D0 output door status, HIGH for open, LOW for closed
mode:
output: true
name: "Status door"
entity_category: diagnostic
- platform: gpio
id: "${id_prefix}_status_obstruction"
internal: true
pin:
number: ${status_obstruction_pin} # D8 output for obstruction status, HIGH for obstructed, LOW for clear
mode:
output: true
name: "Status obstruction"
entity_category: diagnostic
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
on_press:
- switch.turn_on: ${id_prefix}_status_obstruction
on_release:
- switch.turn_off: ${id_prefix}_status_obstruction
- 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
id: "${id_prefix}_dry_contact_open"
pin:
number: ${dry_contact_open_pin} # D5 dry contact for opening door
inverted: true
mode:
input: true
pullup: true
name: "Dry contact open"
entity_category: diagnostic
on_press:
- if:
condition:
binary_sensor.is_off: ${id_prefix}_dry_contact_close
then:
- cover.open: ${id_prefix}_garage_door
- platform: gpio
id: "${id_prefix}_dry_contact_close"
pin:
number: ${dry_contact_close_pin} # D6 dry contact for closing door
inverted: true
mode:
input: true
pullup: true
name: "Dry contact close"
entity_category: diagnostic
on_press:
- if:
condition:
binary_sensor.is_off: ${id_prefix}_dry_contact_open
then:
- cover.close: ${id_prefix}_garage_door
- platform: gpio
id: "${id_prefix}_dry_contact_light"
pin:
number: ${dry_contact_light_pin} # D3 dry contact for triggering light (no discrete light commands, so toggle only)
inverted: true
mode:
input: true
pullup: true
name: "Dry contact light"
entity_category: diagnostic
on_press:
- light.toggle: ${id_prefix}_light
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"
cover:
- platform: ratgdo
id: ${id_prefix}_garage_door
device_class: garage
name: "Door"
ratgdo_id: ${id_prefix}
on_closed:
- switch.turn_off: ${id_prefix}_status_door
on_open:
- switch.turn_on: ${id_prefix}_status_door
light:
- platform: ratgdo
id: ${id_prefix}_light
name: "Light"
ratgdo_id: ${id_prefix}
button:
- platform: restart
name: "Restart"
- platform: safe_mode
name: "Safe mode boot"
entity_category: diagnostic
- platform: ratgdo
id: ${id_prefix}_sync
type: sync
entity_category: diagnostic
ratgdo_id: ${id_prefix}
name: "Sync"
- platform: ratgdo
id: ${id_prefix}_query
type: query
entity_category: diagnostic
ratgdo_id: ${id_prefix}
name: "Query"