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.
- 🎉
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=mydomain.cloudfunctions.net/androidV1
You can also define the rate limit function URL, e.g.:
homeAssistantAndroidRateLimitUrl=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:
- Create a keystore containing a keypair for debug application signing. In Android Studio: Menu/Build/Generate signed APK, then use a button to create a new keystore. Remember the passwords and the key alias. Default, the keystore must be named
release_keystore.keystore
and should be placed in the home-assistant-Android/app and home-assistant-Android/wear folder. - Set environmental variables used in
app/build.gradle.kts
:
KEYSTORE_PASSWORD
KEYSTORE_ALIAS
KEYSTORE_ALIAS_PASSWORD
KEYSTORE_PATH
(if your keystore is located differently than stated above)
- Run
gradlew build
- The signed APK is located in your build folder
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!
- Go to the latest Pre-release and edit it
- Uncheck the Pre-release box, check the Latest release box, and click Update release
- This should cause the
Play Publish Production
Workflow to execute and should handle the rest for Google Play - Some platforms, such as the Amazon App Store, need to be updated manually
- F-Droid uses the
version_code.txt
file of the latest release to detect a new production release and build it themselves, this may take some time
- This should cause the
What’s Changed
- Bump androidPlugin from 8.7.0 to 8.7.1 by @dependabot in #4726
- Fix leading zero handling in toJsonType method by @blackhead1981 in #4721
- Add car speed sensor by @dshokouhi in #4722
- Add arrow to bottom sheet list items to indicate tappable by @jpelgrom in #4732
- Sensor descriptions and UI strings writing feedback by @jpelgrom in #4734
- Add a car range remaining sensor by @dshokouhi in #4733
- Bump activity-compose from 1.9.2 to 1.9.3 by @dependabot in #4737
- Bump androidx.compose:compose-bom from 2024.09.03 to 2024.10.00 by @dependabot in #4735
- Bump androidx.wear.tiles:tiles from 1.4.0 to 1.4.1 by @dependabot in #4736
- Bump wear-protolayout from 1.2.0 to 1.2.1 by @dependabot in #4738
- Bump com.google.android.gms:play-services-threadnetwork from 16.0.1 to 16.2.1 by @dependabot in #4730
- Prevent crash due to any Improv scanning failure by @jpelgrom in #4740
- Bump androidx.navigation:navigation-compose from 2.8.2 to 2.8.3 by @dependabot in #4742
- Bump androidx.health.connect:connect-client from 1.1.0-alpha09 to 1.1.0-alpha10 by @dependabot in #4744
- Avoid (s) in strings if possible by @jpelgrom in #4741
- Bump androidx.wear.compose:compose-material3 from 1.0.0-alpha26 to 1.0.0-alpha27 by @dependabot in #4743
- Update change log week of 10/18 by @dshokouhi in #4745
- Correct sensor identification for car speed sensor by @dshokouhi in #4746
- Enable Health Connect again to retry for approval by @dshokouhi in #4731
- Bump com.google.firebase:firebase-bom from 33.4.0 to 33.5.0 by @dependabot in #4748
- Hide widgets from automotive build and prevent intent registration too by @dshokouhi in #4751
- Add package name to health connect sensors, additional sensor tweaks by @dshokouhi in #4750
- Bump com.google.firebase:firebase-bom from 33.5.0 to 33.5.1 by @dependabot in #4752
- Bump io.sentry:sentry-android from 7.15.0 to 7.16.0 by @dependabot in #4753
- Bump actions/setup-java from 4.4.0 to 4.5.0 by @dependabot in #4756
- Allow fan domain to be selected for android auto favorites list by @cwrogers in #4757
- Bump rexml from 3.3.6 to 3.3.9 by @dependabot in #4762
- Bump lifecycle from 2.8.6 to 2.8.7 by @dependabot in #4770
- Bump androidx.compose:compose-bom from 2024.10.00 to 2024.10.01 by @dependabot in #4771
- Bump androidx.constraintlayout:constraintlayout from 2.1.4 to 2.2.0 by @dependabot in #4769
- Bump androidx.core:core-ktx from 1.13.1 to 1.15.0 by @dependabot in #4768
- Fix pipeline badge in the header of README.md by @marazmarci in #4773
- Bump androidx.wear.compose:compose-material3 from 1.0.0-alpha27 to 1.0.0-alpha28 by @dependabot in #4772
- Improve wording, grammar, and punctuation in README.md by @marazmarci in #4774
- Don’t reset work profile state on app restart and add ‘intent only’ update type by @jpelgrom in #4765
- Support behavior: textInput key on notification action for reply actions by @jpelgrom in #4763
- Add notification command for turning the flashlight on/off by @marazmarci in #4766
- Bump softprops/action-gh-release from 2.0.8 to 2.0.9 by @dependabot in #4775
- Bump androidx.fragment:fragment-ktx from 1.8.4 to 1.8.5 by @dependabot in #4778
- Bump androidx.work:work-runtime-ktx from 2.9.1 to 2.10.0 by @dependabot in #4777
- Bump androidPlugin from 8.7.1 to 8.7.2 by @dependabot in #4776
- Add heart rate sensor for Health Connect by @dshokouhi in #4784
- Fix some sensor configurations to be more precise by @dshokouhi in #4789
- Add several more health connect sensors by @dshokouhi in #4785
- Bump health services for security fix by @dshokouhi in #4791
- Bump com.android.tools:desugar_jdk_libs from 2.1.2 to 2.1.3 by @dependabot in #4792
- Update change log week of 11/8 by @dshokouhi in #4794
- Bump softprops/action-gh-release from 2.0.9 to 2.1.0 by @dependabot in #4800
- Added support for progress notifcations by @EarMaster in #4799
- Add device class to blood glucose sensor by @jpelgrom in #4801
- Make changes to allow health connect to work on Android 9 and higher by @dshokouhi in #4790
- Bump io.sentry:sentry-android from 7.16.0 to 7.17.0 by @dependabot in #4806
- Bump androidx.navigation:navigation-compose from 2.8.3 to 2.8.4 by @dependabot in #4814
- Bump paging from 3.3.2 to 3.3.4 by @dependabot in #4815
- Use a red icon for Wear OS debug build entity complication to make it distinguishable by @dshokouhi in #4813
- Bump androidx.wear.compose:compose-material3 from 1.0.0-alpha28 to 1.0.0-alpha29 by @dependabot in #4817
- Bump androidx.compose:compose-bom from 2024.10.01 to 2024.11.00 by @dependabot in #4816
- Update some health connect sensor names to match Wear OS and to be more precise by @dshokouhi in #4802
- Update sensor frequency text to mention location is not included by @dshokouhi in #4821
- Update change log week of 11/15 by @dshokouhi in #4820
- Bump com.google.firebase:firebase-bom from 33.5.1 to 33.6.0 by @dependabot in #4824
- Bump io.sentry:sentry-android from 7.17.0 to 7.18.0 by @dependabot in #4827
- Skip ranker_group notifications as they are meaningless and system generated and prevent valid notification data from sending by @dshokouhi in #4822
- Catch all health connect exceptions so we dont crash by @dshokouhi in #4830
- Use translated channel name strings where possible to update them when language changes by @dshokouhi in #4833
- Add 10 more health connect sensors by @dshokouhi in #4803
- Add dialog before prompting for Improv permissions by @jpelgrom in #4837
- Bump com.google.android.gms:play-services-wearable from 18.2.0 to 19.0.0 by @dependabot in #4838
- Add 5 more health connect sensors by @dshokouhi in #4836
- Update change log week of 11/22 by @dshokouhi in #4839
- String updates for translations by @jpelgrom in #4842
- Use the correct unit of measurement for device class volume for the hydration sensor by @dshokouhi in #4846
- Bump org.jlleitschuh.gradle.ktlint from 12.1.1 to 12.1.2 by @dependabot in #4851
- Bump media3 from 1.4.1 to 1.5.0 by @dependabot in #4850
- AAOS/Android Auto: Add a button to refresh the main screen entity list by @anstick in #4845
- Implement native Improv discovery with frontend flow by @jpelgrom in #4849
- Optimize sensor list performance by @jpelgrom in #4853
- Update change log week of 11/30 and temporarily disable health connect by @dshokouhi in #4860
New Contributors
- @blackhead1981 made their first contribution in #4721
- @cwrogers made their first contribution in #4757
- @EarMaster made their first contribution in #4799
- @anstick made their first contribution in #4845
Full Changelog: 2024.10.3...2024.12.1