Skip to content

Garage Manual Control

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
//For non content provider integration initialize like this 
val homeControlComponent = DaggerHomeControlSDKComponent.builder().homeControlContextModule( 
    HomeControlContextModule(appContext) 
    ).homeControlApiModule(HomeControlApiModule(usesContentProvider = false, 
    contentProviderUrl = null)).build()

2. Supported Device Types and Action States

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

Device Type Device State
Garage Door Opener (GDO), Gate,
Door, Gateway
OPEN
CLOSE
STOP
Light, Lamp ON
OFF
Lock LOCK
UNLOCK

Info

Before being able to control the devices, make sure you have successfully been authenticated.

3. Door Manual Control - Change Door Action

In order to create a ChangeDoorAction request the device type, serial number and action state are required.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
const val GDO_SERIAL_NUMBER = "serial number" const val ACTION_STATE = "OPEN" //choose a valid action from the table above val deviceType = DeviceType.GATE //choose a valid device type
val request: ChangeDoorAction = ChangeDoorAction(GDO_SERIAL_NUMBER, ACTION_STATE, deviceType)
val changeDoorStateInteractor: Interactor<ChangeDoorAction, Outcome<Unit>> =
        homeControlComponent.getChangeDoorStateInteractor()
//example of use in a ViewModelScope
viewModelScope.launch {
    when (val outcome = changeDoorStateInteractor(request)) {
        is Success -> { }
        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.

4. Lock/Light Manual Control

Info

Currently in progress.