Close

Some interesting things

A project log for Experiences with ESPhome

Setting up some ESPhome-devices

mabe42MaBe42 a day ago0 Comments

Status LED:

Most of the ESP boards have a status LED. There exists a primitive to directly access it:

light:
  - platform: status_led
    name: "Status"
    pin:
      number: GPIO2
      inverted: true
    restore_mode: ALWAYS_OFF

 This allows easily using the status LED as an indicator when programming automations in ESPhome.

HA Button:

A switch from ESPhome shows as a switch in HA and can be toggled there. However, sometimes you would like to have the equivalent of a tactile button in HA, for example to press a button in the HA companion app on a smartphone to open a garage door.

output:
  - platform: gpio
    pin: GPIO0
    id: gpio_d3

switch:
  - platform: output
    name: "Generic yellow switch"
    id: yellow_switch
    output: gpio_d3

button:
  - platform: template
    name: "Garagentor"
    id: tortaster
    on_press:
      then:
        - switch.turn_on: yellow_switch
        - delay: 1s
        - switch.turn_off: yellow_switch

 So pressing on this button in HA turns the yellow switch on for 1 second. Similar to pressing a button for 1 second.

Discussions