PricelessToolkit / ESPBell-LITE

Intercom / Doorbell IoT Module
MIT License
69 stars 11 forks source link

Use button entity instead of switch #21

Closed PilaScat closed 1 week ago

PilaScat commented 1 month ago

Is it possibile?

PricelessToolkit commented 1 month ago

Control is on pin 5, change the yaml whatever you want


switch:

# Door Lock Opener "Momentary Switch" Keeps SSR ON for 1.5s.
  - platform: gpio
    pin: 5
    id: Lock
    name: "Lock"
    icon: "mdi:lock"
    restore_mode: ALWAYS_OFF
    on_turn_on:
    - delay: 1500ms 
    - switch.turn_off: Lock

https://esphome.io/components/button/

PilaScat commented 1 month ago

What I meant was if it was possible to use a button instead of a switch on Home Assistant, but that's a small thing, if you can't do it easily, never mind

PricelessToolkit commented 1 month ago

Not tested. If it works, please let me know.


switch:
  - platform: gpio
    pin: 5
    id: UnlockSwitch
    name: "Unlock Switch"
    icon: "mdi:lock"
    restore_mode: ALWAYS_OFF
    internal: true

button:
  - platform: gpio
    id: UnlockButton
    name: "Unlock Button"
    on_press:
      - switch.turn_on: UnlockSwitch
      - delay: 1500ms
      - switch.turn_off: UnlockSwitch
PilaScat commented 1 month ago

ok thanks, when it arrives I'll do the test, probably 1/2 weeks since I'm on holiday