Ah, didn't realize the network socket issue - thanks. More importantly, I think you are right - I'm running down a rabbit hole.
I actually use the script a lot. We have a spread out house in the country, and some areas are hard to access for me (spine injury), so I have a more extensive notification/alarming scheme than most. It's a combo of logging, email, text messages, visual/lights & audio. Events typically fall into Sev 0 (info), 1 (note), 2 (warning) and 3 (danger). Each of those, in turn, trigger various combinations of notifications depending on the person, location, time of day, etc.
Because of that, I isolate each notification method into it's own python script. I chose to use Indigo variables both for configuration and to trigger events up the alarm tree. Each potential device can/does configure unique log/email/text/visual/audio responses in Indigo variables. That leaves me with around 15 variables that get uniquely configured in each event.
Outside of the normal light switches and outlets I also have 16 water sensors, 3 gas leak sensors, ?? motion sensors, security can events, security system events, 20+ temp sensors, 2 solar systems, an off-grid battery system, a geothermal, septic, well systems, and more on the way. An Indigo target rich environment.
.
Where I got bit was having the chunk of python code that configures the alarm variables in each device event and having people (ok, the wife) request changes. I found myself going back and tweaking all of these each time something changed, and eventually missing something. Thus the original goal of having a single piece of python which pulled all the variable definitions in, and a single piece that updated them all.
I'm sure there was a better way to architect all of this, but I'm a python newbie, a good decade out of coding and while Indigo is pretty straight forward at the simplest level, it also has an incredibly flexible and (to me) complex architecture. Being an engineer, I find that incredibly alluring (a bad habit, I know).
All of that said, I owe you an apology for dragging you down the rabbit hole with me. Thanks for getting me out of this hole, and for explaining the how's and why's!
-russg