display:
  - platform: tm1638
    id: tm1638_display
    stb_pin: 2
    clk_pin: 5
    dio_pin: 4
    update_interval: 5s
    intensity: 5
    lambda: |-
      it.print("81818181");

binary_sensor:
  - platform: tm1638
    id: Button0
    key: 0
    filters:
      - delayed_on: 10ms
    on_press:
      then:
        - switch.turn_on: Led0
    on_release:
      then:
        - switch.turn_off: Led0
  - platform: tm1638
    id: Button1
    key: 1
    on_press:
      then:
        - switch.turn_on: Led1
    on_release:
      then:
        - switch.turn_off: Led1
  - platform: tm1638
    id: Button2
    key: 2
    on_press:
      then:
        - switch.turn_on: Led2
    on_release:
      then:
        - switch.turn_off: Led2
  - platform: tm1638
    id: Button3
    key: 3
    on_press:
      then:
        - switch.turn_on: Led3
    on_release:
      then:
        - switch.turn_off: Led3
  - platform: tm1638
    id: Button4
    key: 4
    on_press:
      then:
        - output.turn_on: Led4
    on_release:
      then:
        - output.turn_off: Led4
  - platform: tm1638
    id: Button5
    key: 5
    on_press:
      then:
        - output.turn_on: Led5
    on_release:
      then:
        - output.turn_off: Led5
  - platform: tm1638
    id: Button6
    key: 6
    on_press:
      then:
        - output.turn_on: Led6
    on_release:
      then:
        - output.turn_off: Led6
  - platform: tm1638
    id: Button7
    key: 7
    on_press:
      then:
        - output.turn_on: Led7
    on_release:
      then:
        - output.turn_off: Led7

switch:
  - platform: tm1638
    id: Led0
    led: 0
    name: TM1638Led0
  - platform: tm1638
    id: Led1
    led: 1
    name: TM1638Led1
  - platform: tm1638
    id: Led2
    led: 2
    name: TM1638Led2
  - platform: tm1638
    id: Led3
    led: 3
    name: TM1638Led3

output:
  - platform: tm1638
    id: Led4
    led: 4
  - platform: tm1638
    id: Led5
    led: 5
  - platform: tm1638
    id: Led6
    led: 6
  - platform: tm1638
    id: Led7
    led: 7