-
-
Save andrew-malitchuk/ec50ba29ed9a880ba4f5ab5fa5a74c54 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Configure { | |
| companion object { | |
| // List of supported device types by this app: | |
| val supportedTypes: List<DeviceTypeFactory<out DeviceType>> = listOf( | |
| ContactSensorDevice, | |
| ColorTemperatureLightDevice, | |
| DimmableLightDevice, | |
| AirPurifierDevice, | |
| ExtendedColorLightDevice, | |
| GenericSwitchDevice, | |
| GoogleDisplayDevice, | |
| GoogleTVDevice, | |
| OccupancySensorDevice, | |
| OnOffLightDevice, | |
| OnOffLightSwitchDevice, | |
| OnOffPluginUnitDevice, | |
| OnOffSensorDevice, | |
| RootNodeDevice, | |
| SpeakerDevice, | |
| ThermostatDevice, | |
| GoogleAirCoolerDevice, | |
| RoomAirConditionerDevice | |
| ) | |
| // List of supported device traits by this app: | |
| val supportedTraits: List<TraitFactory<out Trait>> = listOf( | |
| AreaAttendanceState, | |
| AreaPresenceState, | |
| Assistant, | |
| AssistantBroadcast, | |
| AssistantFulfillment, | |
| BasicInformation, | |
| BooleanState, | |
| OccupancySensing, | |
| OnOff, | |
| Notification, | |
| LevelControl, | |
| TemperatureControl, | |
| TemperatureMeasurement, | |
| Thermostat, | |
| Time, | |
| Volume, | |
| ExtendedFanControl, | |
| ExtendedThermostat | |
| ) | |
| } | |
| } | |
| class MainActivity : ComponentActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| enableEdgeToEdge() | |
| super.onCreate(savedInstanceState) | |
| val factoryRegistry = FactoryRegistry( | |
| types = supportedTypes, | |
| traits = supportedTraits | |
| ) | |
| val config = HomeConfig( | |
| coroutineContext = Dispatchers.IO, | |
| factoryRegistry = factoryRegistry | |
| ) | |
| val homeClient = Home.getClient(context = this@MainActivity, homeConfig = config) | |
| homeClient.registerActivityResultCallerForPermissions(this@MainActivity) | |
| setContent { | |
| App() | |
| } | |
| } | |
| ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment