If you are looking for documentation around the companion applications check out the Home Assistant Companion Documentation. This will provide you with instructions on using the applications.
Download and install Android Studio
Download / clone this repository to a folder on your computer
Create a Firebase project at Firebase Console
Create four Android apps, with the following package names
io.homeassistant.companion.android
io.homeassistant.companion.android.debug
io.homeassistant.companion.android.minimal
io.homeassistant.companion.android.minimal.debug
Now download the google-services.json
file and put it in the project's /app, /automotive and /wear folders. This file contains the configuration of the whole project (all four applications). (You can also use the mock services file instead of generating your own. The file should contain client IDs for all packages listed above for debugging to work properly. If you do not generate your own file, FCM push notification will never work, only websocket notifications will).
Start Android Studio, open your source code folder, and check if the Gradle build will be successful using Build/Make Module "App". You might have to install the right Android SDK via Tools/SDK Manager first.
Run gradlew assembleDebug
to build all debug versions, this might take a while.
If the build is successful, you can run the app by doing the following: click Run -> Run 'app'.
Connect your phone or create a new virtual device following on-screen instructions.
:tada:
If you get stuck while setting up your own environment, you can ask questions in the #devs_mobile_apps channel on Discord.
If you want to work on push notifications or use a development build with push notifications, please go to the server-side code HERE and deploy it to your Firebase project. Once you have your androidV1 URL to the deployed service, set it in to your ${GRADLE_USER_HOME}/gradle.properties
file, e.g.:
homeAssistantAndroidPushUrl=https://mydomain.cloudfunctions.net/androidV1
You can also define the rate limit function URL, e.g.:
homeAssistantAndroidRateLimitUrl=https://mydomain.cloudfunctions.net/checkRateLimits
The Android app has a full
flavor that uses Google Play Services to offer features like location tracking and notifications. There is also a minimal
flavor that does not require Google Play Services and can be found in the releases section. The minimal flavor does not have location tracking or notifications.
To build the app for publishing, you will need to sign the app. To do this, do the following:
release_keystore.keystore
and should be placed in the home-assistant-Android/app and home-assistant-Android/wear folder.app/build.gradle.kts
:
KEYSTORE_PASSWORD
KEYSTORE_ALIAS
KEYSTORE_ALIAS_PASSWORD
KEYSTORE_PATH
(if your keystore is located differently than stated above)gradlew build
We are using Github Actions to perform continuous integration both by unit testing, deploying dev releases to Play Store Beta and final releases to the Play Store when we release. To help test out a specific feature/fixes users can find the APK on the Actions page for each pull request, this debug APK can be installed side-by-side with the production or beta builds.
We are using ktlint as our linter. You can run a check locally on your machine with:
./gradlew ktlintCheck
This command runs on our CI for every PR to check if it passes all tests. So we strongly recommend running it before committing.
To run a check with an auto-format:
./gradlew ktlintFormat
The project currently uses Lokalise to translate the application. If you are interested in helping translate go to the link and click start translating!
Play Publish Production
Workflow to execute and should handle the rest for Google Playversion_code.txt
file of the latest release to detect a new production release and build it themselves, this may take some time