Skip to content

Garage Status

1. Initialization of the component

HomeControlSDKComponent is the main entry point for every HomeControl functionality, in order to get a configured instance initialize it like in the following snippet:

1
2
3
4
5
6
//For non content provider integration initialize like this 
val homeControlComponent = 
    DaggerHomeControlSDKComponent.builder().homeControlContextModule( 
        HomeControlContextModule(appContext) 
    ).homeControlApiModule(HomeControlApiModule(usesContentProvider = false, 
    contentProviderUrl = null)).build()

2. Get device list

The DevicesListInteractor allows retrieving all the devices including states of a user's account.

Info

Before being able to get the device list, make sure you have successfully been authenticated.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
val getDeviceListInteractor: Interactor<Unit, Flow<Outcome<List>>> = 
    homeControlComponent.getDevicesListInteractor()

//example of use in a ViewModelScope
viewModelScope.launch {
    getDeviceListInteractor(Unit)
        .collect {
            when (val outcome = it) {
                is Success -> {
                    //handle outcome.value of type List<DeviceListItem>
                }
                is Failure -> {
                    //handle errors
                }
            }
        }
}

Info

ViewModelScope is a CoroutineScope, bound to the lifetime of a ViewModel. A coroutine launched in viewModelScope will be cancelled when the ViewModel is cleared.

3. Supported Device Types and Device States

List of available device types and valid device states for each family of devices:

Device Type Device State
Garage Door Opener (GDO), Gate,
Door, Gateway
OPEN
CLOSED
STOPPED
OPENING
CLOSING
UNKNOWN
Light, Lamp ON
OFF
UNKNOWN
Lock LOCKED
UNLOCKED
UNKNOWN
Wifi Hub, Wifi Gateway ONLINE
OFFLINE