This page is intended as a technical reference for maintainers, contributors, and reverse-engineers.
Domain package: custom_components/samsung_smartthings
Key modules:
__init__.py-> setup, services, coordinators, panel APIconfig_flow.py-> onboarding for cloud/local entry typesdevice.py-> SmartThings device helper, execute logic, retriessmartthings_api.py-> SmartThings REST clientframe_local_api.py-> local websocket art client (samsungtvwswrapper)soundbar_local_api.py-> local JSON-RPC client (HTTPS 1516)- Platform modules (
media_player.py,select.py,switch.py, etc.)
Entry types:
cloudsoundbar_localframe_local
Base URL:
https://api.smartthings.com/v1
Main endpoints used:
GET /devicesGET /devices/{deviceId}GET /devices/{deviceId}/statusPOST /devices/{deviceId}/commands
Command payload shape:
{
"commands": [
{
"component": "main",
"capability": "custom.launchapp",
"command": "launchApp",
"arguments": ["111299001912", "YouTube"]
}
]
}The integration hardens against common transient statuses:
409 Conflict429 TooManyRequestError503 Service Unavailable
Design:
- Per-device command serialization (
asyncio.Lock) - Retry/backoff ladder in
send_command - Conservative default polling intervals
- Last-known state retained when refresh hits 429
Many soundbar controls are implemented through execute.
Important href routes:
/sec/networkaudio/soundmode/sec/networkaudio/woofer/sec/networkaudio/eq/sec/networkaudio/advancedaudio/sec/networkaudio/channelVolume/sec/networkaudio/surroundspeaker/sec/networkaudio/activeVoiceAmplifier/sec/networkaudio/spacefitSound
Known issue:
- Some models accept writes but return empty/null execute readback payload.
Mitigation:
- Fallback sound mode candidate sets
- Adaptive alias normalization
- Throttled validation cycles
To handle firmware differences, write candidates include:
adaptiveadaptive_soundadaptive sound- Uppercase variants
Transport:
- HTTPS JSON-RPC (
https://<host>:1516/) - Typically self-signed cert
Token flow:
createAccessToken- Subsequent methods include
AccessToken
Core methods:
powerControlremoteKeyControlinputSelectControlsoundModeControlsetAdvancedSoundSettingsgetVolume,getMute,getCodec,getIdentifier
Night mode strategy:
setAdvancedSoundSettingswithnightMode- Fallback
ms.channel.emitpayload
The wrapper uses samsungtvws art API and adds reliability behavior.
Port probing strategy:
- Last known active port
- Configured port
- Alternates (
8002,8001)
Key methods:
get_api_version,get_artmode,set_artmodeupload,select_image,delete,delete_listget_thumbnail_list,get_currentget_matte_list,change_matteget_photo_filter_list,set_photo_filterget_slideshow_status,set_slideshow_status- Motion + brightness-sensor setters
- TV-level app methods:
app_list,run_app,open_browser
Error heuristics:
-1: unsupported operation for current model/firmware-9: invalid slideshow category
Cloud TV:
- Capability:
custom.launchapp - Entity:
select.<tv>_app - Media behavior:
media_player.play_mediawithapptype and YouTube URL fallback
Frame local:
- Entity:
select.frame_tv_<ip>_app - Media behavior:
app->run_appurl-> YouTube deep-link or browser open
App catalog:
- Curated list of common Tizen app IDs
- Resolver accepts app ID, label, or
app:<id>format
Main service groups:
- Generic cloud:
raw_command,launch_app,set_art_mode,set_ambient_content - Soundbar local:
set_night_mode - Frame lifecycle: upload/select/delete/sync
- Frame advanced: slideshow/motion/brightness sensor
- Frame content helpers: local file, internet collections, favorites
Use services.yaml as the source of truth for service schemas.
Minimal debug workflow:
ha core check/ha_check_config- Restart or targeted reload
- Trigger service call
- Inspect
home-assistant.log
Notes:
- Not all HA errors are caused by this integration.
- Filter logs by
samsung_smartthingsfirst for signal over noise.
- PAT tokens can be temporary (often ~24h)
- For long-term setups: use HA SmartThings login reuse or OAuth2 app flow
- Local APIs provide strong LAN control; limit network exposure accordingly
- Prefer capability-driven behavior over hardcoded model-only logic
- Add fallbacks for inconsistent readback behavior
- Default noisy/fragile entities to diagnostic hidden/disabled
- Retry only known transient status classes
- Provide automation examples for every new user-facing feature