-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CarInfo sensors #3399
Add CarInfo sensors #3399
Conversation
app/src/full/java/io/homeassistant/companion/android/sensors/CarInfoSensorManager.kt
Outdated
Show resolved
Hide resolved
app/src/full/java/io/homeassistant/companion/android/sensors/CarInfoSensorManager.kt
Outdated
Show resolved
Hide resolved
Is there really no way to get this in the background? I wonder if there is maybe something we can do to make the situation better then for users to avoid cases where they may forget to launch the app. I don't think a notification command can open a car app right? I wonder if we can use the existing intent for the connection sensor? 🤔 We also need to get a docs PR attached to this PR (once ready of course) |
I didn't found any way of getting the CarContext in the background. But I did find a way to show a notification on the car screen that is able to launch the android auto app when clicked (see the picture below). Just for testing purposes, I put the notification code with the existing connection sensor, but I am wondering if I should put everything in the existing AndroidAutoSensorManager (since it's also android auto related) |
car name, manufacturer, manufacturing year, odometer, ev status (connected, charging port open/close)
IMO you shouldn't force a notification when connecting to Android Auto. If the user wants this, they can do it themselves using the Android Auto connected sensor. |
I was under the impression a standard HA notification will not show up, at least in my Android Auto setup they do not show up at all. I think they need to be a conversation or extend the car platform. Unless Android Automotive does something different than Android Auto when it comes to showing a notification. |
Haven't tested it but if something special is required shouldn't that be added as a 'normal' notification option instead of forcing it in here? |
That may be a lil trickier than normal as the extended notification code is coming from the car app library which is only available to users on the full version of the app. |
app/src/full/java/io/homeassistant/companion/android/sensors/AndroidAutoSensorManager.kt
Outdated
Show resolved
Hide resolved
app/src/full/java/io/homeassistant/companion/android/sensors/AndroidAutoSensorManager.kt
Outdated
Show resolved
Hide resolved
app/src/full/java/io/homeassistant/companion/android/sensors/AndroidAutoSensorManager.kt
Outdated
Show resolved
Hide resolved
app/src/full/java/io/homeassistant/companion/android/vehicle/HaCarAppService.kt
Outdated
Show resolved
Hide resolved
What do we think about also updating the state of sensors that require |
Good point. Still, I don't like this and would prefer giving the user control. I can't imagine the notification always being useful. "CarInfo" is also quite technical. Something with a extension function returning different information depending on the flavor, similar to how code is shared between the main app and Wear OS, could work to make a notification feature to get the required intent, but it is out of scope of the PR. |
Ok, shoud I leave the android auto connection sensor here or also move it in main ? |
It can stay here ( |
For automotive support we need to ask for different permissions, is there a way to know if we are running the automotive version of the app ? |
yes you can determine that using a check like below (minus the build config check which checks to see if its the play store version 😃 ) |
I'm not sure on how to make it work in the |
yea that might require a refactor of that method to add context |
app/src/main/java/io/homeassistant/companion/android/sensors/CarSensorManager.kt
Show resolved
Hide resolved
Since the user needs to be on Android 8+ we should probably also use android/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorManager.kt Line 137 in a2f85ef
|
app/src/main/java/io/homeassistant/companion/android/sensors/CarSensorManager.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/io/homeassistant/companion/android/sensors/CarSensorManager.kt
Outdated
Show resolved
Hide resolved
@drosoCode appreciate your patience during this process 😃 Don't believe I have any more comments left 😅 |
app/src/main/java/io/homeassistant/companion/android/sensors/CarSensorManager.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/io/homeassistant/companion/android/sensors/CarSensorManager.kt
Outdated
Show resolved
Hide resolved
I also appreciate the time taken to review this contribution 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Summary
Add basic support for CarInfo sensors (as mentionned in #3260)
Screenshots
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#936
Any other notes
Can be tested using the DHU by running it with
-c config/default_sensors.ini
and typing commands likefuel 40
in the cli.For some reason this doesn't work on my oneplus (7T pro, android 12) but seems to works fine on samsung (tested on S23 (android 13) and S9+ (android 10)).
As using the CarContext seems to be the only way to obtain the CarInfo class, the android auto app needs to be started to make the sensor work.