找回密碼
 立即註冊
惟家LINE群QRCODE
    查看: 1577|回覆: 0

    M5刷機 yaml 分享 雙鍵

    [複製鏈接]

    !lvup!   100%

    11

    主題

    6

    回帖

    518

    積分

    超級版主

    積分
    518
    發表於 2022-9-18 21:05:43 | 顯示全部樓層 |閱讀模式
    感謝Mini 以及Simon大大提供方式
    解決雙鍵右鍵指示燈不亮的問題
    並加上指示燈背光微亮設定
    以下為個人常用的設定分享

    substitutions:
      devicename: m5-2button
      upper_devicename: "M5 2Button"
      friendly_name: M5 2Button

    esphome:
      name: $devicename
      on_boot:
        then:
          - light.dim_relative:
              id: backlight
              relative_brightness: 30%

    esp32:
      board: esp32dev
      framework:
        type: arduino

    # Enable logging
    logger:

    # Enable Home Assistant API
    api:

    ota:
    #  password: "your-ota-password"

    wifi:
      ssid: !secret wifi_ssid
      password: !secret wifi_password

      # Enable fallback hotspot (captive portal) in case wifi connection fails
      ap:
        ssid: "M5-2Button"
        password: "87654321"

    web_server:

    captive_portal:

    # Example configuration entry
    text_sensor:
      - platform: wifi_info
        ip_address:
          name: IP Address
        ssid:
          name: Connected SSID
        mac_address:
          name: Mac Address

    sensor:
    # Uptime
      - platform: uptime
        name: ${friendly_name} Uptime

    # WiFi Signal
      - platform: wifi_signal
        name: ${friendly_name} WiFi Signal
        update_interval: 60s

    status_led:
      pin:
        number: GPIO5
        inverted: true

    switch:
      - platform: gpio
        id: relay_1
        name: "Button Left"
        pin: 23
      - platform: gpio
        id: relay_2
        pin: 19
        name: "Button Right"
        on_turn_on:
          - output.turn_on: buttonlight_2
        on_turn_off:
          - output.turn_off: buttonlight_2

    output:
      - platform: ledc
        pin: 18
        frequency: 1000 Hz
        id: backlight_ledc
      - platform: gpio
        id: buttonlight_2
        pin: 22

    light:
      - platform: monochromatic
        output: backlight_ledc
        name: "Back Light"
        id: backlight

    binary_sensor:
      - platform: gpio
        id: left_button
        pin:
          number: 4
          mode: INPUT_PULLUP
        on_press:
          - switch.toggle: relay_1
      - platform: gpio
        id: right_button
        pin:
          number: 15
          mode: INPUT_PULLUP
        on_press:
          - switch.toggle: relay_2


    您需要登入後纔可以回帖 登入 | 立即註冊

    本版積分規則

    Archiver|手機版|惟家的智能論壇

    GMT+8, 2026-9-24 12:12 , Processed in 0.078612 second(s), 24 queries .

    快速回覆 返回頂部 返回列表