Homey ESP32 Bluetooth Keyboard firmware (can lock / unlock iPad remotely) Dev. review needed


I’ve had several request how I unlock and lock my iPad dashboard remotely. I used an old Pad2 that needed an new connector, so when I opened the iPad, I directly soldered a wire to the smart cover magnetic hall sensor to unlock. But opening an iPad is a real pain, and there are better wireless non-intrusive solutions. One solution is to emulate an Bluetooth keyboard and send lock and unlock key shortcuts to it.

I’ve written an firmware for a cheap ESP32 module, no need for soldering. it uses Homeyduino. I put the source code opensource on Github:

There’s somewhere a bug that (I think) causes an stack overflow if you hammer too much bluetooth commands in a short time to it. I think the bug is somewhere in the Bluetooth or BLE library. If a more experienced developer has some spare time, please review the code on errors.
(It automatically resets the ESP32 and reconnects immediately, so it’s not really a problem but it would be nice to fix it) If you want to collaborate on this project please feel free to contact me, and ill be happy to add you to the Github repository.

EDIT: Tried it with another ESP32, and that seems to work stable, so it might be a dodgy ESP32 that I used

Compatible with Android, Windows, Linux, iOS that support Bluetooth LE. (iPad 4 and higher, iPhone 4S and higher. (These support BLE))

This firmware is aimed to lock and unlock an iPad, but you can change the On / off setting in the firmware to whatever you want.
it uses a Space to unlock and CTRL+CMD+h to lock. (make sure automatic lock is turned of if you want Homey to control the locking and unlocking).

NOTE: keyboard shortcut CTRL+CMD+h to lock seems to be a specific iOS13 thing. Pre-ios 13 installations can use a different approach:
Let’s say you want to have the iPad on when somebody is in the room, and off when nobody’s there:

  • Set the automatic lock on the iPad to 10 minutes. (or use a different timing if you want it to react faster)
  • Create a Homey flow that fires every 9 minutes (or if you changed the timing in the first step, make it shorter than that)
  • in the “AND” add “Motion sensor is on” or something like “It’s between 7:00 and 19:00”
  • in the “THEN” add “Homey Bluetooth keyboard” “Turn on” or use a custom keystroke with the SendText action.

    (screenshot is in Dutch)

Usage:

  • Compile and upload firmware to an ESP32.
  • Connect ESP32 to Wifi network
  • Connect iPad to HomeyBLE bluetooth device
  • Add Homeyduino on Homey and add “Homey Bluetooth Keyboard”

Switch (on / off) locks and unlocks iOS devices.
You can also use actions in flows with “SendText” to let the ESP32 type a complete string of text.
HelloWorld

Or… use “SendKey” to send a single (special) key. see key table below for supported keys. Or a single character.

SendKey” keeps the key pressed (so you can send things like Alt+Ctrl+delete) So you need to send the SendKey RELEASE after the SendKeys to release the keys (with a second delay).
Otherwise it will automatically releases it after a 2 second timeout. Use only one keystroke per card.

Example:
This example first presses CMD+A (Select all text on iOS)
After that DELETE (Delete text)


It includes a wifi manager to connect to an wifi network. Just connect a phone to the “Homey Bluetooth Keyboard” network and fill in the credentials. (No hardcoding of credentials, so you don’t have to find the source code if you change the wifi network after a couple of years ;))

Available SendKeys:

  • KEY_LEFT_CTRL
  • KEY_LEFT_SHIFT
  • KEY_LEFT_ALT
  • KEY_LEFT_GUI
  • KEY_RIGHT_CTRL
  • KEY_RIGHT_SHIFT
  • KEY_RIGHT_ALT
  • KEY_RIGHT_GUI (= Apple “CMD” key)
  • KEY_UP_ARROW
  • KEY_DOWN_ARROW
  • KEY_LEFT_ARROW
  • KEY_RIGHT_ARROW
  • KEY_BACKSPACE
  • KEY_TAB
  • KEY_RETURN
  • KEY_ESC
  • KEY_INSERT
  • KEY_DELETE
  • KEY_PAGE_UP
  • KEY_PAGE_DOWN
  • KEY_HOME
  • KEY_END
  • KEY_CAPS_LOCK
  • KEY_F1 to KEY_F24
