devWaves / SwitchBot-MQTT-BLE-ESP32

Allows for multiple SwitchBot bots and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Temperature, Motion, Contact sensors
MIT License
549 stars 68 forks source link

holdPress mode in Home Assistant? #118

Closed Peter2507 closed 1 year ago

devWaves commented 1 year ago

Hey your description got removed but I see it in the history

You can easily do this from HA by either creating separate "helper" buttons or toggles and creating an automation that triggers based on those

here are some example YAML you can use to get started. This will holdpress for 5 secs

Using a button

alias: TestHoldPress
description: ""
trigger:
  - platform: state
    entity_id:
      - input_button.holdpress_5sec
condition: []
action:
  - service: mqtt.publish
    data:
      qos: "0"
      topic: switchbot/esp32/holdPress
      payload: "{\"id\":\"switchbottwo\", \"hold\":5}"
mode: single

Using a toggle

alias: TestHoldToggle
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.holdpress_5sec_toggle
    to: "on"
condition: []
action:
  - service: mqtt.publish
    data:
      qos: "0"
      topic: switchbot/esp32/holdPress
      payload: "{\"id\":\"switchbottwo\", \"hold\":5}"
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.holdpress_5sec_toggle
mode: single