How o-lukas/homebridge-smartthings-tv works
This Homebridge plugin discovers Samsung TVs and soundbars through SmartThings, registers them as Homebridge television accessories, and maps HomeKit controls to SmartThings capabilities. The main workflow is Homebridge registration → platform configuration/authentication → device discovery and type-specific registration → accessory reads and commands. Separate controls cover art mode, switches, sliders, inputs, volume, and TV applications; the UI server supports OAuth code and token exchange. Relationships are limited to calls and references visible in the excerpts or explicit README statements; unsampled implementation details are not inferred.
Main entry points: smartThingsPlatform.ts Device discovery and registration · smartThingsAccessory.ts Capability access and polling · tvAccessory.ts TV controls · index.ts Platform registration
Components 16
Platform lifecycle
- Platform registration
src/index.ts - Platform identifiers
src/settings.ts - Device discovery and registration
src/smartThingsPlatform.ts
Device adapters
- TV controls
src/tvAccessory.ts - Soundbar controls
src/soundbarAccessory.ts - Capability access and polling
src/smartThingsAccessory.ts - TV application catalog
src/tvApps.ts
Accessory controls
- Capability switch
src/switchAccessory.ts - Capability slider
src/sliderAccessory.ts - Art mode switch
src/artModeSwitchAccessory.ts
OAuth configuration
- OAuth UI endpoints
homebridge-ui/server.js
Other components
- Plugin user
- Homebridge
- SmartThings API
- Homebridge Config UI
- SmartThings OAuth
Connections 23
- Plugin user → Homebridge: configures plugin
README.md - Homebridge → Platform registration: loads platform
src/index.ts - Platform registration → Platform identifiers: uses identifiers
src/index.ts - Platform registration → Device discovery and registration: registers platform
src/index.ts - Device discovery and registration → SmartThings API: lists devices
src/smartThingsPlatform.ts - Device discovery and registration → TV controls: registers TV
src/smartThingsPlatform.ts - Device discovery and registration → Soundbar controls: registers soundbar
src/smartThingsPlatform.ts - Device discovery and registration → Capability switch: registers switch
src/smartThingsPlatform.ts - Device discovery and registration → Capability slider: registers slider
src/smartThingsPlatform.ts - Device discovery and registration → Art mode switch: registers art switch
src/smartThingsPlatform.ts - TV controls → Capability access and polling: inherits capability access
src/tvAccessory.ts - Soundbar controls → Capability access and polling: inherits capability access
src/soundbarAccessory.ts - Capability switch → Capability access and polling: delegates capability access
src/switchAccessory.ts - Capability slider → Capability access and polling: delegates capability access
src/sliderAccessory.ts - Art mode switch → Capability access and polling: inherits capability access
src/artModeSwitchAccessory.ts - Capability access and polling → SmartThings API: reads status and sends commands
src/smartThingsAccessory.ts - TV controls → SmartThings API: fetches capabilities and launches apps
src/tvAccessory.ts - Soundbar controls → SmartThings API: fetches capabilities
src/soundbarAccessory.ts - TV controls → TV application catalog: uses application catalog
src/tvAccessory.ts - Art mode switch → TV controls: calls art mode controls
src/artModeSwitchAccessory.ts - Plugin user → Homebridge Config UI: configures OAuth
README.md - Homebridge Config UI → OAuth UI endpoints: requests OAuth endpoints
- OAuth UI endpoints → SmartThings OAuth: exchanges authorization code
homebridge-ui/server.js