6 Likes

Super cool! What ESP32 module did you use?

Cheap Ebay module. It really doesn’t matter. It it has a usb port, you are good to go, it does not use any of the gpio pins.

Hi Satoer, thought this would be a nice alternative to the dimming possible for Homeydash. However, I am running into errors when trying to compile your .ino (see below). Actually the first time trying something with Arduino IDE, so detailed instructions could be useful…

Arduino: 1.8.10 (Windows 10), Board: “DOIT ESP32 DEVKIT V1, 80MHz, 921600, None”

Homey-BluetoothKeyboardV0.1B:32:3: error: stray ‘\302’ in program

HomeyESP32BluetoothKeyboard/Homey-BluetoothKeyboardV0.1B.ino at master · satoer/HomeyESP32BluetoothKeyboard · GitHub

^

Homey-BluetoothKeyboardV0.1B:32:3: error: stray ‘\267’ in program

Homey-BluetoothKeyboardV0.1B:32:3: error: stray ‘\302’ in program

Homey-BluetoothKeyboardV0.1B:32:3: error: stray ‘\267’ in program

Homey-BluetoothKeyboardV0.1B:270:5: error: missing terminating ’ character

 <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="221046324" data-scoped-search-url="/satoer/HomeyESP32BluetoothKeyboard/search" data-unscoped-search-url="/search" action="/satoer/HomeyESP32BluetoothKeyboard/search" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="&#x2713;" />

 ^

Homey-BluetoothKeyboardV0.1B:316:7: error: stray ‘\342’ in program

   <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>

   ^

Homey-BluetoothKeyboardV0.1B:316:7: error: stray ‘\206’ in program

Homey-BluetoothKeyboardV0.1B:316:7: error: stray ‘\265’ in program

Homey-BluetoothKeyboardV0.1B:321:7: error: stray ‘\342’ in program

   <span class="d-inline-block ml-1 v-align-middle">↵</span>

   ^

Homey-BluetoothKeyboardV0.1B:321:7: error: stray ‘\206’ in program

Homey-BluetoothKeyboardV0.1B:321:7: error: stray ‘\265’ in program

Homey-BluetoothKeyboardV0.1B:357:7: error: stray ‘\342’ in program

   <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>

   ^

Homey-BluetoothKeyboardV0.1B:357:7: error: stray ‘\206’ in program

Homey-BluetoothKeyboardV0.1B:357:7: error: stray ‘\265’ in program

Homey-BluetoothKeyboardV0.1B:362:7: error: stray ‘\342’ in program

   <span class="d-inline-block ml-1 v-align-middle">↵</span>

   ^

Homey-BluetoothKeyboardV0.1B:362:7: error: stray ‘\206’ in program

Homey-BluetoothKeyboardV0.1B:362:7: error: stray ‘\265’ in program

Homey-BluetoothKeyboardV0.1B:389:7: error: stray ‘\342’ in program

   <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>

   ^

Homey-BluetoothKeyboardV0.1B:389:7: error: stray ‘\206’ in program

Homey-BluetoothKeyboardV0.1B:389:7: error: stray ‘\265’ in program

Homey-BluetoothKeyboardV0.1B:394:7: error: stray ‘\342’ in program

   <span class="d-inline-block ml-1 v-align-middle">↵</span>

   ^

Homey-BluetoothKeyboardV0.1B:394:7: error: stray ‘\206’ in program

Homey-BluetoothKeyboardV0.1B:394:7: error: stray ‘\265’ in program

Homey-BluetoothKeyboardV0.1B:625:50: error: exponent has no digits

 <!-- blob contrib key: blob_contributors:v21:24ee13fda47ee38db7689018609c6076 -->

                                              ^

