# Essential ESPHome config options
esphome:
  name: "${name}"
  friendly_name: "${friendly_name}"
  name_add_mac_suffix: true
  min_version: "2023.12.0"
  on_boot:
    then:
      # Wakes up the desk and reports height
      - uart.write:
          id: handset_tx
          data: [ 0x0 ]
  project:
    name: tj_horner.upsy_desky
    version: "2.0.0-pre"

uart:
  id: handset_tx
  tx_pin: 16
  baud_rate: 9600

esp32:
  board: esp32dev

# Configurable options
substitutions:
  name: "upsy-desky"
  friendly_name: "Upsy Desky"
  desk_height_name: "Desk Height"
  target_desk_height_name: "Target Desk Height"

  # Standing Desk Component Config
  standing_desk_uart_rx_pin: "17"
  standing_desk_up_pin: "21"
  standing_desk_down_pin: "22"
  standing_desk_min_height: "25.2"
  standing_desk_max_height: "50.8"

  # Presets Addon Config
  button_bit1_pin: "21"
  button_bit2_pin: "22"
  button_bit4_pin: "19"
  button_m_pin: "18"

  # Runtime Config Defaults
  default_height_units: "in" # Must be "in" or "cm"

packages:
  standing_desk: github://tjhorner/esphome-standing-desk/configs/template.yaml@esphome-2023.12
  addon_presets: !include addons/presets.yaml
  addon_stable_ids: !include addons/stable-ids.yaml
  addon_runtime_config: !include addons/runtime-config.yaml

button:
  - platform: restart
    name: "Restart"

light:
  - platform: status_led
    id: upsy_desky_status_led
    name: "Status LED"
    pin: GPIO23
    restore_mode: RESTORE_DEFAULT_ON
