devices.esphome.io

teXXmo IoT Button

teXXmo IoT Button

Device Type: misc
Electrical Standard: global
Board: esp8266

Device Information

Product Images

Product Image

Schematic

Flashing Pinout

Pin Hole ShapePurpose
[ ]3V3 Input (do not connect if powering off of battery)
( )Txd
( )Rxd
( )GPIO0 (must pull to ground before flashing)
( )Gnd

Basic Configuration

substitutions:
name: iot_button_1
globals:
- id: message_sent
type: bool
restore_value: no
initial_value: "false"
esphome:
name: ${name}
on_boot:
# Raise the power pin very early (pri 700) to keep the ESP awake
# until we're done sending the event
priority: 700
then:
- output.turn_on: power_pin
ESP8266:
board: esp8285
# OTA flashing
ota:
- platform: esphome
wifi: # Your Wifi network details
# Enable fallback hotspot in case wifi connection fails
ap:
# Enabling the logging component
logger:
# Enable Home Assistant API
api:
# Enable the captive portal
captive_portal:
script:
- id: send_event
then:
- logger.log: "Waiting for API connection"
- wait_until:
api.connected:
- logger.log: "Sending ESPHome event"
- delay: 0.5s
- homeassistant.event:
event: esphome.button_pressed
data:
device_id: ${name}
- globals.set:
id: message_sent
value: "true"
- delay: 0.5s
sensor:
- platform: adc
pin: A0
id: button_adc
internal: true
update_interval: 10s
on_value_range:
above: 0.5
then:
- script.execute: send_event
- wait_until:
lambda: return id(message_sent);
- logger.log: "Shutting down"
- output.turn_off: power_pin
# The D5 pin turns the vreg on & off. Setting to off will shut down the device.
output:
- platform: gpio
pin: GPIO5
id: power_pin
- platform: esp8266_pwm
pin: GPIO12
id: led_red_pin
- platform: esp8266_pwm
pin: GPIO14
id: led_green_pin
Edit this page on GitHub