Homey-BluetoothKeyboardV0.1B:629:11: error: missing terminating ’ character

       <!-- '"` --><!-- </textarea></xmp> --></option></form><form action="/prompt_dismissals/signup" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="&#x2713;" /><input type="hidden" name="_method" value="put" /><input type="hidden" name="authenticity_token" value="NABHKZk+PHpeMhWoZ3AsTJQlH0F/0b7CU3XNl+WfFJgExzECwL1CqEWnENKOIEFGORm0A6TnJnyBYz3d693Mow==" />

       ^

Homey-BluetoothKeyboardV0.1B:894:70: error: stray ‘#’ in program

     <td id="LC28" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>WiFi.h<span class="pl-pds">&gt;</span></span>           <span class="pl-c"><span class="pl-c">//</span>https://github.com/esp8266/Arduino</span></td>

                                                                  ^

Homey-BluetoothKeyboardV0.1B:898:70: error: stray ‘#’ in program

     <td id="LC29" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>DNSServer.h<span class="pl-pds">&gt;</span></span></td>

                                                                  ^

Homey-BluetoothKeyboardV0.1B:902:70: error: stray ‘#’ in program

     <td id="LC30" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>WebServer.h<span class="pl-pds">&gt;</span></span></td>

                                                                  ^

Homey-BluetoothKeyboardV0.1B:906:70: error: stray ‘#’ in program

     <td id="LC31" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>WiFiManager.h<span class="pl-pds">&gt;</span></span>    <span class="pl-c"><span class="pl-c">//</span>https://github.com/Brunez3BD/WIFIMANAGER-ESP32 //This one works with the ESP32</span></td>

                                                                  ^

Homey-BluetoothKeyboardV0.1B:910:70: error: stray ‘#’ in program

     <td id="LC32" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>Homey.h<span class="pl-pds">&gt;</span></span>          <span class="pl-c"><span class="pl-c">//</span> (version 1.0.2)  https://github.com/athombv/com.athom.homeyduino</span></td>

                                                                  ^

Homey-BluetoothKeyboardV0.1B:914:70: error: stray ‘#’ in program

     <td id="LC33" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>BleKeyboard.h<span class="pl-pds">&gt;</span></span>    <span class="pl-c"><span class="pl-c">//</span>https://github.com/T-vK/ESP32-BLE-Keyboard</span></td>

                                                                  ^

Homey-BluetoothKeyboardV0.1B:923:70: error: stray ‘#’ in program

     <td id="LC35" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">controllerName</span> <span class="pl-s"><span class="pl-pds">&quot;</span>Homey Bluetooth Keyboard<span class="pl-pds">&quot;</span></span></td>

                                                                  ^

Homey-BluetoothKeyboardV0.1B:927:70: error: stray ‘#’ in program

     <td id="LC36" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">releaseTime</span> <span class="pl-c1">2000</span></td>

                                                                  ^

Homey-BluetoothKeyboardV0.1B:944:70: error: stray ‘#’ in program

     <td id="LC40" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">keyLookupTableCount</span> <span class="pl-c1">47</span></td>

                                                                  ^

Homey-BluetoothKeyboardV0.1B:1436:163: error: stray ‘#’ in program

     <td id="LC160" class="blob-code blob-code-inner js-file-line">      bleKeyboard.<span class="pl-c1">press</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>q<span class="pl-pds">&#39;</span></span>);</td>

                                                                                                                                                               ^

Homey-BluetoothKeyboardV0.1B:1436:197: error: stray ‘#’ in program

     <td id="LC160" class="blob-code blob-code-inner js-file-line">      bleKeyboard.<span class="pl-c1">press</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>q<span class="pl-pds">&#39;</span></span>);</td>

                                                                                                                                                                                                 ^

