esphome-blekeyboard icon indicating copy to clipboard operation
esphome-blekeyboard copied to clipboard

[bug] sent text to the spotlight ipad app.

Open arcidodo opened this issue 11 months ago • 0 comments

i spend some hours to get this working but here is my config to control an ipad what is hanging on the wall:-)

everything is working great except the text i sent "Home Assistant" of "Woning" is sometimes scrambled, so Home Assistant is sent as "Ho Assistantme" is it possible to get some delays between the letters what is sent?

globals:
  - id: ipad_state
    type: bool
    restore_value: no
    initial_value: "false"

# Enable components
external_components:
  - source: github://dmamontov/esphome-blekeyboard

ble_keyboard:
  id: my_ble_keyboard
  name: "MyBleKeyboard"
  manufacturer_id: "Apple"
  reconnect: true
  buttons: false

switch:
  - platform: template
    name: "Screen iPad"
    icon: mdi:power
    lambda: |-
      if (id(ipad_state)) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
        - lambda: |-
            id(ipad_state) = true;
        - ble_keyboard.combination:
            id: my_ble_keyboard
            delay: 1000
            keys:
              - 0x20
              - 0x20
        - ble_keyboard.press:
            id: my_ble_keyboard 
            code: 0x20

          
    turn_off_action:
        - lambda: |-
            id(ipad_state) = false;
        - ble_keyboard.combination:
            id: my_ble_keyboard
            delay: 100
            keys:
              - 0x83
              - 0x80
              - "q"
button:
  - platform: restart
    entity_category: "config"
    name: "Restart"

  - platform: template
    name: "Lock an iPad"
    id: lock_an_ipad
    icon: "mdi:lock"
    on_press:
      then:
        - ble_keyboard.combination:
            id: my_ble_keyboard
            delay: 100
            keys:
              - 0x83
              - 0x80
              - "q"

  - platform: template
    name: "unlock an iPad"
    id: unlock_an_ipad
    icon: "mdi:lock"
    on_press:
      then:
        - ble_keyboard.combination:
            id: my_ble_keyboard
            delay: 1000
            keys:
              - 0x20
              - 0x20
        - ble_keyboard.press:
            id: my_ble_keyboard 
            code: 0x20


  - platform: template
    name: "Open App Home Assistant"
    id: open_ha
    on_press:
      then:
        - ble_keyboard.combination:
            id: my_ble_keyboard
            delay: 500
            keys:
              - 0x83
              - 0x20
        - ble_keyboard.print:
            id: my_ble_keyboard 
            text: "Home Assistant"
        #- delay: "00:00:01"
        - ble_keyboard.press:
            id: my_ble_keyboard 
            code: 0xB0

  - platform: template
    name: "Open App Woning"
    id: open_hk
    on_press:
      then:
        - ble_keyboard.combination:
            id: my_ble_keyboard
            delay: 500
            keys:
              - 0x83
              - 0x20
        - ble_keyboard.print:
            id: my_ble_keyboard 
            text: "Woning"
        - ble_keyboard.press:
            id: my_ble_keyboard 
            code: 0xB0

arcidodo avatar Jul 18 '23 16:07 arcidodo