ESPHOME YAML Configuration for ChinaMobile X11 Smart Plug

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "X11 Button"
    on_press:
      - switch.toggle: relay
  - platform: status
    name: "X11 Status"

sensor:
  - platform: wifi_signal
    name: "X11 WiFi Signal"
    update_interval: 300s
    
switch:
  - platform: gpio
    id: red_led
    pin:
      number: GPIO16
      inverted: true

  - platform: gpio
    id: blue_led
    pin:
      number: GPIO13
      inverted: true

  - platform: gpio
    name: "X11 Relay"
    pin: GPIO14
    id: "relay"
        # Turn off red LED to show blue when turned on
    on_turn_on:
      - switch.turn_off: red_led
      - switch.turn_on: blue_led

    # Turns on the red LED once the plug is turned off. Stock plug doesn't do this, to restore normal behavior remove the on_turn_on and on_turn_off
    # blocks.
    on_turn_off:
      - switch.turn_on: red_led
      - switch.turn_off: blue_led

  - platform: restart
    name: "X11 Restart"

相关推荐

暂无相关文章!

暂无评论

发表评论

您的电子邮件地址不会被公开,必填项已用*标注。