Homey-BluetoothKeyboardV0.1B:1785:7: error: missing terminating ’ character

   <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-jump-to-line-form Box-body d-flex" action="" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="&#x2713;" />

   ^

Homey-BluetoothKeyboardV0.1B:1839:5: error: stray ‘\342’ in program

 You can’t perform that action at this time.

 ^

Homey-BluetoothKeyboardV0.1B:1839:5: error: stray ‘\200’ in program

Homey-BluetoothKeyboardV0.1B:1839:5: error: stray ‘\231’ in program

Homey-BluetoothKeyboardV0.1B:7:1: error: expected unqualified-id before ‘<’ token

^

Homey-BluetoothKeyboardV0.1B:146:25: error: ‘up’ does not name a type

           Sign&nbsp;up

                     ^

Homey-BluetoothKeyboardV0.1B:173:267: error: expected unqualified-id before ‘<’ token

                 <a href="/features" class="py-2 lh-condensed-ultra d-block link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Features">Features <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a>

                                                                                                                                                                                                                                                                       ^

Homey-BluetoothKeyboardV0.1B:186:332: error: expected unqualified-id before ‘<’ token

                   <li class="edge-item-fix"><a href="/customer-stories" class="py-2 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Customer stories">Customer stories <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a></li>

                                                                                                                                                                                                                                                                                                                                        ^

Homey-BluetoothKeyboardV0.1B:187:308: error: expected unqualified-id before ‘<’ token

                   <li class="edge-item-fix"><a href="/security" class="py-2 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Security">Security <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a></li>

                                                                                                                                                                                                                                                                                                                ^

Homey-BluetoothKeyboardV0.1B:207:299: error: expected unqualified-id before ‘<’ token

                   <li class="edge-item-fix"><a href="/explore" class="py-2 lh-condensed-ultra d-block link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Explore">Explore GitHub <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a></li>

                                                                                                                                                                                                                                                                                                       ^

Homey-BluetoothKeyboardV0.1B:210:113: error: ‘contribute’ does not name a type

                 <h4 class="text-gray-light text-normal text-mono f5 mb-2 border-lg-top pt-lg-3">Learn &amp; contribute</h4>

                                                                                                             ^

Homey-BluetoothKeyboardV0.1B:243:262: error: expected unqualified-id before ‘<’ token

                 <a href="/pricing" class="pb-2 lh-condensed-ultra d-block link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Pricing">Plans <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a>

                                                                                                                                                                                                                                                                  ^

Homey-BluetoothKeyboardV0.1B:251:312: error: expected unqualified-id before ‘<’ token

                   <li class="edge-item-fix"><a href="/nonprofit" class="py-2 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Nonprofits">Nonprofit <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a></li>

                                                                                                                                                                                                                                                                                                                    ^

Homey-BluetoothKeyboardV0.1B:252:335: error: expected unqualified-id before ‘<’ token

                   <li class="edge-item-fix"><a href="https://education.github.com" class="py-2 pb-0 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover"  data-ga-click="(Logged out) Header, go to Education">Education <span class="Bump-link-symbol float-right text-normal text-gray-light">&rarr;</span></a></li>

                                                                                                                                                                                                                                                                                                                                           ^

Homey-BluetoothKeyboardV0.1B:413:21: error: ‘in’ does not name a type

       Sign&nbsp;in

                 ^

Homey-BluetoothKeyboardV0.1B:419:23: error: ‘up’ does not name a type

         Sign&nbsp;up

                   ^

Homey-BluetoothKeyboardV0.1B:894:149: error: expected unqualified-id before ‘<’ token

     <td id="LC28" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>WiFi.h<span class="pl-pds">&gt;</span></span>           <span class="pl-c"><span class="pl-c">//</span>https://github.com/esp8266/Arduino</span></td>

                                                                                                                                                 ^

Homey-BluetoothKeyboardV0.1B:894:187: error: expected unqualified-id before ‘<’ token

     <td id="LC28" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>WiFi.h<span class="pl-pds">&gt;</span></span>           <span class="pl-c"><span class="pl-c">//</span>https://github.com/esp8266/Arduino</span></td>

                                                                                                                                                                                       ^

