Skip to content

Add Stateful Programmable Switch accessory - #207

Closed
yfre wants to merge 1 commit into
masterfrom
feature/161-stateful-programmable-switch
Closed

yfre wants to merge 1 commit into
masterfrom
feature/161-stateful-programmable-switch

Conversation

@yfre

@yfre yfre commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Closes #161

What

Adds support for the Stateful Programmable Switch service:

New class HAP Details
StatefulProgrammableSwitchAccessory accessory interface switch event (read, events), output state (read, write, events); default getServices()
StatefulProgrammableSwitchService service 00000088 required: Programmable Switch Event (73), Programmable Switch Output State (74); optional: Name (if the accessory implements AccessoryWithName)
ProgrammableSwitchOutputStateCharacteristic characteristic 00000074 uint8, 0–1, step 1, perms pr/pw/ev

This service isn't in Apple's public HAP specification or the HomeKit ADK. The definitions follow HAP-NodeJS, as the issue suggests. ProgrammableSwitchOutputStateCharacteristic uses the IntegerCharacteristic format constructor from #203 to advertise uint8.

Compatibility

Purely additive: three new classes and no changes to existing classes. Behavior is unchanged for existing accessories, including openHAB setups.

Caveat

Reports from the homebridge community suggest the Apple Home app doesn't display stateful programmable switches; third-party HomeKit apps can use them. I haven't verified this on a device. Library users get the API either way, but end users may only see it in third-party apps.

Testing

mvn -B package on JDK 11: all 28 tests pass. The new StatefulProgrammableSwitchServiceTest covers:

  • service type 88 and the required characteristic order (73, 74), plus Name when AccessoryWithName is implemented
  • the default getServices() returning the stateful switch service
  • output state JSON: uint8, pr/pw/ev, min 0, max 1, minStep 1, no unit
  • writes reaching setSwitchOutputState, and subscribe/unsubscribe delegation
  • the switch event staying read-only with events

🤖 Generated with Claude Code

Add StatefulProgrammableSwitchAccessory, StatefulProgrammableSwitchService
(0x88) and ProgrammableSwitchOutputStateCharacteristic (0x74, uint8,
0..1, pr/pw/ev). The service is not in the public HAP specification;
the definitions follow HAP-NodeJS. Purely additive: no existing class
changes.
@ccutrer

ccutrer commented Oct 19, 2026

Copy link
Copy Markdown
Member

I'll admit I'm still cloudy on how this is even intended to be used. At the least I'd like to see a comment linking to https://developer.apple.com/documentation/homekit/hmservicetypestatefulprogrammableswitch showing it's a real thing, even if it is poorly documented.

@yfre

yfre commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@ccutrer i was also thinking about it yesterday. i tend to drop this PR as there is not use for it. i just had on the list of accessories which HAP supports.. but again, unclear how to use it.

i will drop this PR.
thank you for the review, two other PRs should be more useful :)

@yfre yfre closed this Oct 19, 2026
@yfre
yfre deleted the feature/161-stateful-programmable-switch branch October 19, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add support for StatefulProgrammableSwitch

2 participants