by Fran T
Turn on the WiFi hotspot when Bluetooth HFP connects, provided the phone is not in power save mode or roaming.
Now works for multiple vehicles!
Also see 'Do Not Disturb While Driving':
Based on this original flow by Jason Rumney:
The flow detects whether the Oreo+ UI workaround is needed by checking for an exception from a Wi-Fi Hotspot block during setup. In order for the UI method to be able to turn the hotspot on and off in Android Oreo and above, the Hotspot tile must be present in Quick Settings. To see if it is, expand the status bar by swiping down twice. If the Hotspot tile isn't present, tap the EDIT or “pen” button, then drag the tile to add it.
To be able to unlock the phone to access Quick Settings, you may also need to set your Bluetooth device as a Trusted Device. See: Settings/Security & location/Smart Lock/Trusted devices.
Note: If you notice an exception in the log, that's normal and is the way the flow determines whether the non-root UI workaround is needed to enable the hotspot. The flow continues to run normally.
Updates by Fran T:
o Now supports Android Oreo+ without root access! Thanks to Kevin for identifying the necessary lock screen UI element: https://groups.google.com/forum/m/#!msg/automate-user/ymNjrewtODg/akJgitYtCAAJ
o Added support for devices (like LG) which require Wi-Fi to be disabled before starting the hotspot
o Don't try to start the hotspot if mobile data is disabled
o Added handling for when the device is already unlocked
o Added positive re-locking for Android 9+
o Added a Variable Set block at the start of the flow to accommodate UIs where the text of the Hotspot tile is something other than "Hotspot"; if this is the case on your device, change the second block
o Adaptations for Android 11 and new Automate behavior
o Use wildcards in Hotspot tile to improve likelihood of matching in more devices without change
o Updates for Samsung devices
o Improved auto-generated XPaths
o Added support for multiple vehicles, improved setup
o Removed obsolete setting of Wi-Fi state, broken by Android 12
Rate and review within the app in the Community section.