Skip to content

Commit b9bcb17

Browse files
authored
fix: disable HomeKit toggle for keypad devices in UI (#899)
2 parents 9e79015 + b1d42ef commit b9bcb17

2 files changed

Lines changed: 25 additions & 7 deletions

File tree

homebridge-ui/public/components/device-card.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const DeviceCard = {
2727
const d = opts.device;
2828
const isUnsupported = d.unsupported === true;
2929
const isIgnored = d.ignored === true;
30+
const isKeypad = d.isKeypad === true;
3031

3132
const col = document.createElement('div');
3233
col.className = 'col-6 col-md-4 col-lg-3 mb-3';
@@ -94,8 +95,8 @@ const DeviceCard = {
9495

9596
metaRow.appendChild(meta);
9697

97-
// Toggle — inline with meta, only for non-unsupported devices
98-
if (!isUnsupported) {
98+
// Toggle — inline with meta, only for non-unsupported, non-keypad devices
99+
if (!isUnsupported && !isKeypad) {
99100
const switchWrap = document.createElement('div');
100101
switchWrap.className = 'form-check form-switch mb-0';
101102
switchWrap.addEventListener('click', (e) => e.stopPropagation());
@@ -126,7 +127,13 @@ const DeviceCard = {
126127
const badgeArea = document.createElement('div');
127128
let hasBadge = false;
128129

129-
if (isUnsupported) {
130+
if (isKeypad) {
131+
const badge = document.createElement('span');
132+
badge.className = 'badge bg-secondary';
133+
badge.textContent = 'Not available for HomeKit';
134+
badgeArea.appendChild(badge);
135+
hasBadge = true;
136+
} else if (isUnsupported) {
130137
const badge = document.createElement('span');
131138
badge.className = 'badge badge-unsupported';
132139
badge.textContent = 'Not Supported';
@@ -150,10 +157,15 @@ const DeviceCard = {
150157
card.appendChild(body);
151158
if (hasBadge) card.appendChild(footer);
152159

153-
// Click handler — navigate to detail
154-
card.addEventListener('click', () => {
155-
if (opts.onClick) opts.onClick(d);
156-
});
160+
// Click handler — navigate to detail (disabled for keypads)
161+
if (isKeypad) {
162+
card.style.cursor = 'default';
163+
card.title = 'Keypads have no configurable HomeKit settings. The keypad works alongside your station but cannot be exposed to HomeKit.';
164+
} else {
165+
card.addEventListener('click', () => {
166+
if (opts.onClick) opts.onClick(d);
167+
});
168+
}
157169

158170
col.appendChild(card);
159171
if (container) container.appendChild(col);

homebridge-ui/public/views/device-detail.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ const DeviceDetailView = {
4343
return;
4444
}
4545

46+
// Keypads have no configurable HomeKit settings — redirect back to dashboard
47+
if (accessory.isKeypad === true) {
48+
App.navigate('dashboard');
49+
return;
50+
}
51+
4652
// Header with back button + device image
4753
this._renderHeader(container, accessory, type);
4854

0 commit comments

Comments
 (0)