Homey-BluetoothKeyboardV0.1B:898:149: error: expected unqualified-id before ‘<’ token

     <td id="LC29" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>DNSServer.h<span class="pl-pds">&gt;</span></span></td>

                                                                                                                                                 ^

Homey-BluetoothKeyboardV0.1B:898:192: error: expected unqualified-id before ‘<’ token

     <td id="LC29" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>DNSServer.h<span class="pl-pds">&gt;</span></span></td>

                                                                                                                                                                                            ^

Homey-BluetoothKeyboardV0.1B:902:149: error: expected unqualified-id before ‘<’ token

     <td id="LC30" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>WebServer.h<span class="pl-pds">&gt;</span></span></td>

                                                                                                                                                 ^

Homey-BluetoothKeyboardV0.1B:902:192: error: expected unqualified-id before ‘<’ token

     <td id="LC30" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>WebServer.h<span class="pl-pds">&gt;</span></span></td>

                                                                                                                                                                                            ^

Homey-BluetoothKeyboardV0.1B:906:149: error: expected unqualified-id before ‘<’ token

     <td id="LC31" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>WiFiManager.h<span class="pl-pds">&gt;</span></span>    <span class="pl-c"><span class="pl-c">//</span>https://github.com/Brunez3BD/WIFIMANAGER-ESP32 //This one works with the ESP32</span></td>

                                                                                                                                                 ^

Homey-BluetoothKeyboardV0.1B:906:194: error: expected unqualified-id before ‘<’ token

     <td id="LC31" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>WiFiManager.h<span class="pl-pds">&gt;</span></span>    <span class="pl-c"><span class="pl-c">//</span>https://github.com/Brunez3BD/WIFIMANAGER-ESP32 //This one works with the ESP32</span></td>

                                                                                                                                                                                              ^

Homey-BluetoothKeyboardV0.1B:910:149: error: expected unqualified-id before ‘<’ token

     <td id="LC32" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>Homey.h<span class="pl-pds">&gt;</span></span>          <span class="pl-c"><span class="pl-c">//</span> (version 1.0.2)  https://github.com/athombv/com.athom.homeyduino</span></td>

                                                                                                                                                 ^

Homey-BluetoothKeyboardV0.1B:910:188: error: expected unqualified-id before ‘<’ token

     <td id="LC32" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>Homey.h<span class="pl-pds">&gt;</span></span>          <span class="pl-c"><span class="pl-c">//</span> (version 1.0.2)  https://github.com/athombv/com.athom.homeyduino</span></td>

                                                                                                                                                                                        ^

Homey-BluetoothKeyboardV0.1B:914:149: error: expected unqualified-id before ‘<’ token

     <td id="LC33" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>BleKeyboard.h<span class="pl-pds">&gt;</span></span>    <span class="pl-c"><span class="pl-c">//</span>https://github.com/T-vK/ESP32-BLE-Keyboard</span></td>

                                                                                                                                                 ^

Homey-BluetoothKeyboardV0.1B:914:194: error: expected unqualified-id before ‘<’ token

     <td id="LC33" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>BleKeyboard.h<span class="pl-pds">&gt;</span></span>    <span class="pl-c"><span class="pl-c">//</span>https://github.com/T-vK/ESP32-BLE-Keyboard</span></td>

                                                                                                                                                                                              ^

Homey-BluetoothKeyboardV0.1B:923:192: error: expected unqualified-id before ‘<’ token

     <td id="LC35" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">controllerName</span> <span class="pl-s"><span class="pl-pds">&quot;</span>Homey Bluetooth Keyboard<span class="pl-pds">&quot;</span></span></td>

                                                                                                                                                                                            ^

