esphome:
  name: heating-og
  friendly_name: "Heating OG"
  area: "Bedroom"

  project:
    name: dasfoo.heating-og
    version: "2.0"

esp32:
  # Dingtian DT-R008 board rev 3.6.(9+) from January 2025 for $31.
  # Header pinout above Ethernet port:
  #
  # GND | IO3 (RX) | IO1 (TX) | NRST | IO0 | 3V3 | IO4 | IO5
  #
  # IO0 must be connected to GND upon power-on to enter bootloader.
  board: esp32doit-devkit-v1
  framework:
    type: esp-idf

packages:
  # WiFi is present on board but we don't use it.
  ota: !include templates/ota.yaml
  mqtt: !include templates/mqtt.yaml
  uptime: !include templates/uptime.yaml
  restart: !include templates/restart.yaml
  syslog: !include templates/syslog.yaml

logger:

ethernet:
  type: JL1101
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk:
    mode: CLK_OUT
    pin: GPIO17
  power_pin: GPIO0
  phy_addr: 1
  domain: ""

text_sensor:
- platform: ethernet_info
  ip_address:
    name: "ESP chip IP (Ethernet)"
    icon: mdi:ip-network
  mac_address:
    name: "ESP chip MAC (Ethernet)"
    icon: mdi:expansion-card


sn74hc595: # write
  - id: 'sn74hc595_hub'
    clock_pin: GPIO14 # SRCLK (serial clock)
    data_pin: GPIO13 # SER (serial input)
    latch_pin: GPIO15 # RCLK (latch for outputs)
    oe_pin: GPIO32 # OE
    sr_count: 8

# GPIO16 is the data pin for 165 serial output, clock and latch are shared.

switch:
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_OFF
    name: "Shower"
    pin:
      sn74hc595: sn74hc595_hub
      number: 0
      inverted: false
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_OFF
    id: sw_unused
    pin:
      sn74hc595: sn74hc595_hub
      number: 1
      inverted: false
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_OFF
    name: "Bedroom"
    pin:
      sn74hc595: sn74hc595_hub
      number: 2
      inverted: false
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_OFF
    name: "Wardrobe"
    pin:
      sn74hc595: sn74hc595_hub
      number: 3
      inverted: false
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_OFF
    name: "Office and Hallway"
    pin:
      sn74hc595: sn74hc595_hub
      number: 4
      inverted: false
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_OFF
    name: "Child West"
    pin:
      sn74hc595: sn74hc595_hub
      number: 5
      inverted: false
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_OFF
    name: "Bathroom"
    pin:
      sn74hc595: sn74hc595_hub
      number: 6
      inverted: false
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_OFF
    name: "Child East"
    pin:
      sn74hc595: sn74hc595_hub
      number: 7
      inverted: false
