Smart devices - advising lost LAN contact

At last - Now working....

Two problems eventually found.

1. The Powershell.exe -executionpolicy remotesigned -File "C:\Program Files\Nirsoft\failed.ps1" "%HostName%" "%IPAddress%" "%LastPingStatus%" "%LastFailedOn%"

Because of the space between Program and Files, needed to be enclosed in double quotes.

2. The script had managed to name itself 'failed.ps1.ps1' (see below). I had to run Notepad as Administrator to change it, after which it worked fine. Thanks for the help..

PS C:\Program Files\Nirsoft> dir


Directory: C:\Program Files\Nirsoft


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 11/07/2022 21:30 733 failed.ps1.ps1
-a---- 10/07/2022 12:58 72097 GUNAuto_Shot beretta m12 9 mm (ID 0437)_BSB.mp3
-a---- 12/07/2022 13:11 2189 PingInfoView.cfg
-a---- 06/01/2022 22:11 17765 PingInfoView.chm
-a---- 06/01/2022 22:11 60792 PingInfoView.exe
-a---- 12/07/2022 13:11 358 PingInfoView_hosts.txt
-a---- 06/01/2022 22:11 17023 readme.txt
 
Sponsored Links
Well done! :)
Purely standard Windows issues then!
When I'm playing with scripts, CMD, etc. I try and keep everything in an easy to get at directory, D:\Test\ until I can trust that it is working - saves on the frustration of dealing with multiple nested directories... and Windows issues with spaces! :(
 
A bit of a follow up, to say it is working very well indeed and completely solves the issue I had of not knowing whether Alexa was still able to 'talk' to all of the Smart Plugs. I have PingInfoView set to load, as Windows boot, by adding a shortcut to it in the Startup folder, so it is invisible unless I click on it to check. I have it set to ping each plug, once every 30 minutes, but obviously only when my laptop is powered up - which it almost without fail will be at least once per day. Two failed pings in succession and it fires off an email to warn me.

Reviewing the logs, the worst cases for failed pings, suggests there are two Smart Plugs which produce ping failure of 5%, other six are around 1%. One is the SM which switches the car battery charger on/off in my garage and the other a SM which powers my laser printer in the small bedroom. Why the latter, when it is reasonably close to a router I don't know, but both have failed to respond in the past, hence my trying to find a workaround to advise me when the do fail to respond. I can understand the one in the garage failing - it is some distance out back and under a metal roof.
 
Last edited:
No, nothing delivered at all, in any of the accounts. I see a brief flash of blue as the what I assume the Powershell script runs, which implements the send email, when it is triggered.

This is the script.. First four lines are modified to include my email details. The "587" near the bottom, I assume is the port it should attempt to connect to on the mailserver.

I have just had a bright idea - Should those first four lines have the quotes marks around the items, should this $Username = "YourMailUser"; actually be $Username = YourMailUser; ????

$Username = "YourMailUser";
$Password = "YourMailPassword";
$SendTo = "[email protected]";
$MailServer = "mail.yourdomain.com";
$HostName = $args[0];
$IPAddress = $args[1];
$PingStatus = $args[2];
$FailedOn = $args[3];

$message = new-object Net.Mail.MailMessage;
$message.From = $Username;
$message.To.Add($SendTo);
$message.Subject = "Failed Ping On $HostName" ;
$message.Body = "Information about the failed ping: `r`nHost Name: $HostName`r`nIP Address: $IPAddress`r`nPing Status: $PingStatus`r`nPing Time: $FailedOn";

$smtp = new-object Net.Mail.SmtpClient($MailServer, "587");
$smtp.EnableSSL = $true;
$smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
$smtp.send($message);
lol. The funny quotey (is that a word) things give the value to be used
 
Sponsored Links
Well done! :)
Purely standard Windows issues then!
When I'm playing with scripts, CMD, etc. I try and keep everything in an easy to get at directory, D:\Test\ until I can trust that it is working - saves on the frustration of dealing with multiple nested directories... and Windows issues with spaces! :(
windows is a GUI based system so why on earth would you want to use the CLI?
 
A bit of a follow up, to say it is working very well indeed and completely solves the issue I had of not knowing whether Alexa was still able to 'talk' to all of the Smart Plugs. I have PingInfoView set to load, as Windows boot, by adding a shortcut to it in the Startup folder, so it is invisible unless I click on it to check. I have it set to ping each plug, once every 30 minutes, but obviously only when my laptop is powered up - which it almost without fail will be at least once per day. Two failed pings in succession and it fires off an email to warn me.