Homey-BluetoothKeyboardV0.1B:923:250: error: expected unqualified-id before ‘<’ token

     <td id="LC35" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">controllerName</span> <span class="pl-s"><span class="pl-pds">&quot;</span>Homey Bluetooth Keyboard<span class="pl-pds">&quot;</span></span></td>

                                                                                                                                                                                                                                                      ^

Homey-BluetoothKeyboardV0.1B:931:144: error: expected unqualified-id before ‘<’ token

     <td id="LC37" class="blob-code blob-code-inner js-file-line"><span class="pl-k">bool</span> released = <span class="pl-c1">true</span>;</td>

                                                                                                                                            ^

Homey-BluetoothKeyboardV0.1B:935:145: error: expected unqualified-id before ‘<’ token

     <td id="LC38" class="blob-code blob-code-inner js-file-line"><span class="pl-k">long</span> releaseTimer = <span class="pl-c1">0</span>;</td>

                                                                                                                                             ^

Homey-BluetoothKeyboardV0.1B:960:72: error: ‘keyLookupTable’ does not name a type

     <td id="LC44" class="blob-code blob-code-inner js-file-line">} keyLookupTable[] PROGMEM = {</td>

                                                                    ^

Homey-BluetoothKeyboardV0.1B:1152:72: error: expected unqualified-id before ‘<’ token

     <td id="LC92" class="blob-code blob-code-inner js-file-line">};</td>

                                                                    ^

Homey-BluetoothKeyboardV0.1B:1171:167: error: expected unqualified-id before ‘<’ token

     <td id="LC96" class="blob-code blob-code-inner js-file-line">BleKeyboard <span class="pl-en">bleKeyboard</span>(<span class="pl-s"><span class="pl-pds">&quot;</span>Homey BLE<span class="pl-pds">&quot;</span></span>, <span class="pl-s"><span class="pl-pds">&quot;</span>Homey<span class="pl-pds">&quot;</span></span>, <span class="pl-c1">100</span>);</td>

                                                                                                                                                                   ^

Homey-BluetoothKeyboardV0.1B:1171:210: error: expected unqualified-id before ‘<’ token

     <td id="LC96" class="blob-code blob-code-inner js-file-line">BleKeyboard <span class="pl-en">bleKeyboard</span>(<span class="pl-s"><span class="pl-pds">&quot;</span>Homey BLE<span class="pl-pds">&quot;</span></span>, <span class="pl-s"><span class="pl-pds">&quot;</span>Homey<span class="pl-pds">&quot;</span></span>, <span class="pl-c1">100</span>);</td>

                                                                                                                                                                                                              ^

Homey-BluetoothKeyboardV0.1B:1171:272: error: expected unqualified-id before ‘<’ token

     <td id="LC96" class="blob-code blob-code-inner js-file-line">BleKeyboard <span class="pl-en">bleKeyboard</span>(<span class="pl-s"><span class="pl-pds">&quot;</span>Homey BLE<span class="pl-pds">&quot;</span></span>, <span class="pl-s"><span class="pl-pds">&quot;</span>Homey<span class="pl-pds">&quot;</span></span>, <span class="pl-c1">100</span>);</td>

                                                                                                                                                                                                                                                                            ^

Homey-BluetoothKeyboardV0.1B:1171:311: error: expected unqualified-id before ‘<’ token

     <td id="LC96" class="blob-code blob-code-inner js-file-line">BleKeyboard <span class="pl-en">bleKeyboard</span>(<span class="pl-s"><span class="pl-pds">&quot;</span>Homey BLE<span class="pl-pds">&quot;</span></span>, <span class="pl-s"><span class="pl-pds">&quot;</span>Homey<span class="pl-pds">&quot;</span></span>, <span class="pl-c1">100</span>);</td>

                                                                                                                                                                                                                                                                                                                   ^

