Pinephone / PineTime reconnect script

Hey folks, I was having issues with my PineTime reconnecting to my Pinephone after waking up from suspend. I noticed when I would cycle bluetooth on and off eventually it would re-connect.

Arch wiki showed me a neat way to run a script on wake every time. I started playing with that and got a decent working reconnect script. I have tested it for a few days and now am curious if it will work well for other people using the PineTime with the PInePhone

setup:
PinePhone 3gb running Manjaro-Arm
PineTime running InfiniTime 1.7.0
Amazfish as the companion app

Here is the github with instruction and the script that will take your PineTime BT mac address and make a small shell script for connecting and a systemd service to fire that script any time the PinePhone wakes from suspend. It is enabled to start on boot and requires a restart of both PT and PP after the script is done.

I recognize this is probably not the best way to fix my reconnect issues but it seems to work for now and I am certainly open to suggestions if anyone thinks there is a better way to do this.

I did not get much feedback on the Pine64 forums, I bet not a lot of people are using the PineTime with the PinePhone or maybe others are not having the connectivity issues I am. Either way would love to see if this works for anyone else.

1 Like

Looks nice! I don’t have a PineTime, but I’m interested in the code for the dependency of the timer on wake.
Do you know whether it’s possible to condition a timer to do the opposite: run on suspend rather than on wake?

EDIT: for some context, I’d love to be able to improve my code to wake-up the Pinephone with a timer that runs on suspend and a service that stops it on wake.

You can use it for suspend but it will run a command just prior to suspend, to wake once in suspend I believe you will need a systemd timer which is what it looks like you are using.

Here is what I used for mine straight from the arch wiki;
https://wiki.archlinux.org/title/Power_management#Sleep_hooks

Your script looks very useful. Is the purpose of your script to wake up at set intervals and just poll for new messages / emails and such?

I remember when the phone was earlier in development it did not wake for messages or calls reliably but I have been daily driving for a month or so now and no one is complaining about getting a hold of me and the phone seems to reliably wake for calls and sms only nothing else will wake it. Make me wonder about your scrip to poll for axolotl and email and whatever else.

1 Like

Yes, that’s the point of the script: to get email and IM (like signal) notifications at regular intervals.
I don’t usually need to respond right away, but seeing the message within 10 minutes is usually good.

I tried to adapt it using the sleep target on this branch but it does not work at the moment.
The main branch uses a calendar-based timer but there still seems to be some weird things going on (my phone locks up on its own some times) and I suspect some of the scripts do not behave as expected. Still, it’s usable but I’m sure it could be much better.

The goal would be:

  1. WakeTimer starts on suspend
  2. after e.g. 10 minutes it runs WakeTimer.service, which wakes the phone and calls SuspendTimer
  3. SuspendTimer calls SuspendTimer.service after 30 seconds, which stops WakeTimer and suspends the phone again, thus restarting WakeTimer and we’re back to 1.

But I’m not managing to get that at the moment ^^"

I would love to help, lets take this conversation into IM’s and ill will have a closer look at your code later then try to use it on my phone and see what happens.

I would love to find a way to have my Nextcloud notifications pushed to my phone, they show up in Nextcloud but I have to open the desktop app to see them Maybe i can modify your code to check nextcloud / email / signal / and then push it to my pinetime. This is the start of essentially what google services is for android for the pine time…So Pine Time Services LOL : )

1 Like