Reviewing the logs, the worst cases for failed pings, suggests there are two Smart Plugs which produce ping failure of 5%, other six are around 1%. One is the SM which switches the car battery charger on/off in my garage and the other a SM which powers my laser printer in the small bedroom. Why the latter, when it is reasonably close to a router I don't know, but both have failed to respond in the past, hence my trying to find a workaround to advise me when the do fail to respond. I can understand the one in the garage failing - it is some distance out back and under a metal roof.
what is it you do with these smart plugs that you can't do ny turning sockets on/off. Are the sockets self contained with RJ45 connection with the ability to act as an AP? so each plug has a dynamicaly assigned local address and then in turn, it can assign yet another address to the device that is powered from the socket? I though the smart sockets were in effect a remote control, a simple ON/OFF
 
windows is a GUI based system so why on earth would you want to use the CLI?
It allows more direct access to the file system, for some tasks it is quicker, you can easily run scripts and you can run, for example Python programs within the CLI.

Taken to the extreme, many LINUX users prefer to use the terminal, over a GUI.
I have several RPi. They are fully functioning computers with GUI, but running it has a performance penalty.
Additionally, I run them remotely disconnected from a monitor/keyboard/mouse.
A remote terminal session is by far the best way to command the RPi, rather than suffering extremely poor performance over VNC.
 
I though the smart sockets were in effect a remote control, a simple ON/OFF

That is all the do, switch on or off, but via either remote control or under quite clever programmed control (Alexa). Problem was, I could not find any way for Alexa to let me know when it was unable to operate the device on or off, unless I actively checked the status regularly. It would run for many weeks, months even - doing what it was supposed to, then just fail and go unnoticed until I loaded Alexa on my phone/PC and checked.

For instance - I replaced a what had been a fairly expensive electro-mechanical solar time clock, which switched an outside light on at dusk, off at 11pm, with a Smart Plug, controlled by Alexa. Another one switches a charger on in my garage, for 20 minutes, to top my car's battery up. One charges my phone during the night, without over charging it. Another allows me to remotely turn the printers on and off, located in the small bedroom, so I can print documents from anywhere in the house.
 
Last edited:
It allows more direct access to the file system, for some tasks it is quicker, you can easily run scripts and you can run, for example Python programs within the CLI.

Taken to the extreme, many LINUX users prefer to use the terminal, over a GUI.
I have several RPi. They are fully functioning computers with GUI, but running it has a performance penalty.
Additionally, I run them remotely disconnected from a monitor/keyboard/mouse.
A remote terminal session is by far the best way to command the RPi, rather than suffering extremely poor performance over VNC.
https://www.makeuseof.com/linux-myths-debunked/
 
It allows more direct access to the file system, for some tasks it is quicker, you can easily run scripts and you can run, for example Python programs within the CLI.

Taken to the extreme, many LINUX users prefer to use the terminal, over a GUI.
I have several RPi. They are fully functioning computers with GUI, but running it has a performance penalty.
Additionally, I run them remotely disconnected from a monitor/keyboard/mouse.
A remote terminal session is by far the best way to command the RPi, rather than suffering extremely poor performance over VNC.
I have a pi4 8gb that provides: NAS (omv running multiple services with 8TB HD files) and this supplies 5 TV's with simultaneous content and no buffering. It runs pi-hole to remove the adverts and runs a torrent search (automated) to get the latest TV series from all providers. I also have it running as an email server and a small web server. It runs all of these services simultaneously without loss

I have pi zeros acting as media players for bathrooms ceiling speakers (one lot BT the other a vibration speaker)
I also have pi zeros which detect gas and water located under the house and report back on temp and humidity
The main pc's in the home are using parrot OS and all laptops are triple boot (I hate VM's)
Having been a computer user since 1981 I can recall the days of using a VAX and the AS400 in which CLI was the only method.
Linux is now really a GUI system and so far from the early days as to be indistinguishable from any other GUI driven OS.
It seems odd that windows users want to be like old linux users and visa versa lol
https://www.makeuseof.com/linux-myths-debunked/
 
I don't know about the items being "smart" but it would seem the owners have to be smart or even super smart to keep them operating,
 
I have a pi4 8gb that provides: NAS (omv running multiple services with 8TB HD files) and this supplies 5 TV's with simultaneous content and no buffering. It runs pi-hole to remove the adverts and runs a torrent search (automated) to get the latest TV series from all providers. I also have it running as an email server and a small web server. It runs all of these services simultaneously without loss

