Okay, I thought this would be easier, but damn I do not get Tasmota at all I think.
I created a PCB with the ESP32C3 and use it with ESPHome (PokyPow).
I am able to compile and flash a custom version.
Okay, that took some times but works.
However, I am struggling HARD to understand, how I can map my GPIOs with the functions they do in ESPHome.
I want:
- a sensor that check if something is on or off
- a button for shortly connecting something
- a second button to shorty connect something slightly longer
- control a led
I have this ESPHome config for a board I created myself:
switch:
- platform: gpio
pin:
number: GPIO7
inverted: true
mode:
output: true
pulldown: true
id: power_pin
internal: true
- platform: gpio
pin:
number: GPIO6
inverted: true
mode:
output: true
pulldown: true
id: reset_pin
internal: true
- platform: template
name: "Power Switch"
id: power_switch
internal: true
turn_on_action:
- switch.turn_on: power_pin
- delay: 2000ms
- switch.turn_off: power_pin
- platform: template
name: "Power Switch Force"
id: power_switch_force
internal: true
turn_on_action:
- switch.turn_on: power_pin
- delay: 10000ms
- switch.turn_off: power_pin
- platform: template
name: "Reset Switch"
id: reset_switch
internal: true
turn_on_action:
- switch.turn_on: reset_pin
- delay: 1000ms
- switch.turn_off: reset_pin
binary_sensor:
- platform: gpio
pin:
number: GPIO04
mode:
input: true
pullup: true
inverted: false
id: pc_power_sensor
name: "Power State"
device_class: running
icon: "mdi:desktop-classic"
button:
- platform: template
name: "Power Button"
id: power_button
icon: "mdi:power-standby"
on_press:
then:
- switch.toggle: power_switch
- platform: template
name: "Force Power Off"
id: force_power_off
icon: "mdi:power-plug-off"
on_press:
then:
- switch.toggle: power_switch_force
- delay: 1000ms
- switch.turn_off: power_switch_force
- platform: template
name: "Reset Button"
id: reset_button
icon: "mdi:restart"
on_press:
then:
- switch.toggle: reset_pin
I tried this:
# Set GPIO04 as Switch1 (binary sensor)
GPIO4 160
# Enable pull-up resistor for the GPIO pin
SetOption114 1
# Configure the switch as normally open (not inverted)
SwitchMode1 0
# Rename the web button to "Power State" (optional, for clarity)
WebButton1 Power State
I do not see a button or anything on the webinterface.
For some reason I can not wrap my head around Tasmota and how you get those entities into HA.