I've been working on my latest pet projects about tracking and charting your Hive Portfolio over time (about which I'll post tomorrow, with some significant updates).
In the meantime, I've been trying to solve a problem I had. Since I'll be on vacation most of next week (yeah... short and sweet, hopefully), and I don't have a server that runs 24/7, I had to come up with a plan regarding how will I run my portfolio tracking script on the days while I wasn't home to power up the laptop.
My first thought when I started developing this tool was to simply not track those days when I wasn't around to power up the laptop. That... was an option. But, encouraged by the versatility of AI to help out with different tasks (even though you often hit the wall and YOU are the one that needs to change strategy, make adjustments, and so on), I thought... ok, let's see if I can make this work when I'm not home. After all, many things have changed ("upgraded") from my initial thoughts about this tool.
So... a few days ago, I had the idea: what if I left the laptop in suspended mode (S3, for those who know). Would I be able to wake it up, run the script and put it back to suspended mode? Turns out I couldn't. I couldn't use rtcwake
to do it because my system doesn't support waking by RTC alarms (alarm_irq
is set to "no").
Next step was to check BIOS. And yes, I found there something even better: auto-waking on S5 (i.e. on powering up). But again... a dead end. What is likely a custom BIOS for my Lenovo ThinkBook, hid that option the next time I tried to look for it, after I enabled it. Turns out it can be a standard behavior for them. No trick worked to show advanced options again.
There was still the option "Wake on LAN" which could be used, but I got tired of going that route. Plus, I found this option... risky to pursue anyway. It's worth mentioning that the AI didn't mention anything about risks (but I didn't ask it to either). So, be careful about following AI's instructions without critical thinking.
So... in the end, I gave up on a scheduled power up, running my script, and powering down process, which would have been cool, but... well, maybe it works on certain systems or if one has time to tinker with the options until they find a way they are comfortable with.
I, however, switched.
If I can't run my script at home... then let's take the script with me and run it. Ok... Since I don't take my laptop on vacations (that's probably obvious by what I wrote already), I needed my script to run on my phone.
That was a big if. Would Python run on Android? To be honest, when I asked this question to the AI, I expected a negative answer. I was relieved when it started with "Sure!". It surely knows how to say the "right" words at the beginning, lol.
Anyway, the solution suitable for me is... F-Droid + Termux + Python.
Screenshot from Termux terminal emulator.
F-Droid is an open-source app store for Android (it requires no "special" rights to your phone). Termux is the Terminal emulator and Linux environment app, from where you can install packages, run shell scripts, etc. That's where I installed Python from and other packages I needed for my script (didn't have space to create a Python virtual environment too—due to storage shortage, I'll uninstall everything when my vacation is over anyway). Termux only needs access to media and files, if YOU activate that option, and I needed it, to be able to save snapshots outside the sandbox.
So... I created a custom Hive Portfolio Tracker version for Android with reduced functionality (no automation), tested it on my phone and it works! Now all I have to do is to remember to run the script daily while on vacation. Hopefully, I will. I put a lot of work into this for me to forget it next week, while doing my limited daily tasks.😀