PropertiesFileConfiguration

class PropertiesFileConfiguration(file: File = File( System.getProperty("user.home") .takeIf { it.isNullOrEmpty() == false }, ".shade-cli.properties" )) : HueConfigurationContainer

Load and save Hue configuration and authentication to a file.

File Format

Keys

To assign a known application key in your file specify the application_key and optionally client_key properties:

application_key=abcd1234
client_key=defg5678

Hostname

To configure the Hue bridge's hostname, specify the hostname parameter. This is typically an IP address, but can be any valid hostname. Do not include the protocol (https://) as this is configured by the security strategy.

hostname=192.168.1.5

Security Strategy

To configure a security strategy, specify the security parameter, and its associated parameters for that type. The available types are:

Platform Security

This is the default security type, but can also be explicitly specified in the properties file, and requires no extra parameters:

security=platform

Insecure

To use an insecure connection, specify the security as insecure and the hostname of the hue bridge will be allow-listed for insecure http connections:

hostname=192.168.1.5
security=insecure

Hue CA

To use Hue's Certificate Authority for TLS security, specify the security as hue. Hue's security uses the Device ID as the hostname parameter, and requires an ip to resolve that hostname to:

hostname=01234xxabcdef
security=hue
ip=192.168.1.5

Custom CA

To use your own custom CA configuration, specify the security as custom The CA file can be specified with the certificate_pem_file, along with the hostname and ip to resolve the host to.

Note that Custom CA's do not support modifying the certificate data from the SDK.

hostname=myhue.localdomain
security=custom
ip=192.168.1.5
certificate_pem_file=/var/shade/custom_cert.pem

Parameters

file

The properties file to load or save data from.

Constructors

Link copied to clipboard
fun PropertiesFileConfiguration(file: File = File( System.getProperty("user.home") .takeIf { it.isNullOrEmpty() == false }, ".shade-cli.properties" ))

Functions

Link copied to clipboard
open suspend override fun setAuthToken(key: AuthToken?)

Set the application key/token to use when communicating with the Hue bridge.

Link copied to clipboard
open suspend override fun setHostname(hostname: String?)

he Hue IP or hostname to communicate with. eg "192.168.1.5"

Link copied to clipboard
open suspend override fun setSecurityStrategy(securityStrategy: SecurityStrategy)

TLS configuration strategy.

Properties

Link copied to clipboard
open override val authToken: StateFlow<AuthToken?>

Auth token used in authenticated requests to the hue bridge

Link copied to clipboard
open override val hostname: StateFlow<String?>

The Hue IP or hostname to communicate with.

Link copied to clipboard
open override val securityStrategy: StateFlow<SecurityStrategy>

TLS configuration strategy.