Please note that this procedure is only for the 8.8" Roadtop unit. The 8.9" unit has a lux sensor and will automatically set day/night mode based on ambient light.
Description:
This write up is to configure Tasker to automatically set Android Auto to day/night mode depending on the time of day. Normally something like this would be very simple; we would find the Android Auto intent to set day mode or night mode and then use a Tasker profile to trigger it. Unfortunately Android Auto does not expose any such intent, so we have to create a task that will essentially automate the screen inputs to trigger each mode through the Android Auto UI. As I stated before, this solution is inelegant, but fairly robust and takes into account the fact that sunrise/sunset times vary throughout the year and accounts for boundary conditions like transitions from day to night mode (and vice versa) while you're driving. Below is my attempt at a tutorial to walk you through the process of configuring this from scratch. Please note the prerequisites that I've identified above and ensure you have everything before starting.
Prerequisites:
Configuration:
There are a few pieces that need to be configured separately to get this to work.
1. Download the prerequisites that I've provided above. Open Tasker, AutoNotification, and AutoInput and make sure each app's permissions are allowed.
2. Import the profiles and tasks that I've provided as XML. To do this, go into Tasker and long click on the 'Profiles' title and select 'Import'. Select each of the XML profiles that you downloaded (there will be 5) and import them to Tasker. Follow the same process for importing Tasks by long clicking the 'Tasks' title and selecting the three XML files you downloaded.
3. We need to be able to accurately calculate current sunrise/sunset times to be able to trigger the appropriate Tasker profile. To do this we will rely on a dependency-free script that runs locally on the phone and sets the appropriate variables. Download the sunrise_20220526.js script referenced in the prerequisites. Once the script is downloaded, take note of the path to the script (likely Download/sunrise_20220526.js or similar). Open the 'sunriseset' task and set step 5. to your 'sunrise_20220526.js' path. Once you've set the path click the play button in the bottom left and make sure that the task executes correctly. If everything is set you should see a popup with four different times listed indicating that the appropriate variables have been set.
4. Make sure that all of your tasks are configured correctly. I've given you a start by including the XML files for each of the tasks but you'll have to make sure that there are no errors reported by Tasker (red exclamation mark) and that each task runs as expected. Do this by clicking the play button like we just did and observing that the task runs as expected. If you have issues open the task or profile and see which step is giving you an error. It should be self-explanatory to fix, but if not send me a message and I will do my best to walk you through resolution.
5. It's time to hook everything up. It should be as simple as plugging your phone into the Roadtop until and making sure that it behaves as expected. I recommend disabling automatic updates for all of the involved apps are well as the system once everything is working. Google regularly publishes API updates and there's always a chance that one of the involved steps will be broken by updates.
I hope this is helpful and my apologies for the delays in getting this out!