v1.5.0 ESPHome BLE Keyboard
Added
-
Host switcher on the mouse and remote cards — the prev/next host selector that
the keyboard card had is now in all three cards' headers, via the samehost_slots,
host_namesandactive_host_entityoptions. -
Cards stay in sync with each other — switching the host on one card updates the
other two, as do switches made from the web control page, a physical button, or a YAML
action. Works out of the box via the cards' 30-second device poll; adding the optional
active_hostsensor makes it instant. -
Other ESPHome buttons appear on the web control page — every non-internal
button:
in your config is listed automatically, so the page can reach things BLE can't. The
motivating case is power: a monitor can be slept withconsumer:0x30but only woken
with Wake-on-LAN. They work aspress_button:<object_id>actions too, so they can be
used in macros, per-host overrides, and the REST API. Keyed by object id rather than
position, so adding buttons never repoints a saved macro. -
hide_buttonsoption to keep destructive buttons (factory_reset,restart) off
the page, which has no authentication. Hidden buttons are also refused if their action
is typed by hand.expose_buttons: falseturns the listing off entirely. -
alternate:action — runs one branch per press instead of everything in sequence,
so a single button can toggle. Branches split on||, while a single|keeps meaning
"next step", so each branch can be a whole sequence — necessary for displays that need a
confirmation step to power off:alternate:consumer:0x30 | delay:1000 | ok || repeat:3:press_button:samsung_43_m70f_wolSet that as
remote_powerin Host Actions and the remote's power button sleeps the
monitor over BLE, then wakes it over Wake-on-LAN. Editable with no reflash, and its
preset wraps what's already in the box rather than appending.repeat:composes,
which Wake-on-LAN usually wants since magic packets are unacknowledged UDP. Note this is
assumed state — HID is one-way, so the device can't detect the monitor being switched
off by other means; the README shows a template-button recipe for when it must be real. -
macro:<name>action — run a stored web macro from any action string, so macros can
call each other and analternate:branch can be a whole macro. Names must now be unique
and cannot contain|, since that would split the reference. -
show_macoption on all three cards to show or hide the active host's MAC address. -
host_urloption on all three cards to point a card at the ESP32 explicitly when
auto-detection can't find it.
Fixed
- The keyboard card's MAC address never displayed. It looked for the device's URL in
atext_sensor.*entity, but Home Assistant has no such domain — ESPHome text sensors
becomesensor.*— so the lookup always failed and the line stayed blank. The cards now
take the address from the device'sconfiguration_urlin Home Assistant's device
registry (orhost_url), and the MAC is drawn to the left of the selector. - Host switching failed for devices with a
-in their name. The card built the
service name from the raw device name instead of the underscored slug. - The host poller leaked a timer per dashboard view switch and never stopped. It is
now cleared on disconnect, re-armed on reconnect, and runs every 30 s instead of 5 s —
the endpoint returns every slot at once, so a host switch repaints from cache. - The
/api/ble_keyboard/*endpoints sentAccess-Control-Allow-Origintwice. ESPHome's
web_serveralready adds one globally, and the component added a second, so browsers saw
*, *and refused the request — stricter than sending no CORS header at all. Any
cross-origin read of the API failed, which is why the cards could never fetch host MACs.
The component no longer sets the header and relies on ESPHome's. - HACS updates could leave stale cards in the browser. The HACS entry point imported
the three card files at fixed URLs, so an update re-fetched the entry point (HACS gives
it a new?hacstag=) while the browser could keep serving cached copies of the cards
themselves. The imports now carry the release version, so every release produces URLs
no cache has seen.
Changed
- Host Actions now reference a macro instead of copying it. Picking a macro from the
preset dropdown used to paste a snapshot of its text, so editing the macro afterwards
left the override running the old version with nothing showing they'd diverged. It now
insertsmacro:<name>, which follows the macro. Existing overrides keep their copied
text and work unchanged — re-pick the macro to convert one into a reference. Overrides
pointing at a macro that no longer exists are flagged with a ⚠ naming it, updated live
as macros are renamed or deleted. - Your existing buttons will now show on the web control page. Button listing is on by
default, so after this update anyrestart,safe_modeorfactory_resetbutton in
your config appears on/ble_keyboardalongside the keyboard's own. Add them to
hide_buttons, mark theminternal: true, or setexpose_buttons: falseif you'd
rather they didn't.
Notes
- Reflash required for the MAC display and the button listing. Both are firmware-side.
The host switcher itself works after a card update alone; the MAC address and the new
buttons only appear once the device is reflashed. - The MAC is read straight from the ESP32 over HTTP. If Home Assistant is served over
HTTPS the browser blocks that as mixed content and the MAC line hides itself; the
switcher still works.