esphome:
  name: livingroomdevice
  friendly_name: Living Room Device
  area: Living Room
  on_boot:
    then:
      - if:
          condition:
            update.is_available:
          then:
            - logger.log: "Update available"
      - update.perform:
          force_update: true

wifi:
  ssid: MySSID
  password: password1

http_request:
  verify_ssl: ${verify_ssl}

ota:
  - platform: http_request
    id: prometheus_http_request_ota

update:
  - platform: http_request
    name: Firmware Update
    ota_id: prometheus_http_request_ota
    source: http://example.com/manifest.json

sensor:
  - platform: template
    id: prometheus_template_sensor1
    lambda: |-
      if (millis() > 10000) {
        return 42.0;
      }
      return 0.0;
    update_interval: 60s

text:
  - platform: template
    name: "Template text"
    optimistic: true
    min_length: 0
    max_length: 100
    mode: text
    initial_value: "Hello World"

text_sensor:
  - platform: version
    name: "ESPHome Version"
    hide_timestamp: true
  - platform: template
    id: template_text_sensor1
    lambda: |-
      if (millis() > 10000) {
        return {"Hello World"};
      }
      return {"Goodbye (cruel) World"};
    update_interval: 60s

event:
  - platform: template
    name: "Template Event"
    id: template_event1
    event_types:
      - "custom_event_1"
      - "custom_event_2"

button:
  - platform: template
    name: "Template Event Button"
    on_press:
      - logger.log: "Template Event Button pressed"
      - lambda: |-
          ESP_LOGD("template_event_button", "Template Event Button pressed");
      - event.trigger:
          id: template_event1
          event_type: custom_event_1

binary_sensor:
  - platform: template
    id: template_binary_sensor1
    lambda: |-
      if (millis() > 10000) {
        return true;
      }
      return false;

switch:
  - platform: template
    id: prometheus_template_switch1
    lambda: |-
      if (millis() > 10000) {
        return true;
      }
      return false;
    optimistic: true

fan:
  - platform: template
    id: template_fan1

cover:
  - platform: template
    id: template_cover1
    lambda: |-
      if (millis() > 10000) {
        return COVER_OPEN;
      }
      return COVER_CLOSED;

light:
  - platform: binary
    name: "Binary Light"
    output: test_output
  - platform: monochromatic
    name: "Brightness Light"
    output: test_output
  - platform: rgb
    name: "RGB Light"
    red: test_output
    green: test_output
    blue: test_output
  - platform: rgbw
    name: "RGBW Light"
    red: test_output
    green: test_output
    blue: test_output
    white: test_output

lock:
  - platform: template
    id: template_lock1
    lambda: |-
      if (millis() > 10000) {
        return LOCK_STATE_LOCKED;
      }
      return LOCK_STATE_UNLOCKED;
    optimistic: true

output:
  - platform: template
    id: test_output
    type: float
    write_action:
      - lambda: |-
          // no-op for CI/build tests
          (void)state;
select:
  - platform: template
    id: template_select1
    name: "Template select"
    optimistic: true
    options:
      - one
      - two
      - three
    initial_option: two

number:
  - platform: template
    id: template_number1
    name: "Template number"
    optimistic: true
    min_value: 0
    max_value: 100
    step: 1

valve:
  - platform: template
    name: "Template Valve"
    lambda: |-
      return VALVE_OPEN;
    optimistic: true
    has_position: true

climate:
  - platform: climate_ir_lg
    name: LG Climate
    transmitter_id: xmitr

prometheus:
  include_internal: true
  relabel:
    prometheus_template_sensor1:
      id: hellow_world
      name: Hello World
    template_text_sensor1:
      id: hello_text
      name: Text Substitution