Homey-BluetoothKeyboardV0.1B:1171:359: error: expected unqualified-id before ‘<’ token

     <td id="LC96" class="blob-code blob-code-inner js-file-line">BleKeyboard <span class="pl-en">bleKeyboard</span>(<span class="pl-s"><span class="pl-pds">&quot;</span>Homey BLE<span class="pl-pds">&quot;</span></span>, <span class="pl-s"><span class="pl-pds">&quot;</span>Homey<span class="pl-pds">&quot;</span></span>, <span class="pl-c1">100</span>);</td>

                                                                                                                                                                                                                                                                                                                                                                   ^

Homey-BluetoothKeyboardV0.1B:1280:72: error: expected unqualified-id before ‘<’ token

     <td id="LC122" class="blob-code blob-code-inner js-file-line">}</td>

                                                                    ^

exit status 1
stray ‘\302’ in program

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

If it’s your first time with an ESP32 / Arduino, I suggest you try to upload the simple “blink” example first to check if all the connections are working.

Have you also installed all these libraries?



(and of course the ESP32 library)

I think I missed the last one, now I have:

#include <DNSServer.h>
#include <WiFi.h>
#include <WebServer.h>
#include <WiFiManager.h>
#include <BleConnectionStatus.h>
#include <BleKeyboard.h>
#include <KeyboardOutputCallbacks.h>
#include <Homey.h>

And then your code in the Arduino sketch.

Unfortunately, I am getting some other errors now:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x7855fb]

goroutine 1 [running]:
github.com/arduino/arduino-cli/legacy/builder.ResolveLibrary(0x11cc65a0, 0x11c7a41e, 0x7, 0x11c7a41e)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/resolve_library.go:64 +0x14b
github.com/arduino/arduino-cli/legacy/builder.findIncludesUntilDone(0x11cc65a0, 0x11cdf820, 0x88ed00, 0x11c7ee40, 0x11f72b30, 0x11d36b00, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/container_find_includes.go:358 +0x3b6
github.com/arduino/arduino-cli/legacy/builder.(*ContainerFindIncludes).Run(0xdebc68, 0x11cc65a0, 0xdebc68, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/container_find_includes.go:152 +0x3e5
github.com/arduino/arduino-cli/legacy/builder.runCommands(0x11cc65a0, 0x11c35e1c, 0x20, 0x20, 0x409a01, 0x7, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/builder.go:210 +0xbd
github.com/arduino/arduino-cli/legacy/builder.(*Builder).Run(0x11c63f40, 0x11cc65a0, 0xdebbb4, 0x11c06ca0)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/builder.go:117 +0xb9c
github.com/arduino/arduino-cli/legacy/builder.RunBuilder(...)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/builder.go:226
main.main()
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-builder/main.go:398 +0x6d2
C:\Program Files (x86)\Arduino\arduino-builder returned 2
Error compiling for board ESP32 Dev Module.

Also tried with Arduino IDE beta 1.9.0, since I read these errors could be related to the IDE version, no luck. Tried to only include Homey, BleKeyboard and WifiManager, no luck.

Great stuff and thanks for sharing your knowledge. I installed it and it works like a charm!

1 Like

I am attempting to get this to work. Thusfar I am able to upload wifi sketch to the esp32 and get an ipadress. I am also able to inlcude the device on Homey. And then it gets messy. I cant get the esp32 to connect to the ipad using BLE because I cant wrap my head around the coding. I always sucked at coding. Is somebody willing to help out a script-kiddy?

Why cannot somebody just make an Homey app? Put the code in an app and then connect homey to the computer as a keyboard (without an arduino) and the Homey runs the commands and the text. Isnt that possibble?

No, that’s not possible.

Same here in my case.

Is the iPad used an iPad 4 or higher? Because it needs an iOS that supports Bluetooth LE. Below won’t work.

To use our old Ipad Air as a digital photo frame, it would be nice to have it on when motion is detected and go to sleep after a while without any motions. It seems the device you made should be able to do this. Does the ESP32 module you bought has a built in motion/proximity sensor?
Where in NL or BE are you living? If your device would be able to make this work, I would be really interested!
Thanks