Homelabs are a enjoyable, worthwhile passion for many people, however you do not at all times want to take a position a whole bunch or 1000’s of {dollars} into your setup. I attempt to think about it as extra of a sandbox the place I’m making issues, studying, and experimenting with {hardware} and software program.
Typically, you may experiment, create, and be taught simply as effectively with the smartphone you employ daily (or an additional Android system you’ve got mendacity round). One in all my major targets for this 12 months (2026) was to be taught a brand new programming language. No vibe coding for me, thanks.
Whereas I am well-versed in HTML5 and CSS, I’ve by no means really dug into the thrilling world of Python. So I began studying the language utilizing a mixture of W3 Colleges tutorials, a couple of dusty previous books, and one-on-one studying with a good friend who is aware of the language effectively. With what I’ve discovered to this point, mixed with my newfound Termux abilities, I have been capable of make a nifty little model of my house lab on the go along with some quite simple, but helpful, Python scripts.
Listed here are a couple of tasks that I’ve labored on not too long ago to show my Samsung Z Fold 5 right into a mini Python playground.
Associated
How I Use My Raspberry Pi’s Terminal From My Android Telephone
Bored with being tethered to your PC or a transportable monitor for Pi upkeep?
I made an area net server
The easiest way to switch recordsdata wirelessly
If there are two issues I like, it is self-hosting and streamlined cable administration. With a domestically hosted net server, I get each. I take an extreme quantity of images and infrequently shoot video with my cellphone. Transferring it to my pc for processing, enhancing, backup, and storage normally required going by way of the (admittedly very delicate) problem of plugging in a USB-C cable and giving it permission to switch recordsdata through USB.
Both that, or I might share it through e-mail, add it to Google Drive, put it in Dropbox, or use WeTransfer. All of them are stable choices, and there is not actually an issue right here that wants an answer. I simply wished an excuse to arrange an area net server with Python.
How I arrange the server utilizing http.server
It is as straightforward as choosing a port and executing a single command
Photograph by Ivan N on Unsplash
Organising my server was very straightforward. I needed to discover my cellphone’s IP tackle, which was situated within the settings. However you could possibly additionally use this command in Termux to seek out it:
Since I am engaged on my Samsung, I’ve a devoted folder underneath storage for my experiments.
- In Termux, I used python -m http.server 9090 to start out a server. I selected port 9090.
- After that, I pointed my browser to a brand new window and typed: http://, [my phone’s IP address]:9090.
- This introduced me to a web page containing all my folders.
- I navigated for a bit, downloaded a few of the bigger recordsdata I would saved through the years, and disconnected.
Python has a module constructed into it that implements a TCP server, so once you run it, it will pay attention for any requests on sure ports. At a later date, I can construct a devoted server utilizing Python and use my native server for fast and simple file transfers. I have been utilizing it usually and can proceed to take action for the foreseeable future.
I automated music group
I principally made a digital custodian for my music recordsdata
The following Python undertaking I attempted out was making a easy script to assist me manage all of the dwell exhibits I preserve downloading from the Web Archive. To start with, I wanted an OS module and the Shutil module. They’re commonplace libraries for working system interplay and file operations, so more than likely they’re the primary modules most folk will add to Python straight away.
In Termux, I created a file referred to as ‘organizer.py’ and started working. Within the script itself, I listed instructions to import OS and Shutil, adopted by my path, outlined a supply and output location. It is only a string that tells Shutil to have a look at the tip of a filename, and if it ends in .mp3, the utility will mechanically transfer it to my ‘tunes’ folder.
On the finish, I used shutil.transfer(source_path, target_path) to have all the pieces transfer from my downloads folder to my newly-created tunes folder. The script works like a appeal. Since I’ve extra management over what’s taking place right here, it is like I’ve a private custodian managing my music recordsdata.
Socket checks
A easy script lets me see what my native sockets are doing
For many of this undertaking, I made a decision to maintain the scope pretty small and deal with sensible issues. So a script that does a socket examine made loads of sense. Now, I’m not going to get into the finer factors of sockets and the way they work, as Python wrote up some very good documentation on the subject. Typically, you simply have to preserve it easy.
I wished to have a fast method to see if any of my community ports have been open, particularly, the ports for my FreshRSS and Jellyfin servers. So, I used Python’s socket module with connect_ex() to examine if ports have been open.
It turned out the port for my RSS feed and server have been nonetheless closed, in order that they weren’t listening for visitors. Which is simply the way in which I like my self-hosted stuff to be for safety functions.
Python’s http.server is read-only as a default mode, so you will have to make use of different instruments (like Flask, for instance). If you wish to get entry from different gadgets, use python -m http.server — bind 0.0.0.0.
Easy system monitoring
Protecting observe of processes is less complicated
For this fast little experiment, I used the Termux API, which I had already put in and performed round with to take a look at numerous cellphone capabilities from the command line. I favored the thought of getting a script mechanically alert me to battery standing, so I arrange one which makes use of the termux-battery-status command as a subprocess in Python. I exploit the Adaptive Battery setting and wish to closely monitor my charging, discharging, and utilization.
In my script file, I specified precisely how I wished the info to be output utilizing the print() command for every parameter, which have been fairly fundamental:
- Battery degree
- Standing
- Temperature
After operating the script utilizing python standing.py, I obtained a really fast bit of information in regards to the battery. Fairly cool. I like this script as a result of I can examine very important info with out the necessity to open a separate app. I plan to arrange comparable scripts for different diagnostics quickly.
Associated
You need to use Python on any cellphone or pill, with a Raspberry Pi
Work in your Python code from wherever, with the assistance of a networked Raspberry Pi.
Android generally seems like a gated fortress, however Python and Termux make it extra accessible
The primary time I loaded up Python within the terminal, I had it printing Frank Zappa lyrics. Since I have been studying the programming language this 12 months, I’ve had a incredible alternative to develop the scope of what I can do, and I look ahead to attempting out different scripts, like organising automated downloads.
These tasks have all been useful and enjoyable experiments. Python simply makes my house lab passion way more enjoyable, and I can’t wait to see what I can do sooner or later as I be taught extra, develop my information, and give you the subsequent wacky “as a result of I can” undertaking to do on my cellphone.

