Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.smartthings.smartapp Namespace Reference

Functions

def _continue_flow (HomeAssistant hass, str app_id, str location_id, str installed_app_id, str refresh_token)
 
def _get_app_template (HomeAssistant hass)
 
def create_app (HomeAssistant hass, api)
 
AppEntity|None find_app (HomeAssistant hass, SmartThings api)
 
str format_unique_id (str app_id, str location_id)
 
str get_webhook_url (HomeAssistant hass)
 
def setup_smartapp (hass, app)
 
def setup_smartapp_endpoint (HomeAssistant hass, bool fresh_install)
 
def smartapp_install (HomeAssistant hass, req, resp, app)
 
def smartapp_sync_subscriptions (HomeAssistant hass, str auth_token, str location_id, str installed_app_id, devices)
 
def smartapp_uninstall (HomeAssistant hass, req, resp, app)
 
def smartapp_update (HomeAssistant hass, req, resp, app)
 
def smartapp_webhook (HomeAssistant hass, str webhook_id, request)
 
def unload_smartapp_endpoint (HomeAssistant hass)
 
def update_app (HomeAssistant hass, app)
 
def validate_installed_app (api, str installed_app_id)
 
bool validate_webhook_requirements (HomeAssistant hass)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 

Detailed Description

SmartApp functionality to receive cloud-push notifications.

Function Documentation

◆ _continue_flow()

def homeassistant.components.smartthings.smartapp._continue_flow ( HomeAssistant  hass,
str  app_id,
str  location_id,
str  installed_app_id,
str  refresh_token 
)
private
Continue a config flow if one is in progress for the specific installed app.

Definition at line 403 of file smartapp.py.

◆ _get_app_template()

def homeassistant.components.smartthings.smartapp._get_app_template ( HomeAssistant  hass)
private

Definition at line 117 of file smartapp.py.

◆ create_app()

def homeassistant.components.smartthings.smartapp.create_app ( HomeAssistant  hass,
  api 
)
Create a SmartApp for this instance of hass.

Definition at line 139 of file smartapp.py.

◆ find_app()

AppEntity | None homeassistant.components.smartthings.smartapp.find_app ( HomeAssistant  hass,
SmartThings  api 
)
Find an existing SmartApp for this installation of hass.

Definition at line 67 of file smartapp.py.

◆ format_unique_id()

str homeassistant.components.smartthings.smartapp.format_unique_id ( str  app_id,
str  location_id 
)
Format the unique id for a config entry.

Definition at line 62 of file smartapp.py.

◆ get_webhook_url()

str homeassistant.components.smartthings.smartapp.get_webhook_url ( HomeAssistant  hass)
Get the URL of the webhook.

Return the cloudhook if available, otherwise local webhook.

Definition at line 106 of file smartapp.py.

◆ setup_smartapp()

def homeassistant.components.smartthings.smartapp.setup_smartapp (   hass,
  app 
)
Configure an individual SmartApp in hass.

Register the SmartApp with the SmartAppManager so that hass will service
lifecycle events (install, event, etc...).  A unique SmartApp is created
for each SmartThings account that is configured in hass.

Definition at line 183 of file smartapp.py.

◆ setup_smartapp_endpoint()

def homeassistant.components.smartthings.smartapp.setup_smartapp_endpoint ( HomeAssistant  hass,
bool  fresh_install 
)
Configure the SmartApp webhook in hass.

SmartApps are an extension point within the SmartThings ecosystem and
is used to receive push updates (i.e. device updates) from the cloud.

Definition at line 201 of file smartapp.py.

◆ smartapp_install()

def homeassistant.components.smartthings.smartapp.smartapp_install ( HomeAssistant  hass,
  req,
  resp,
  app 
)
Handle a SmartApp installation and continue the config flow.

Definition at line 436 of file smartapp.py.

◆ smartapp_sync_subscriptions()

def homeassistant.components.smartthings.smartapp.smartapp_sync_subscriptions ( HomeAssistant  hass,
str  auth_token,
str  location_id,
str  installed_app_id,
  devices 
)
Synchronize subscriptions of an installed up.

Definition at line 309 of file smartapp.py.

◆ smartapp_uninstall()

def homeassistant.components.smartthings.smartapp.smartapp_uninstall ( HomeAssistant  hass,
  req,
  resp,
  app 
)
Handle when a SmartApp is removed from a location by the user.

Find and delete the config entry representing the integration.

Definition at line 477 of file smartapp.py.

◆ smartapp_update()

def homeassistant.components.smartthings.smartapp.smartapp_update ( HomeAssistant  hass,
  req,
  resp,
  app 
)
Handle a SmartApp update and either update the entry or continue the flow.

Definition at line 448 of file smartapp.py.

◆ smartapp_webhook()

def homeassistant.components.smartthings.smartapp.smartapp_webhook ( HomeAssistant  hass,
str  webhook_id,
  request 
)
Handle a smartapp lifecycle event callback from SmartThings.

Requests from SmartThings are digitally signed and the SmartAppManager
validates the signature for authenticity.

Definition at line 502 of file smartapp.py.

◆ unload_smartapp_endpoint()

def homeassistant.components.smartthings.smartapp.unload_smartapp_endpoint ( HomeAssistant  hass)
Tear down the component configuration.

Definition at line 280 of file smartapp.py.

◆ update_app()

def homeassistant.components.smartthings.smartapp.update_app ( HomeAssistant  hass,
  app 
)
Ensure the SmartApp is up-to-date and update if necessary.

Definition at line 167 of file smartapp.py.

◆ validate_installed_app()

def homeassistant.components.smartthings.smartapp.validate_installed_app (   api,
str  installed_app_id 
)
Ensure the specified installed SmartApp is valid and functioning.

Query the API for the installed SmartApp and validate that it is tied to
the specified app_id and is in an authorized state.

Definition at line 81 of file smartapp.py.

◆ validate_webhook_requirements()

bool homeassistant.components.smartthings.smartapp.validate_webhook_requirements ( HomeAssistant  hass)
Ensure Home Assistant is setup properly to receive webhooks.

Definition at line 97 of file smartapp.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.smartthings.smartapp._LOGGER = logging.getLogger(__name__)
private

Definition at line 59 of file smartapp.py.