Step one in my Python coding adventure
In my first post regarding my Python adventure, I shared how I wanted
to use python coding in the shack. As my readers know I am an avid CW
contester and before a contest begins I have 5 programs that need to be
launched. The issue is if I launch them out of order or if one program has an issue things get all
screwed up, and I have to start all over again. In doing so, most of the
time I need to go into some programs and reconnect some com ports and
clear lots of error messages. My first Python project will be one
double-click on a desktop icon that will get all my contest stuff up and
running smoothly in the right order.
The approach I am using is
to write python code to start each individual program. Then save those in a file. This will get my whistle wet with python coding, both
with success and some head scratching. At this point I have coded out
most of my programs so they start. Once that is fully completed, it will
be grouping them all together into one process.
In a nutshell, here is the plan:
– Turn on a Wi-Fi plug which powers on my power supply and Pi4B power supply
– Start my VSPE virtual com port program and minimize it.
– Start my Wn4icom program which also starts my Icom 7610 radio.
– Start my N1MM contest software.
–
Then finally Firefox will start, open Reverse Beacon Network, log me
in, set up search for my call and set it to refresh my call sign spots
every 10 minutes.
Lets take a fast look at the python coding for the WiFi plug.
import asyncio
from kasa import SmartPlug
async def main():
plug = SmartPlug(“10.0.0.71”) # Replace with your plug’s IP address
await plug.update()
await plug.turn_on()
print(“Plug turned on”
asyncio.run(main())
For the Kasa smart WiFi plug by TP link to work I had to first download into python the kasa library. I opened up python and entered the code below…well actually cut and paste.
pip install python-kasa
Now below in a nut shell is what the code is all about for the Kasa WiFi plug to turn on.
1. Python loads the needed modules. (asyncio and SmartPlug)
2. Program defines async functions or in English connecting to the wifi plug could take time and this allows things not to freeze if the process takes time.
So now modules are loaded and it knows some actions could take time.
3. Now asyncio.run(main()) runs and this is what happens.
Smart plug is created for IP address 10.0.071
The plugs state is defined (on or off)
The plug is turned on via network command
A message printed in python code window “plug turned on”
Program closes.
In closing I am not by any means a pythonista regarding code and I am sure many who are can poke holes in the coding or what I left out regarding what to explain. This is my first attempt at this game and I was actually shocked that it worked. BUT your input will and always is welcomed.
Next post is about the learning curve, hiccups and added lines of code for smoothness and reliable start up.
Mike Weir, VE9KK, is a regular contributor to AmateurRadio.com and writes from New Brunswick, Canada. Contact him at [email protected].
Having a snake of a time.
Mike Weir, VE9KK, is a regular contributor to AmateurRadio.com and writes from New Brunswick, Canada. Contact him at [email protected].
Whats your thoughts?
![]() |
| Possible RF magnet |
![]() |
| Needed connectors |
![]() |
| Connected and ready to go. |
Mike Weir, VE9KK, is a regular contributor to AmateurRadio.com and writes from New Brunswick, Canada. Contact him at [email protected].
LHS Episode #600: The End?
Hello and welcome to the 600th episode of Linux in the Ham Shack. In this episode, the hosts discuss the podcast--past, present and future--and then talk about the world of artificial intelligence, including vibe coding, image and video generation, generative music, thoughts and cavets thereof, and much more. Thanks for listening and have a great week.
73 de The LHS Crew
Russ Woodman, K5TUX, co-hosts the Linux in the Ham Shack podcast which is available for download in both MP3 and OGG audio format. Contact him at [email protected].
LHS Episode #599: The Weekender CXXXV
It's time for The Weekender! This is our departure into the world of hedonism, random topic excursions, whimsy and (hopefully) knowledge. Thanks for listening and, if you happen to get a chance, feel free to call us or e-mail and send us some feedback. Tell us how we're doing. We'd love to hear from you.
73 de The LHS Crew
Russ Woodman, K5TUX, co-hosts the Linux in the Ham Shack podcast which is available for download in both MP3 and OGG audio format. Contact him at [email protected].
ICQPodcast Episode 469 – Club Open Day and Radio Centre Win Award
In this episode, we join Martin Butler M1MRB, Dan Romanchik KB6NU, Caryn Eve Murray KD2GUT, Edmund Spicer M0MNG, and Ed Durrant DD5LP to discuss the latest Amateur / Ham Radio news. Colin Butler (M6BOY) rounds up the news in brief, and the episode's feature is Club open day and RSGB win an award.
We would like to thank Walter Turner (W8LN), Walter Washburn (KT0D), David LeBlanc (KF7KAF), Frank Westphal (K6FW), Nicholas Bradley (G4IWO) and Ken DeLap II (KX9U) and our monthly and annual subscription donors for keeping the podcast advert free.
To donate, please visit - http://www.icqpodcast.com/donate
- Ham to Chair Newly Created University Department
- Reminder: Keep Clear of Emergency Frequencies
- Young Amateurs Learn New Modes for Emcomm
- No, SDRs Haven't Ruined DX'ing
- Astronomy Trade Fair to Debut at Ham Radio Friedrichshafen
- YOTA Month: Book Your GB25YOTA Operating
- Is AO-7 Still the Oldest Satellite?
- Latvia's Hams Honor Nation's First Broadcast Radio at 100
Colin Butler, M6BOY, is the host of the ICQ Podcast, a weekly radio show about Amateur Radio. Contact him at [email protected].
Ham College 130
Ham College episode 130 is now available for download.
Technician Exam Questions Part 17
T5C – Capacitance and inductance terminology and units. Radio frequency definition and units. Impedance definition and units. Calculating power.
George Thomas, W5JDX, is co-host of AmateurLogic.TV, an original amateur radio video program hosted by George Thomas (W5JDX), Tommy Martin (N5ZNO), Peter Berrett (VK3PB), and Emile Diodene (KE5QKR). Contact him at [email protected].


















