### install(Addon addon) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/marketplace/marketplaceaddonhandler Installs a given add-on. ```APIDOC ## void install(Addon addon) ### Description Installs a given add-on. This method is only called if the handler claimed support for the add-on. ### Parameters - **addon** (Addon) - The add-on to install. ### Throws - **MarketplaceHandlerException** - If the installation failed for some reason. ``` -------------------------------- ### createAddonInstalledEvent(String id) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addoneventfactory Creates an event representing the successful installation of an add-on. ```APIDOC ### static AddonEvent createAddonInstalledEvent(String id) Creates an "add-on installed" event. #### Parameters - **id** (String) - The ID of the installed add-on. #### Returns - **AddonEvent** - The created event instance. ``` -------------------------------- ### startDialog Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiodialogprovider Starts a dialog and returns a runnable that triggers it or null if the dialog initialization fails. ```APIDOC ## startDialog ### Description Starts a dialog and returns a runnable that triggers it or null if the dialog initialization fails. ### Signature `@Nullable Runnable startDialog(AudioSink audioSink, AudioSource audioSource, @Nullable String locationItem, @Nullable String listeningItem, @Nullable Runnable onAbort)` ### Parameters - **audioSink** (AudioSink) - Required - The audio sink to play sound. - **audioSource** (AudioSource) - Required - The audio source to capture sound. - **locationItem** (String) - Optional - An optional Item name to scope dialog commands. - **listeningItem** (String) - Optional - An optional Item name to toggle while dialog is listening, overwrites default. - **onAbort** (Runnable) - Optional - An optional Runnable instance to call on abort. ### Returns - **Runnable** - A Runnable instance to trigger dialog processing or null if the dialog initialization fails. ``` -------------------------------- ### isInstalled(String id) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/marketplace/marketplaceaddonhandler Checks if a specific add-on is currently installed. ```APIDOC ## boolean isInstalled(String id) ### Description Tells whether a given add-on is currently installed. This method is only called if the handler claimed support for the add-on. ### Parameters - **id** (String) - The id of the add-on in question. ### Returns - **boolean** - true if the add-on is installed, false otherwise. ``` -------------------------------- ### HTTP Redirect Example Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Example of an HTTP 302 redirect response containing authorization code and state parameters. ```http HTTP/1.1 302 Found Location: https://client.example.com/cb?code=SplxlOBeZQQYbYS6WxSbIA&state=xyz ``` -------------------------------- ### get(String scope, String thingUid) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/module/script/defaultscope/scriptthingactions Retrieves an actions instance for a specific scope and thing UID. ```APIDOC ## get(String scope, String thingUid) ### Description Gets an actions instance of a certain scope for a given thing UID. ### Parameters - **scope** (String) - The action scope. - **thingUid** (String) - The UID of the thing. ### Returns - **ThingActions** - The actions instance or null if not available. ``` -------------------------------- ### getInputStream(AudioFormat format) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiosource Gets an AudioStream for reading audio data in a supported audio format. ```APIDOC ## AudioStream getInputStream(AudioFormat format) ### Description Gets an AudioStream for reading audio data in supported audio format. ### Parameters - **format** (AudioFormat) - Required - The expected audio format of the stream. ### Returns - **AudioStream** - AudioStream for reading audio data. ### Throws - **AudioException** - If a problem occurs obtaining the stream. ``` -------------------------------- ### Get Access Token by Implicit Grant Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Handles the implicit grant flow, typically used in browser or JavaScript-based redirection scenarios. ```java AccessTokenResponse getAccessTokenByImplicit(@Nullable String redirectURI, @Nullable String scope, @Nullable String state) throws OAuthException, IOException, OAuthResponseException ``` -------------------------------- ### Get Access Token by Resource Owner Password Credentials Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Authenticates using direct user credentials when the username and password are known to the client. ```java AccessTokenResponse getAccessTokenByResourceOwnerPasswordCredentials(String username, String password, @Nullable String scope) throws OAuthException, IOException, OAuthResponseException ``` -------------------------------- ### Get Access Token by Client Credentials Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Retrieves an access token using only client credentials, without involving a human resource owner. ```java AccessTokenResponse getAccessTokenByClientCredentials(@Nullable String scope) throws OAuthException, IOException, OAuthResponseException ``` -------------------------------- ### Get Device Code Response Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Initiates the RFC-8628 Device Code Grant Flow to obtain verification URIs for user authentication. ```java @Nullable DeviceCodeResponseDTO getDeviceCodeResponse() throws OAuthException ``` -------------------------------- ### Get Access Token Response Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Retrieves the current access token, automatically handling expiration and refresh tokens if available. ```java @Nullable AccessTokenResponse getAccessTokenResponse() throws OAuthException, IOException, OAuthResponseException ``` -------------------------------- ### Get Access Token Response by Authorization Code Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Retrieves an access token using an authorization code, following the RFC 6749 Authorization Code Grant flow. ```java AccessTokenResponse getAccessTokenResponseByAuthorizationCode(String authorizationCode, @Nullable String redirectURI) throws OAuthException, IOException, OAuthResponseException ``` -------------------------------- ### serve(AudioStream, int, boolean) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiohttpserver Creates a relative URL for an AudioStream, allowing it to be requested one or multiple times within a specified time frame. ```APIDOC ## Method: serve(AudioStream stream, int seconds, boolean multiTimeStream) ### Description Creates a relative URL for a given AudioStream where it can be requested one or multiple times within the given time frame. If multiTimeStream is true, the stream is made cloneable if it is not already. ### Parameters - **stream** (AudioStream) - Required - The stream to serve on HTTP. - **seconds** (int) - Required - Number of seconds for which the stream is available through HTTP. - **multiTimeStream** (boolean) - Required - Set to true if this stream should be played multiple times. ### Returns - **StreamServed** - Information about the served stream, including the relative URL and a CompletableFuture to track playback completion. ### Throws - **IOException** - Thrown when the stream is not a ClonableAudioStream and cannot be stored on disk. ``` -------------------------------- ### isReady() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/marketplace/marketplaceaddonhandler Checks if the handler is ready to accept requests. ```APIDOC ## default boolean isReady() ### Description Checks if the add-on handler is ready to accept requests after instantiation. This is useful if initialization takes time. ### Returns - **boolean** - true if the initialization finished. ``` -------------------------------- ### playFile(String, String, PercentType) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiomanager Plays an audio file from the sounds folder on a specified sink at a given volume. ```APIDOC ### Method void playFile(String fileName, @Nullable String sinkId, @Nullable PercentType volume) ### Description Plays an audio file from the "sounds" folder using the given audio sink at the specified volume. ### Parameters - **fileName** (String) - The file from the "sounds" folder. - **sinkId** (String) - The id of the audio sink to use or null for the default. - **volume** (PercentType) - The volume to be used. ``` -------------------------------- ### playFile Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiomanager Plays an audio file from the 'sounds' folder using a specified or default audio sink and volume. ```APIDOC ### playFile(String fileName, @Nullable PercentType volume) ### playFile(String fileName, @Nullable String sinkId) ### playFile(String fileName, @Nullable String sinkId, @Nullable PercentType volume) Plays an audio file from the 'sounds' folder. Parameters: - **fileName** (String) - The file from the 'sounds' folder. - **volume** (PercentType) - The volume to be used or null if the default notification volume should be used. - **sinkId** (String) - The id of the audio sink to use or null for the default. Throws: - **AudioException** - in case the file does not exist or cannot be opened. ``` -------------------------------- ### getAddonInfos() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addoninforegistry Retrieves all add-on information contained in the registry. ```APIDOC ## getAddonInfos() ### Description Returns all add-on information this registry contains. ### Returns - **Set** - A set of all add-on information (not null, could be empty). ``` -------------------------------- ### record(int, String, String) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiomanager Records audio to a WAV file in the sounds folder. ```APIDOC ### Method void record(int seconds, String filename, @Nullable String sourceId) ### Description Record audio as a WAV file of the specified length to the sounds folder. ### Parameters - **seconds** (int) - The duration of the recording in seconds. - **filename** (String) - The name of the file to save. - **sourceId** (String) - The id of the audio source to use. ``` -------------------------------- ### AddonInfoList() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addoninfolist Constructs a new AddonInfoList instance. ```APIDOC ### Constructor `public AddonInfoList()` Creates an empty instance of the AddonInfoList DTO. ``` -------------------------------- ### Authentication authenticate(Credentials credentials) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/authenticationmanager Attempts to authenticate using the provided credentials. Throws an AuthenticationException if authentication fails. ```APIDOC ## authenticate(Credentials credentials) ### Description Performs an authentication attempt with the specified credentials. This is the primary method for verifying the originator of a request. ### Parameters - **credentials** (Credentials) - Required - The credentials object used for the authentication attempt. ### Returns - **Authentication** - Returns an Authentication object upon success. A null value is never returned. ### Throws - **AuthenticationException** - Thrown when the authentication attempt fails for any reason, including when no available authentication methods succeed. ``` -------------------------------- ### startParsingFormat Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/converter/ruletemplateparser Parses the provided syntax string without impacting the rule template registry. ```APIDOC ## String startParsingFormat(String syntax, List errors, List warnings) ### Description Parses the provided syntax string without impacting the rule template registry. ### Parameters - **syntax** (String) - The syntax in format. - **errors** (List) - The list to use to report errors. - **warnings** (List) - The list to be used to report warnings. ### Returns - **String** - The model name used for parsing if the parsing succeeded without errors; null otherwise. ``` -------------------------------- ### AudioFormat Constructor Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audioformat Constructs an instance of AudioFormat with specified properties. Null values indicate that any value is allowed for that property. ```APIDOC ## Constructor: AudioFormat(String container, String codec, Boolean bigEndian, Integer bitDepth, Integer bitRate, Long frequency, Integer channels) ### Description Creates a new AudioFormat instance. Properties set to null act as wildcards, allowing any value for that specific attribute. ### Parameters - **container** (String) - Optional - The container format. - **codec** (String) - Optional - The audio codec. - **bigEndian** (Boolean) - Optional - Endianness of the audio data. - **bitDepth** (Integer) - Optional - Bit depth of the audio data. - **bitRate** (Integer) - Optional - Bit rate of the audio. - **frequency** (Long) - Optional - Sampling frequency. - **channels** (Integer) - Optional - Number of audio channels. ``` -------------------------------- ### getBestMatch Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audioformat Finds the best matching format between two sets of audio formats. ```APIDOC ## Method: getBestMatch(Set inputs, Set outputs) ### Description Determines the best match between a set of formats supported by a source and a set supported by a sink. ### Parameters - **inputs** (Set) - Required - Supported formats of the source. - **outputs** (Set) - Required - Supported formats of the sink. ### Returns - **AudioFormat** - The best matching format, or null if no compatible format exists. ``` -------------------------------- ### getAddonInfo(String uid) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addoninforegistry Retrieves the add-on information for a specific add-on UID. ```APIDOC ## getAddonInfo(String uid) ### Description Returns the add-on information for the specified add-on UID, or null if no add-on information could be found. ### Parameters - **uid** (String) - Required - The UID to be looked up. ### Returns - **AddonInfo** - The add-on information object, or null if not found. ``` -------------------------------- ### UnsupportedAudioFormatException Constructors Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/unsupportedaudioformatexception Constructors for creating a new instance of the UnsupportedAudioFormatException. ```APIDOC ## Constructor: UnsupportedAudioFormatException(String message, AudioFormat unsupportedFormat) ### Description Constructs a new exception with the specified detail message and unsupported format. ### Parameters - **message** (String) - Detail message - **unsupportedFormat** (AudioFormat) - Unsupported format ## Constructor: UnsupportedAudioFormatException(String message, AudioFormat unsupportedFormat, Throwable cause) ### Description Constructs a new exception with the specified detail message, unsupported format, and cause. ### Parameters - **message** (String) - Detail message - **unsupportedFormat** (AudioFormat) - Unsupported format - **cause** (Throwable) - The cause ``` -------------------------------- ### getSupportedFormats() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiosource Obtains the audio formats supported by the AudioSource. ```APIDOC ## Set getSupportedFormats() ### Description Obtain the audio formats supported by this AudioSource. ### Returns - **Set** - The audio formats supported by this service. ``` -------------------------------- ### record Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiomanager Records audio as a WAV file of a specified length to the sounds folder. ```APIDOC ### record(int seconds, String filename, @Nullable String sourceId) Record audio as a WAV file of the specified length. Parameters: - **seconds** (int) - Seconds to record. - **filename** (String) - Record filename. - **sourceId** (String) - The id of the audio source to use or null for the default. Throws: - **AudioException** ``` -------------------------------- ### AuthenticationProvider Methods Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/authenticationprovider Methods available for implementing or interacting with an AuthenticationProvider. ```APIDOC ## Authentication authenticate(Credentials credentials) ### Description Verify given credentials and return an authentication object if they are valid. ### Parameters - **credentials** (Credentials) - User credentials to verify. ### Returns - **Authentication** - The authentication object defining access scope, or null if credentials are invalid. ### Throws - **AuthenticationException** - If authentication failed due to a credentials mismatch. ## boolean supports(Class type) ### Description Verify if the authentication provider can handle a specific type of credentials. ### Parameters - **type** (Class) - The type of credentials to check. ### Returns - **boolean** - True if the credentials type is supported, false otherwise. ``` -------------------------------- ### isCompatible Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audioformat Checks if a given AudioFormat is compatible with the current instance. ```APIDOC ## Method: isCompatible(AudioFormat audioFormat) ### Description Determines if the provided AudioFormat is compatible with this instance. Compatibility is defined as having the same values for all non-null members of this instance. ### Parameters - **audioFormat** (AudioFormat) - Optional - The format to check against. ``` -------------------------------- ### startParsingFormat Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/converter/ruleparser Parses a provided syntax string to validate rule formatting without affecting the rule registry. ```APIDOC ## startParsingFormat ### Description Parses the provided syntax string without impacting the rule registry. Returns the model name if successful, or null otherwise. ### Method Java Interface Method ### Parameters - **syntax** (String) - Required - The syntax in format. - **errors** (List) - Required - The list to use to report errors. - **warnings** (List) - Required - The list to be used to report warnings. ### Returns - **String** - The model name used for parsing if the parsing succeeded without errors; null otherwise. ``` -------------------------------- ### getAddonInfo(String uid, Locale locale) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addoninforegistry Retrieves the localized add-on information for a specific add-on UID. ```APIDOC ## getAddonInfo(String uid, Locale locale) ### Description Returns the add-on information for the specified add-on UID and locale, or null if no add-on information could be found. If multiple providers exist, it returns a merged AddonInfo object. ### Parameters - **uid** (String) - Required - The UID to be looked up. - **locale** (Locale) - Optional - The locale to be used for the add-on information. ### Returns - **AddonInfo** - The localized add-on information object, or null if not found. ``` -------------------------------- ### getAddons() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addoninfolist Retrieves the list of addons contained in this DTO. ```APIDOC ### Method `public List getAddons()` Returns the list of `AddonInfo` objects currently stored in the DTO. ``` -------------------------------- ### play(AudioStream, String, PercentType) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiomanager Plays an audio stream on a specified sink at a given volume. ```APIDOC ### Method void play(@Nullable AudioStream audioStream, @Nullable String sinkId, @Nullable PercentType volume) ### Description Plays the passed audio stream on the given sink. If sinkId is null, the default sink is used. If volume is null, the default notification volume is used. ### Parameters - **audioStream** (AudioStream) - The audio stream to play or null if streaming should be stopped. - **sinkId** (String) - The id of the audio sink to use or null for the default. - **volume** (PercentType) - The volume to be used or null if the default notification volume should be used. ``` -------------------------------- ### Addon.Builder Methods Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addon.builder The Addon.Builder class provides a set of methods to configure an Addon object before calling the build() method. ```APIDOC ## Addon.Builder Methods ### Description The Addon.Builder class is used to construct an Addon instance. Each method returns the builder instance to allow for method chaining. ### Methods - **withId(String id)**: Sets the ID of the addon. - **withLabel(String label)**: Sets the label of the addon. - **withVersion(String version)**: Sets the version of the addon. - **withType(String type)**: Sets the type of the addon. - **withMaturity(String maturity)**: Sets the maturity level of the addon. - **withCompatible(boolean compatible)**: Sets the compatibility status. - **withInstalled(boolean installed)**: Sets the installation status. - **withDescription(String description)**: Sets the description. - **withDetailedDescription(String detailedDescription)**: Sets the detailed description. - **withAuthor(String author)** / **withAuthor(String author, boolean verifiedAuthor)**: Sets the author information. - **withProperty(String key, Object value)**: Adds a single property. - **withProperties(Map properties)**: Sets multiple properties. - **build()**: Constructs and returns the final Addon object. ``` -------------------------------- ### processAndComplete(AudioStream audioStream) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiosinksync Processes the provided audio stream and returns a CompletableFuture that completes when playback is finished. ```APIDOC ## processAndComplete(AudioStream audioStream) ### Description Processes the passed AudioStream and returns a CompletableFuture that should complete when the sound is fully played. If the stream is null, it is interpreted as a request to end any currently playing stream. ### Parameters - **audioStream** (AudioStream) - The audio stream to play or null to keep quiet. ### Returns - **CompletableFuture** - A future completed when the sound is fully played. May complete with UnsupportedAudioFormatException or UnsupportedAudioStreamException. ``` -------------------------------- ### getId() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiosource Returns a simple string that uniquely identifies the audio service. ```APIDOC ## String getId() ### Description Returns a simple string that uniquely identifies this service. ### Returns - **String** - An id that identifies this service. ``` -------------------------------- ### supports(String type, String contentType) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/marketplace/marketplaceaddonhandler Checks if the handler supports a specific add-on type and content type. ```APIDOC ## boolean supports(String type, String contentType) ### Description Tells whether this handler supports a given add-on based on its type and content type. ### Parameters - **type** (String) - The type of the add-on in question. - **contentType** (String) - The content type of the add-on in question. ### Returns - **boolean** - true if the addon type and contentType are supported, false otherwise. ``` -------------------------------- ### getAddonInfos(Locale locale) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addoninforegistry Retrieves all add-on information in the specified locale. ```APIDOC ## getAddonInfos(Locale locale) ### Description Returns all add-on information in the specified locale that this registry contains. ### Parameters - **locale** (Locale) - Optional - The locale to be used for the add-on information. ### Returns - **Set** - A localized set of all add-on information (not null, could be empty). ``` -------------------------------- ### createAddonUninstalledEvent(String id) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addoneventfactory Creates an event representing the uninstallation of an add-on. ```APIDOC ### static AddonEvent createAddonUninstalledEvent(String id) Creates an "add-on uninstalled" event. #### Parameters - **id** (String) - The ID of the uninstalled add-on. #### Returns - **AddonEvent** - The created event instance. ``` -------------------------------- ### getUnsupportedFormat() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/unsupportedaudioformatexception Retrieves the audio format that caused the exception. ```APIDOC ## Method: getUnsupportedFormat() ### Description Gets the unsupported format. ### Returns - **AudioFormat** - The unsupported format ``` -------------------------------- ### sendCommand Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/module/script/action/busevent Sends a command for a specified item to the event bus. ```APIDOC ## void sendCommand(Item item, Command command) ### Description Sends a command for a specified item to the event bus. ### Parameters - **item** (Item) - Required - The item to send the command to - **command** (Command) - Required - The command to send ``` ```APIDOC ## void sendCommand(Item item, Command command, String source) ### Description Sends a command for a specified item to the event bus with an optional source. ### Parameters - **item** (Item) - Required - The item to send the command to - **command** (Command) - Required - The command to send - **source** (String) - Optional - The source of the command ``` -------------------------------- ### compile() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/handler/conditionhandler Compiles the condition when the rule is initialized. ```APIDOC ## void compile() ### Description Called to compile the Condition when the Rule is initialized. ### Throws - Exception - if the compilation fails ``` -------------------------------- ### Transformation.transform(String serviceName, String function, String value) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/transform/actions/package-summary Executes a transformation using a specified service and function on a given input value. ```APIDOC ## Transformation.transform ### Description Executes a transformation on a provided string value using the specified transformation service and function. ### Signature `public static String transform(String serviceName, String function, String value)` ### Parameters - **serviceName** (String) - The name of the transformation service to use (e.g., "MAP", "REGEX"). - **function** (String) - The specific transformation function or mapping file to apply. - **value** (String) - The input value to be transformed. ### Returns - **String** - The transformed result, or the original value if the transformation fails. ``` -------------------------------- ### Import Access Token Response Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Imports or migrates an existing AccessTokenResponse into the service storage. ```java void importAccessTokenResponse(AccessTokenResponse accessTokenResponse) throws OAuthException ``` -------------------------------- ### getDeviceCodeResponse Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Initiates the RFC-8628 Device Code Grant Flow. ```APIDOC ## @Nullable DeviceCodeResponseDTO getDeviceCodeResponse() ### Description Begins the RFC-8628 Device Code Grant Flow authentication process, including POSTing to the authorize URL and processing the response. ### Returns - **DeviceCodeResponseDTO** - Contains the verification URIs for user authentication, or null. ### Throws - **OAuthException** - **IOException** - **OAuthResponseException** ``` -------------------------------- ### AudioManager Methods Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiomanager Methods available in the AudioManager interface for interacting with audio sources and sinks. ```APIDOC ## getSourceId() Retrieves the default AudioSource id if any. ## getSource() Retrieves an AudioSource. If a default name is configured and the service available, this is returned. If no default name is configured, the first available service is returned. ## getAllSources() Retrieves all audio sources. ## getSource(String sourceId) Retrieves the audio sources for a given id. Parameters: sourceId (String) - the id of the audio sources or null for the default. ## getSourceIds(String pattern) Get a list of source ids that match a given pattern. Parameters: pattern (String) - pattern to search, can include * and ? placeholders. ## getSinkId() Retrieves the default AudioSink id if any. ## getSink() Retrieves an AudioSink. If a default name is configured and the service available, this is returned. ## getAllSinks() Retrieves all audio sinks. ## getSink(String sinkId) Retrieves the sink for a given id. Parameters: sinkId (String) - the id of the sink or null for the default. ## getSinkIds(String pattern) Get a list of sink ids that match a given pattern. Parameters: pattern (String) - pattern to search, can include * and ? placeholders. ## handleVolumeCommand(PercentType volume, AudioSink sink) Handles a volume command change and returns a Runnable to restore it. Parameters: volume (PercentType) - The volume to set, sink (AudioSink) - The sink to set the volume to. ``` -------------------------------- ### createLocalizedAddonInfo Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addoni18nlocalizationservice Localizes an AddonInfo object using resources from a specified OSGi bundle and a target locale. ```APIDOC ## createLocalizedAddonInfo ### Description Localizes an add-on info object. If translation is successful, it returns a localized AddonInfo; otherwise, it returns the original non-localized object. ### Signature `AddonInfo createLocalizedAddonInfo(org.osgi.framework.Bundle bundle, AddonInfo addonInfo, @Nullable Locale locale)` ### Parameters - **bundle** (org.osgi.framework.Bundle) - Required - The bundle where the i18n resources are located. - **addonInfo** (AddonInfo) - Required - The add-on info that should be localized. - **locale** (Locale) - Optional - The locale to which the info should be localized. ### Returns - **AddonInfo** - A localized add-on info on success, or a non-localized one on error. ``` -------------------------------- ### getFormat() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiostream Retrieves the audio format associated with the stream. ```APIDOC ### getFormat() #### Description Gets the supported audio format for the stream. #### Returns - **AudioFormat** - The supported audio format. ``` -------------------------------- ### playMelody Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiomanager Parses and synthesizes a melody string and plays it into a specified or default sink. ```APIDOC ### playMelody(String melody) ### playMelody(String melody, @Nullable String sinkId) ### playMelody(String melody, @Nullable String sinkId, @Nullable PercentType volume) Parse and synthesize a melody. The melody should be a space separated list of note names or silences (character 0 or O). Optionally add ' to increase the note one octave or :ms to customize duration. Parameters: - **melody** (String) - The melody string. - **sinkId** (String) - The id of the audio sink to use or null for the default. - **volume** (PercentType) - The volume to be used or null if the default notification volume should be used. ``` -------------------------------- ### fromString(String note) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/utils/tonesynthesizer.note Parses a string to return the corresponding musical note. ```APIDOC ## static Optional fromString(String note) ### Description Attempts to resolve a musical note from a given string representation. ### Parameters - **note** (String) - The string representation of the note. ### Returns - **Optional** - An Optional containing the note if found, otherwise empty. ``` -------------------------------- ### setAddons(List addons) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addoninfolist Sets the list of addons for this DTO. ```APIDOC ### Method `public AddonInfoList setAddons(@Nullable List addons)` Sets the list of `AddonInfo` objects. Returns the current `AddonInfoList` instance for chaining. ``` -------------------------------- ### process(AudioStream audioStream) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiosinksync Processes the provided audio stream synchronously. ```APIDOC ## process(AudioStream audioStream) ### Description Processes the passed AudioStream. If the stream is not supported, an UnsupportedAudioStreamException is thrown. If the format is not supported, an UnsupportedAudioFormatException is thrown. ### Parameters - **audioStream** (AudioStream) - The audio stream to play or null to keep quiet. ### Throws - **UnsupportedAudioFormatException** - If audioStream format is not supported. - **UnsupportedAudioStreamException** - If audioStream is not supported. ``` -------------------------------- ### getPreferredFormat Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audioformat Selects the preferred AudioFormat from a set. ```APIDOC ## Method: getPreferredFormat(Set audioFormats) ### Description Selects the first concrete AudioFormat or a preferred one based on default values (16bit, 16KHz, big endian). ### Parameters - **audioFormats** (Set) - Required - The set of available formats. ### Returns - **AudioFormat** - The preferred format, or null if none could be determined. ``` -------------------------------- ### transferAndAnalyzeLength(InputStream in, OutputStream out, AudioFormat audioFormat) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/utils/audiosinkutilsimpl Transfers data from an input stream to an output stream and computes the duration of the audio on the fly. ```APIDOC ## Method: transferAndAnalyzeLength ### Description Transfers audio data from an input stream to an output stream and computes the duration of the audio content during the transfer. ### Signature `public @Nullable Long transferAndAnalyzeLength(InputStream in, OutputStream out, AudioFormat audioFormat) throws IOException` ### Parameters - **in** (InputStream) - The input stream providing the audio data. - **out** (OutputStream) - The output stream receiving the audio data. - **audioFormat** (AudioFormat) - The format of the audio data. ### Returns - **Long** - The timestamp (from System.nanoTime) when the sound should be fully played. Returns null if the computation fails. ### Throws - **IOException** - If reading from or writing to the stream fails. ``` -------------------------------- ### isExtension(String filename, String extension) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/utils/audiostreamutils Checks if a filename matches a specific extension. ```APIDOC ## static boolean isExtension(String filename, String extension) ### Description Checks if the extension of a filename matches the given extension. ### Parameters - **filename** (String) - The filename to check the extension of. - **extension** (String) - The extension to check for. ### Returns - (boolean) - True if the filename has the specified extension. ``` -------------------------------- ### transferAndAnalyzeLength Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/utils/audiosinkutils Transfers audio data from an input stream to an output stream and calculates the duration on the fly. ```APIDOC ## transferAndAnalyzeLength ### Description Transfers data from an input stream to an output stream and computes its duration on the fly. ### Signature `@Nullable Long transferAndAnalyzeLength(InputStream in, OutputStream out, AudioFormat audioFormat) throws IOException` ### Parameters - **in** (InputStream) - The input stream providing audio data. - **out** (OutputStream) - The output stream receiving audio data. - **audioFormat** (AudioFormat) - The format of the audio data. ### Returns - **Long** - The timestamp (from System.nanoTime) when the sound should be fully played. Returns null if computing time fails. ### Throws - **IOException** - If reading from or writing to the stream fails. ``` -------------------------------- ### createOAuthClientService Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthfactory Creates a new OAuth service instance. This method should be used once to obtain and store a handle for persistent use. ```APIDOC ## createOAuthClientService ### Description Creates a new OAuth service. Use this method only once to obtain a handle and store this handle for further use in a persistent storage container. ### Parameters - **handle** (String) - Required - The handle to the OAuth service - **tokenUrl** (String) - Required - The token URL of the OAuth provider - **authorizationUrl** (String) - Optional - The authorization URL of the OAuth provider - **clientId** (String) - Required - The client ID - **clientSecret** (String) - Optional - The client secret - **scope** (String) - Optional - The desired scope - **supportsBasicAuth** (Boolean) - Optional - Whether the OAuth provider supports basic authorization ``` -------------------------------- ### Volume Control Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiomanager Methods to retrieve and set the volume of an audio sink. ```APIDOC ### getVolume(@Nullable String sinkId) Retrieves the current volume of a sink. - **sinkId** (String) - The sink to get the volume for or null for the default. - **Returns** (PercentType) - The volume as a value between 0 and 100. ### setVolume(PercentType volume, @Nullable String sinkId) Sets the volume for a sink. - **volume** (PercentType) - The volume to set as a value between 0 and 100. - **sinkId** (String) - The sink to set the volume for or null for the default. Throws: - **IOException** - if the sink is not able to determine or set the volume. ``` -------------------------------- ### stream Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiomanager Streams audio from a URL to a specified or default audio sink. ```APIDOC ### stream(@Nullable String url) ### stream(@Nullable String url, @Nullable String sinkId) Stream audio from the passed url. Parameters: - **url** (String) - The url to stream from or null if streaming should be stopped. - **sinkId** (String) - The id of the audio sink to use or null for the default. Throws: - **AudioException** - in case the url stream cannot be opened. ``` -------------------------------- ### createTimer Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/module/script/action/scriptexecution Schedules a block of code for later execution. ```APIDOC ## createTimer(ZonedDateTime zonedDateTime, Runnable closure) ### Description Schedules a block of code for later execution. ### Parameters - **zonedDateTime** (ZonedDateTime) - Required - The point in time when the code should be executed. - **closure** (Runnable) - Required - The code block to execute. ### Returns - **Timer** - A handle to the created timer, so that it can be canceled or rescheduled. ``` -------------------------------- ### MeterRegistryProvider Source: https://www.openhab.org/javadoc/latest/org/openhab/core/io/monitor/package-summary The MeterRegistryProvider interface is used to retrieve the default openHAB meter registry instance for monitoring purposes. ```APIDOC ## MeterRegistryProvider ### Description Provides a mechanism to retrieve the default openHAB meter registry instance. ### Interface org.openhab.core.io.monitor.MeterRegistryProvider ``` -------------------------------- ### uninstall(Addon addon) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/marketplace/marketplaceaddonhandler Uninstalls a given add-on. ```APIDOC ## void uninstall(Addon addon) ### Description Uninstalls a given add-on. This method is only called if the handler claimed support for the add-on. ### Parameters - **addon** (Addon) - The add-on to uninstall. ### Throws - **MarketplaceHandlerException** - If the uninstallation failed for some reason. ``` -------------------------------- ### createExecutionEvent Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/events/automationeventfactory Creates a new ExecutionEvent instance. ```APIDOC ## static ExecutionEvent createExecutionEvent(String moduleId, @Nullable Map payload, String source) ### Description Creates an ExecutionEvent for rule execution tracking. ### Parameters - **moduleId** (String) - The module type id of this event. - **payload** (Map) - A map with additional information like preceding events (optional). - **source** (String) - The source of this event (e.g., "script" or "manual"). ### Returns - **ExecutionEvent** - The created event. ``` -------------------------------- ### getExtension(String filename) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/utils/audiostreamutils Retrieves the extension of a given filename string. ```APIDOC ## static String getExtension(String filename) ### Description Gets the extension of a filename. ### Parameters - **filename** (String) - The filename to retrieve the extension of. ### Returns - (String) - The extension of the file, an empty string if none exists, or null if the input is null. ``` -------------------------------- ### size() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/pipedaudiostream.group Returns the count of currently connected streams. ```APIDOC ### int size() Returns the number of streams connected. **Returns:** - `int`: The number of streams connected. ``` -------------------------------- ### ScriptThingActions Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/module/script/defaultscope/package-summary The ScriptThingActions interface provides methods that are automatically exposed as global functions within automation scripts. ```APIDOC ## ScriptThingActions ### Description The methods defined in the ScriptThingActions interface are made available as global functions within the script execution environment, allowing scripts to interact with Things directly. ### Usage These functions are automatically injected into the script scope and can be called without explicit instantiation. ``` -------------------------------- ### createTimerWithArgument Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/module/script/action/scriptexecution Schedules a block of code with an argument for later execution. ```APIDOC ## createTimerWithArgument(ZonedDateTime zonedDateTime, Object arg1, Consumer closure) ### Description Schedules a block of code (with argument) for later execution. ### Parameters - **zonedDateTime** (ZonedDateTime) - Required - The point in time when the code should be executed. - **arg1** (Object) - Required - The argument to pass to the code block. - **closure** (Consumer) - Required - The code block to execute. ### Returns - **Timer** - A handle to the created timer, so that it can be canceled or rescheduled. ``` -------------------------------- ### createTimerWithArgument (with identifier) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/module/script/action/scriptexecution Schedules a block of code with an argument for later execution with an optional identifier. ```APIDOC ## createTimerWithArgument(@Nullable String identifier, ZonedDateTime zonedDateTime, Object arg1, Consumer closure) ### Description Schedules a block of code (with argument) for later execution with an optional identifier. ### Parameters - **identifier** (String) - Optional - An optional identifier. - **zonedDateTime** (ZonedDateTime) - Required - The point in time when the code should be executed. - **arg1** (Object) - Required - The argument to pass to the code block. - **closure** (Consumer) - Required - The code block to execute. ### Returns - **Timer** - A handle to the created timer, so that it can be canceled or rescheduled. ``` -------------------------------- ### getOAuthClientService Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthfactory Retrieves an existing OAuth service instance associated with the provided handle. ```APIDOC ## getOAuthClientService ### Description Gets the OAuth service for a given handle. ### Parameters - **handle** (String) - Required - The handle to the OAuth service ### Returns - **OAuthClientService** - The OAuth service or null if it does not exist ``` -------------------------------- ### getId() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/audiostream Retrieves the unique identifier for the audio stream. ```APIDOC ### getId() #### Description Returns a string uniquely identifying the stream, which is useful for sinks playing the same stream multiple times to avoid redundant computations like re-encoding. #### Returns - **String** (Nullable) - A string uniquely identifying the stream. ``` -------------------------------- ### parseWavFormat(InputStream inputStream) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/utils/audiowaveutils Parses the audio format from a WAV file input stream. The stream must contain a fmt header and support mark/reset operations. ```APIDOC ## static AudioFormat parseWavFormat(InputStream inputStream) ### Description Parses the audio format from a provided WAV file input stream. The stream must have a fmt header and support the mark/reset method. ### Parameters - **inputStream** (InputStream) - Required - An InputStream of a wav file to analyze. ### Returns - **AudioFormat** - The audio format, or the default audio format if an error occurred. ### Throws - **IOException** - If an I/O exception occurs, or if the InputStream does not support mark/reset. ``` -------------------------------- ### getBaseName(String filename) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/audio/utils/audiostreamutils Retrieves the base name of a given filename string. ```APIDOC ## static String getBaseName(String filename) ### Description Gets the base name of a filename. ### Parameters - **filename** (String) - The filename to query. ### Returns - (String) - The base name of the file, an empty string if none exists, or null if the input is null. ``` -------------------------------- ### importAccessTokenResponse Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Imports or migrates an existing AccessTokenResponse into the service storage. ```APIDOC ## void importAccessTokenResponse(AccessTokenResponse accessTokenResponse) ### Description Imports or migrates an existing AccessTokenResponse to be stored by this service. ### Parameters - **accessTokenResponse** (AccessTokenResponse) - Required - The token response object to import. ### Throws - **OAuthException** - Thrown if the client is closed. ``` -------------------------------- ### Timer Interface Methods Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/module/script/action/timer Methods available on the Timer object to control and query the status of scheduled tasks. ```APIDOC ## boolean cancel() ### Description Cancels the timer. ### Returns - **boolean** - true, if cancellation was successful ## ZonedDateTime getExecutionTime() ### Description Gets the scheduled execution time. ### Returns - **ZonedDateTime** - the scheduled execution time, or null if the timer was cancelled ## boolean isActive() ### Description Determines whether the scheduled execution is yet to happen. ### Returns - **boolean** - true, if the code is still scheduled to execute, false otherwise ## boolean isCancelled() ### Description Determines whether the timer has been cancelled. ### Returns - **boolean** - true, if the timer has been cancelled, false otherwise ## boolean isRunning() ### Description Determines whether the scheduled code is currently executed. ### Returns - **boolean** - true, if the code is being executed, false otherwise ## boolean hasTerminated() ### Description Determines whether the scheduled execution has already terminated. ### Returns - **boolean** - true, if the scheduled execution has already terminated, false otherwise ## boolean reschedule(ZonedDateTime newTime) ### Description Reschedules a timer to a new starting time. This can also be called after a timer has terminated, which will result in another execution of the same code. ### Parameters - **newTime** (ZonedDateTime) - The new time to execute the code ### Returns - **boolean** - true, if the rescheduling was done successful ``` -------------------------------- ### getTypes() Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/handler/modulehandlerfactory Returns the UIDs of the module types currently supported by this factory. ```APIDOC ## Collection getTypes() ### Description Returns the UIDs of the module types currently supported by this factory. If a module type is no longer supported, the service must be unregistered and re-registered. ### Returns - **Collection** - A collection of module type UIDs supported by this factory. ``` -------------------------------- ### Configure GsonBuilder Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Sets a custom GsonBuilder instance for JSON serialization/deserialization within the service. ```java OAuthClientService withGsonBuilder(com.google.gson.GsonBuilder gsonBuilder) ``` -------------------------------- ### getHandler(Module module, String ruleUID) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/handler/modulehandlerfactory Creates a ModuleHandler instance for a specific module within a rule. ```APIDOC ## @Nullable ModuleHandler getHandler(Module module, String ruleUID) ### Description Creates a ModuleHandler instance needed for the operation of the Modules included in Rules. ### Parameters - **module** (Module) - The Module for which a ModuleHandler instance must be created. - **ruleUID** (String) - The identifier of the Rule that the given module belongs to. ### Returns - **@Nullable ModuleHandler** - A new ModuleHandler instance, or null if the module type is not supported. ``` -------------------------------- ### Manage Access Token Refresh Listeners Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Methods for adding or removing listeners that react to access token refresh events. ```java void addAccessTokenRefreshListener(AccessTokenRefreshListener listener) boolean removeAccessTokenRefreshListener(AccessTokenRefreshListener listener) ``` -------------------------------- ### restoreStates Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/module/script/action/busevent Restores item states from a provided map. If the state can be interpreted as a command, it is sent as a command; otherwise, the item state is updated directly. ```APIDOC ## restoreStates ### Description Restores item states from a map. If the saved state can be interpreted as a command, a command is sent for the item. If it is not a valid command, the item state is directly updated to the saved value. ### Signature void restoreStates(Map statesMap) ### Parameters - **statesMap** (Map) - Required - A map containing Item and State entries to be restored. ``` -------------------------------- ### createAddonFailureEvent(String id, String msg) Source: https://www.openhab.org/javadoc/latest/org/openhab/core/addon/addoneventfactory Creates an event representing a failure associated with an add-on. ```APIDOC ### static AddonEvent createAddonFailureEvent(String id, @Nullable String msg) Creates an "add-on failure" event. #### Parameters - **id** (String) - The ID of the add-on that caused a failure. - **msg** (String) - The message text of the failure. #### Returns - **AddonEvent** - The created event instance. ``` -------------------------------- ### BusEvent SDK Methods Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/module/script/action/busevent Methods available in the BusEvent interface for interacting with the event bus. ```APIDOC ## void postUpdate(String itemName, String stateString) ## void postUpdate(String itemName, String stateString, String source) ## void postUpdate(Item item, Number state) ## void postUpdate(Item item, Number state, String source) ## void postUpdate(Item item, String stateString) ## void postUpdate(Item item, String stateString, String source) ## void postUpdate(Item item, State state) ## void postUpdate(Item item, State state, String source) ### Description Posts a status update for a specified item to the event bus. ### void sendCommand(Item item, String commandString) ### void sendCommand(Item item, String commandString, String source) ### void sendCommand(Item item, Number command) ### void sendCommand(Item item, Number command, String source) ### void sendCommand(String itemName, String commandString) ### void sendCommand(String itemName, String commandString, String source) ### void sendCommand(Item item, Command command) ### void sendCommand(Item item, Command command, String source) ### Description Sends a command for a specified item to the event bus. ### void sendTimeSeries(String itemName, Map values, String policy) ### void sendTimeSeries(String itemName, Map values, String policy, String source) ### void sendTimeSeries(Item item, TimeSeries timeSeries) ### void sendTimeSeries(Item item, TimeSeries timeSeries, String source) ### Description Sends a time series to the event bus. ### Map storeStates(Item... items) ### void restoreStates(Map statesMap) ### Description Stores or restores the current states for a list of items. ``` -------------------------------- ### storeStates Source: https://www.openhab.org/javadoc/latest/org/openhab/core/automation/module/script/action/busevent Stores the current states for a list of items in a map. ```APIDOC ## Map storeStates(Item... items) ### Description Stores the current states for a list of items in a map. A group item is not itself put into the map, but instead all its members. ### Parameters - **items** (Item...) - Required - The items for which the state should be stored ``` -------------------------------- ### Close Service Source: https://www.openhab.org/javadoc/latest/org/openhab/core/auth/client/oauth2/oauthclientservice Stops the service and releases resources without removing stored tokens. ```java void close() ```