Skip to content

Commit 9dc224d

Browse files
committed
v3.1.3
1 parent 6761c2b commit 9dc224d

9 files changed

Lines changed: 41 additions & 70 deletions

File tree

config.schema.json

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
"type": "boolean",
2121
"title": "Exclude Pico remotes that are associated with devices directly or in the Lutron app"
2222
},
23+
"clickSpeed": {
24+
"type": "string",
25+
"title": "Double- and long-press speed",
26+
"oneOf": [
27+
{ "title": "Fast", "enum": ["fast"] },
28+
{ "title": "Medium (default)", "enum": ["medium"] },
29+
{ "title": "Slow", "enum": ["slow"] }
30+
]
31+
},
2332
"excludedDeviceTypes": {
2433
"type": "array",
2534
"title": "Exclude specific device types (HAP + Matter)",
@@ -46,15 +55,6 @@
4655
"uniqueItems": true,
4756
"default": []
4857
},
49-
"clickSpeed": {
50-
"type": "string",
51-
"title": "Double- and long-press speed",
52-
"oneOf": [
53-
{ "title": "Fast", "enum": ["fast"] },
54-
{ "title": "Medium (default)", "enum": ["medium"] },
55-
{ "title": "Slow", "enum": ["slow"] }
56-
]
57-
},
5858
"logLevel": {
5959
"type": "string",
6060
"title": "Log Verbosity",
@@ -69,11 +69,11 @@
6969
"buttonPressLogging": {
7070
"type": "string",
7171
"title": "Button Press Logging",
72-
"description": "How verbose to be about button-press events specifically. 'Debug' is the default and means presses are quiet in normal logs (visible only with global Homebridge debug). Use 'Info' if you want to see presses while wiring up automations without enabling global debug. Use 'Silent' to drop them entirely.",
73-
"default": "debug",
72+
"description": "How verbose to be about button-press events specifically. 'Info' is the default so presses are visible in normal logs. Use 'Debug' to show presses only with global Homebridge debug enabled. Use 'Silent' to drop them entirely.",
73+
"default": "info",
7474
"oneOf": [
75-
{ "title": "Debug — visible only with global debug (default)", "enum": ["debug"] },
76-
{ "title": "Info — visible in normal logs", "enum": ["info"] },
75+
{ "title": "Info — visible in normal logs (default)", "enum": ["info"] },
76+
{ "title": "Debug — visible only with global debug", "enum": ["debug"] },
7777
{ "title": "Silent — never logged", "enum": ["silent"] }
7878
]
7979
}
@@ -86,12 +86,6 @@
8686
"description": "When enabled, the plugin will use the Homebridge Matter API to register accessories if it is available.",
8787
"default": true
8888
},
89-
"preferMatter": {
90-
"type": "boolean",
91-
"title": "Prefer Matter over HAP",
92-
"description": "When both Matter and HAP are available, prefer the Matter API for accessory registration.",
93-
"default": true
94-
},
9589
"secrets": {
9690
"type": "array",
9791
"items": {
@@ -128,6 +122,18 @@
128122
]
129123

130124
},
125+
{
126+
"type": "div",
127+
"displayFlex": true,
128+
"items": [
129+
{
130+
"key": "enableMatter",
131+
"notitle": false,
132+
"type": "boolean",
133+
"flex": "1 1 300px"
134+
}
135+
]
136+
},
131137
{
132138
"key": "options.excludedDeviceTypes",
133139
"type": "checkboxes",
@@ -168,24 +174,6 @@
168174
}
169175
]
170176
},
171-
{
172-
"type": "div",
173-
"displayFlex": true,
174-
"items": [
175-
{
176-
"key": "enableMatter",
177-
"notitle": false,
178-
"type": "boolean",
179-
"flex": "1 1 150px"
180-
},
181-
{
182-
"key": "preferMatter",
183-
"notitle": false,
184-
"type": "boolean",
185-
"flex": "1 1 150px"
186-
}
187-
]
188-
},
189177
{
190178
"key": "secrets",
191179
"type": "array",

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@homebridge-plugins/homebridge-lutron-caseta-leap",
33
"displayName": "Lutron Caseta LEAP",
44
"type": "module",
5-
"version": "3.1.1",
5+
"version": "3.1.2",
66
"description": "Support for the Lutron Caseta Smart Bridge 2",
77
"license": "Apache-2.0",
88
"repository": {

src/ButtonState.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ export class ButtonTracker {
8282
clickSpeedDouble = 'default',
8383
clickSpeedLong = 'default',
8484
isUpDownButton = false,
85-
// Default 'debug' matches the platform's optionsFromConfig default —
85+
// Default 'info' matches the platform's optionsFromConfig default —
8686
// safe even if a caller (e.g. a future device type or a test) forgets
8787
// to thread the option through.
88-
private buttonPressLogging: ButtonPressLogLevel = 'debug',
88+
private buttonPressLogging: ButtonPressLogLevel = 'info',
8989
) {
9090
log.debug(`btrk ${this.href} created speed ${clickSpeedDouble} dbl ${clickSpeedLong} long`)
9191

src/Logger.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ export type LogLevelOption = 'normal' | 'quiet' | 'errors-only'
2929
*
3030
* 'info' — visible at info level (legacy behavior; useful when wiring
3131
* up automations and you want to see presses without enabling
32-
* global Homebridge debug).
33-
* 'debug' — visible at debug level only (new default). Quiet in normal
34-
* logs; flip Homebridge's global debug to see presses.
32+
* global Homebridge debug). Default.
33+
* 'debug' — visible at debug level only. Quiet in normal logs; flip
34+
* Homebridge's global debug to see presses.
3535
* 'silent' — never log presses at any level.
3636
*/
3737
export type ButtonPressLogLevel = 'info' | 'debug' | 'silent'

src/Platform.HAP.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ export class LutronCasetaLeap
179179
// Defaults reflect the post-reclassification "sane quiet by default"
180180
// posture. logLevel 'normal' means the wrapper is a passthrough; the
181181
// quietness comes from the call sites being correctly classified.
182-
// buttonPressLogging 'debug' means presses are not visible in normal
183-
// logs (a behavior change from earlier versions); use 'info' to
184-
// restore the old chatty behavior, or 'silent' to drop them entirely.
182+
// buttonPressLogging 'info' keeps press events visible in normal logs.
183+
// Users can set 'debug' to only show presses with global Homebridge
184+
// debug enabled, or 'silent' to drop them entirely.
185185
logLevel: 'normal',
186-
buttonPressLogging: 'debug',
186+
buttonPressLogging: 'info',
187187
},
188188
config.options,
189189
{ excludedDeviceTypes },

src/settings.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ export const PLATFORM_NAME = 'LutronCasetaLeap'
55

66
export interface LutronCasetaLeapPluginConfig extends PlatformConfig {
77
enableMatter?: boolean
8-
preferMatter?: boolean
98
}

src/utils.test.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,19 @@ import { createPlatformProxy, normalizeConfig } from './utils.js'
1111
describe('normalizeConfig', () => {
1212
it('returns defaults when called with undefined', () => {
1313
const cfg = normalizeConfig(undefined)
14-
expect(cfg.preferMatter).toBe(true)
1514
expect(cfg.enableMatter).toBe(true)
1615
})
1716

1817
it('applies defaults for fields absent in raw config', () => {
1918
const cfg = normalizeConfig({ platform: 'LutronCasetaLeap' } as PlatformConfig)
20-
expect(cfg.preferMatter).toBe(true)
2119
expect(cfg.enableMatter).toBe(true)
2220
})
2321

2422
it('respects explicit false values over defaults', () => {
2523
const cfg = normalizeConfig({
2624
platform: 'LutronCasetaLeap',
27-
preferMatter: false,
2825
enableMatter: false,
2926
} as PlatformConfig)
30-
expect(cfg.preferMatter).toBe(false)
3127
expect(cfg.enableMatter).toBe(false)
3228
})
3329

@@ -91,15 +87,6 @@ describe('createPlatformProxy – platform selection', () => {
9187
expect(Matter).not.toHaveBeenCalled()
9288
})
9389

94-
it('uses HAP when preferMatter is false even if Matter is available', () => {
95-
const HAP = vi.fn()
96-
const Matter = vi.fn()
97-
const Proxy = createPlatformProxy(HAP, Matter)
98-
new Proxy({}, { ...baseConfig, preferMatter: false }, makeApi(true, true))
99-
expect(HAP).toHaveBeenCalledOnce()
100-
expect(Matter).not.toHaveBeenCalled()
101-
})
102-
10390
it('uses HAP when api has no isMatterAvailable method', () => {
10491
const HAP = vi.fn()
10592
const Matter = vi.fn()

src/utils.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type { LutronCasetaLeapPluginConfig } from './settings.js'
88
*/
99
export function normalizeConfig(raw?: PlatformConfig): LutronCasetaLeapPluginConfig {
1010
const defaults: Partial<LutronCasetaLeapPluginConfig> = {
11-
preferMatter: true,
1211
enableMatter: true,
1312
}
1413
if (!raw) {
@@ -24,8 +23,8 @@ export function normalizeConfig(raw?: PlatformConfig): LutronCasetaLeapPluginCon
2423
* required by the `DynamicPlatformPlugin` interface to the chosen
2524
* implementation so that cached accessories are always tracked correctly.
2625
*
27-
* @param HAPPlatform The standard HAP platform class constructor.
28-
* @param MatterPlatform The Matter platform class constructor.
26+
* @param HAPPlatform The standard HAP platform class constructor.
27+
* @param MatterPlatform The Matter platform class constructor.
2928
* @returns A proxy class that delegates to the correct platform implementation.
3029
*/
3130
export function createPlatformProxy(HAPPlatform: any, MatterPlatform: any): any {
@@ -35,14 +34,12 @@ export function createPlatformProxy(HAPPlatform: any, MatterPlatform: any): any
3534

3635
constructor(log: any, config: PlatformConfig, api: any) {
3736
const cfg = normalizeConfig(config)
38-
const preferMatter = cfg.preferMatter as boolean
3937
const enableMatter = cfg.enableMatter as boolean
4038
const matterAvailable = !!(api?.isMatterAvailable?.() && api?.isMatterEnabled?.())
4139

42-
if (enableMatter && preferMatter && MatterPlatform && matterAvailable) {
40+
if (enableMatter && MatterPlatform && matterAvailable) {
4341
this.impl = new MatterPlatform(log, cfg, api)
44-
}
45-
else {
42+
} else {
4643
// Fallback to HAP
4744
this.impl = new HAPPlatform(log, cfg, api)
4845
}

0 commit comments

Comments
 (0)