Skip to content

Latest commit

 

History

History
101 lines (68 loc) · 4.61 KB

README.md

File metadata and controls

101 lines (68 loc) · 4.61 KB


OpenAutoPro Sync

If you are a happy owner of OpenAutoPro (https://bluewavestudio.io/index.php/bluewave-shop/openauto-pro-detail) you will have noticed that, unfortunately, raspberry clock is not synchronized due to the absence of a RTC module. The lack of this module, for example, will not allow using the OpenAutoPro automatic day and night switch. Of course there are other options to enable it, but all of them, include: installing cables, modules or sensors. So since 99% of the time my infotainment is connected to my phone, I thought I could retrieve what I needed from my phone and sync raspberry via bluetooth. To fulfill those needs i developed OpenAutoPro Sync that will add the following features to OpenAutoPro infotainment system:

  1. Time sync
  2. Geolocation sunrise and sunset time (for day and night feature)
  3. Current outside temperature

All this without even a cable (obviously you will need a smartphone with internet and bluetooth).

Time Sync

Current time is retrieved directly from your phone, no internet needed.

Geolocation sunrise and sunset time

Sunrise and sunset times are provided by www.yr.no via API so any change must coop with their usage limits. If you want to update your times open the app and click "Get sunrise and sunset time".

Temperature

Temperature is gathered from www.yr.no API service, again here, any software modification must comply with their Terms of Service. Script will emulate a DS18B20 sensor. At the moment the data retrieved is based only on latitude and longitude, future developments will also account the altitude or variations in latitude and longitude that require an update of the data.

Automatic service setup


Enter in the root of the repo:
cd ~/open-auto-pro-sync
Run the script:
./setup-bt-services.sh

Manual script installation steps

cd ~
sudo nano /etc/systemd/system/dbus-org.bluez.service
Add "-C" option at the end of ExecStart parameter
Add: "ExecStartPost=/usr/bin/sdptool add SP" after ExecStart
sudo pip3 install pybluez
git clone --branch python-script https://github.com/rizlas/open-auto-pro-sync
cd open-auto-pro-sync/oap_sync_script
sudo mkdir -p /usr/local/bin
sudo cp bt_rfcomm_server.py /usr/local/bin
sudo cp bt_rfcomm_server.service /etc/systemd/system
sudo systemctl enable bt_rfcomm_server.service
sudo systemctl start bt_rfcomm_server.service
nano /home/pi/.openauto/config/openauto_system.ini 
Change this setting "TemperatureSensorDescriptor=/opt/sensor"
Disable ntp sync (try with sudo timedatectl set-ntp false)

Troubleshooting

Check the status script via:

systemctl status bt_rfcomm_server.service

The output should contain this line:

 Active: active (running) since ...

Check script logs using:

tail -f /tmp/bt_server.log

Application

  1. Download apk (https://github.com/rizlas/open-auto-pro-sync/raw/master/OpenAutoProSync.apk)
  2. Install (enable unknown sources)
  3. Grant permissions (if you want)

Troubleshooting

Check if the service is running from

Developer options -> Running services and you should see OpenAutoPro Sync icon

if the service is not running reboot your phone. Further investigation to try to keep the service alive are in progress.

You can always sync OpenAuto Pro manually. Just open the app and click top right button. This will also restart the sync service.

Thanks to

Feel free to make pull requests, fork, destroy or whatever you like most. Any criticism is more than welcome.






#followtheturtle