number:
  - platform: template
    id: test_number
    min_value: 0
    step: 1
    max_value: 10
    optimistic: true

select:
  - platform: template
    id: test_select
    options:
      - one
      - two
    optimistic: true

switch:
  - platform: template
    name: Template Switch
    id: my_switch
    optimistic: true

display:
  - platform: lcd_gpio
    id: my_lcd_gpio
    dimensions: 18x4
    data_pins:
      - number: 1
      - number: 2
      - number: 3
      - number: 4
    enable_pin: 5
    rs_pin: 6
    lambda: |-
      it.print("Hello World!");

lcd_menu:
  id: test_lcd_menu
  display_id: my_lcd_gpio
  mark_back: 0x5e
  mark_selected: 0x3e
  mark_editing: 0x2a
  mark_submenu: 0x7e
  active: false
  mode: rotary
  on_enter:
    then:
      lambda: 'ESP_LOGI("lcd_menu", "root enter");'
  on_leave:
    then:
      lambda: 'ESP_LOGI("lcd_menu", "root leave");'
  items:
    - type: back
      text: Back
    - type: label
    - type: menu
      text: Submenu 1
      items:
        - type: back
          text: Back
        - type: menu
          text: Submenu 21
          items:
            - type: back
              text: Back
            - type: command
              text: Show Main
              on_value:
                then:
                  - display_menu.show_main: test_lcd_menu
    - type: select
      text: Enum Item
      immediate_edit: true
      select: test_select
      on_enter:
        then:
          lambda: 'ESP_LOGI("lcd_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
      on_leave:
        then:
          lambda: 'ESP_LOGI("lcd_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
      on_value:
        then:
          lambda: 'ESP_LOGI("lcd_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
    - type: number
      text: Number
      number: test_number
      on_enter:
        then:
          lambda: 'ESP_LOGI("lcd_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
      on_leave:
        then:
          lambda: 'ESP_LOGI("lcd_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
      on_value:
        then:
          lambda: 'ESP_LOGI("lcd_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());'
    - type: command
      text: Hide
      on_value:
        then:
          - display_menu.hide: test_lcd_menu
    - type: switch
      text: Switch
      switch: my_switch
      on_text: Bright
      off_text: Dark
      immediate_edit: false
      on_value:
        then:
          lambda: 'ESP_LOGI("lcd_menu", "switch value: %s", it->get_value_text().c_str());'
    - type: custom
      text: !lambda 'return "Custom";'
      value_lambda: 'return "Val";'
      on_next:
        then:
          lambda: 'ESP_LOGI("lcd_menu", "custom next: %s", it->get_text().c_str());'
      on_prev:
        then:
          lambda: 'ESP_LOGI("lcd_menu", "custom prev: %s", it->get_text().c_str());'