I have pi zeros acting as media players for bathrooms ceiling speakers (one lot BT the other a vibration speaker)
I also have pi zeros which detect gas and water located under the house and report back on temp and humidity
The main pc's in the home are using parrot OS and all laptops are triple boot (I hate VM's)
Having been a computer user since 1981 I can recall the days of using a VAX and the AS400 in which CLI was the only method.
Linux is now really a GUI system and so far from the early days as to be indistinguishable from any other GUI driven OS.
It seems odd that windows users want to be like old linux users and visa versa lol
https://www.makeuseof.com/linux-myths-debunked/

Yes, nice! :)

But as I say, an RPi Zero suffers poor performance when VNC'ing and my RPi Model B is extremely clunky when running a GUI, let alone a VNC session - the cursor lag is terrible.

...and for middle of the night tinkering, there is nothing better than opening a terminal on my phone, from bed!

Screenshot_20220726-170801_ConnectBot.jpg

I have dual boot Ubuntu machines and I agree, LINUX is a GUI system.

But, and my experience is maybe not that of a typical user, working in a university science department - many of the Linux users prefer not to use GUI.
There is even an academic who won't use a GUI for their email client!
This seems inconceivable to me, but watching them send an email is like watching an artist at work! The speed and efficiency is really impressive :)
 
Yes, nice! :)

But as I say, an RPi Zero suffers poor performance when VNC'ing and my RPi Model B is extremely clunky when running a GUI, let alone a VNC session - the cursor lag is terrible.

...and for middle of the night tinkering, there is nothing better than opening a terminal on my phone, from bed!

View attachment 275409

I have dual boot Ubuntu machines and I agree, LINUX is a GUI system.

But, and my experience is maybe not that of a typical user, working in a university science department - many of the Linux users prefer not to use GUI.
There is even an academic who won't use a GUI for their email client!
This seems inconceivable to me, but watching them send an email is like watching an artist at work! The speed and efficiency is really impressive :)
what is VNC ing?
so what happens if i want to read emails, browse the web, compose a document? don't tell me you use the CLI to do that LOL
 
what is VNC ing?
Virtual Network Computing - a GUI desktop sharing system over a network.
so what happens if i want to read emails... don't tell me you use the CLI to do that LOL
There is even an academic who won't use a GUI for their email client!
This seems inconceivable to me
I believe she used 'Alpine' as the CLI email client - other CLI based email clients are available!

so what happens if i want to... browse the web, compose a document?
This was never a question about not using GUI's; it was a question about using CLI where it was more appropriate, more powerful, and more efficient to do so.
In my case, that means remote control of my 'headless' RPi's and with Windows, it's a quick way to run Python scripts and to efficiently access Windows commands that are becoming ever more obscured by the OS.

If there wasn't still a need for the CLI, wouldn't tools such as CMD and PowerShell, have faded into obscurity by now?
 
This seems inconceivable to me, but watching them send an email is like watching an artist at work! The speed and efficiency is really impressive :)

I served a fairly comprehensive 'apprenticeship' in various languages and command line long ago. The problem I find is in remembering it all when there is no consistency. Windows offers a fairly consistent user interface, consitant icons - learn your way around one bit of software and what you have learned holds good for the majority of Windows software - so that's what I use now.

For email I use MS Outlook, as I have done for many years. Having lots of regular appointments to remember, I developed a system of Post-It notes stuck on the side of a kitchen cupboard for quick reference. Last week, I began wondering if I might be able to find a digital solution, to replace my old Post-it notes and looked a bit more intensively at what Outlook's calender could do. Marvellous - I can just fill in the reminders dates to make the appointments, fill in the appointments and when I want to be reminded, Outlook then flashes up a reminder on screen of the details on the day, even better, it somehow manages to send a notification to my Iphone. Laptop is usually turned on first thing each morning - so difficult to miss.

Even then, there are exceptions. For many, many years I have relied upon Mesnews as a newsreader, going back to maybe W95. It hasn't really been updated since it was released, so it has begun to lack certain features as time has progressed. A few times, I have tried to get myself moved to Thunderbird, which is maintained and regularly updated. Each time I dropped it as too big a step, as so much new to be learned and set up. I tried it again yesterday, a little more determined to make sense of it and have at last made it work.
 
Last edited:
Sponsored Links
Back
Top