Restart remotely after shut down


#1

Hello, my Pi used to stay in the network after I shut the system down from web interface (it was pingable). I reinstalled the system to a new SD card, now when I shut it down it is no longer reachable, not responsive to pings. I made the exact same installation, may be something changed with the version.
I basically want to shut the system down and leaving that way, then when I need it I want to restart it remotely, any suggestions?
Thank you


#2

Is it possible that your router issued a different IP address via DHCP? Maybe it is PING'able from the new address.

How did you reinstall the system? Did you make a backup of the entire microSD using something like ApplePi Baker or Etcher or similar and then restore from there? I use ApplePi Baker for all my cloning activities like this.

If you reinstalled the system by starting from scratch ("install Raspbian plus install OctoPi...") then you'd need to make sure that you've repeated the steps you did the earlier time that this worked.


I myself can start my printer via an Amazon Alexa skill using a TP-Link Smart Plug for the printer's power. Here's my workflow:

  1. shutdown the Raspi
  2. turn off the TP-Link Smart Plug
  3. later, turn on the TP-Link Smart Plug and the printer is ready for business

The TP-Link Alexa skill will work remotely as well; I don't have to be at home.


#3

Thank you for your response. On the first time (2 weeks ago) I just downloaded img file then used win32 disk manager. Used Putty to SSH in.. On the second time (today), I downloaded the img file again and did the exact same things. The only possible difference is the img file version.
PS I am pinging with the name "octopi.local" so I don't think DHCP is playing any role here.
Regards


#4

So...

ping octopi.local

...is happy? Then yes, DHCP issued an IP address. Usually the people on Windows don't have iTunes and therefore don't have Bonjour and therefore have to talk to OctoPrint via the IP address. But if you did ping the computer then it would now be in your arp cache and you should then be able to visit it via http://octopi.local from your browser, in theory, even from a Windows-based workstation.

If not, then maybe OctoPrint as a service hasn't started. Next, I think I would attempt to ssh into the computer via ssh pi@octopi.local and see if I could get a connection. I'd then try to find out if octoprint is running with ps -ax | grep octoprint. Or I might manually read the latest octoprint log with cat ~/.octoprint/logs/octoprint.log | less.

The log should indicate that the startup time matches when you started the printer's power.


Alternate scenario: ping doesn't respond when you use octopi.local. I think I would check my router to see what (new) IP address was issued to the computer. I'd then ping 192.168.0.40 or whatever IP address was issued if this is the case. This often will put the computer's mac address into your arp cache and then you might be able to visit http://octopi.local via your browser.

If the router doesn't see the Raspberry Pi then put the microSD back into your workstation and edit the /boot/octopi-wpa-supplicant.txt file with your wi-fi information.


#5

I like to put the MAC addresses of each of my Pi's into my router, and then have the router assign the same static IP to the same Pi no matter how many times I nuke & pave

Saves a lot of effort finding them in the future


#6

I'm not sure I'm following what you are saying. If you shut your system down, you should not be able to ping it until you turn off the power to the Pi then turn it back on again so it reboots. If you were able to ping it after you "shut the system down from web interface", then for some reason, the system did not actually shut down.


#7

Can you use the TP-Link without their proprietary hub-link-thing to connect to the network ?


#8

Yes. You could also use other devices like Sonoff SmartPlugs/relays as well. I've developed plugins for both.

Of course, these plugins won't work for you directly when you can't get to OctoPrint to control it. But the Sonoff devices flashed with Tasmota can be controlled via it's own web interface and/or MQTT commands.


#9

You initially need to use their KASA app to introduce the TP-Link to your wi-fi network (or if you move it, say, when demo'ing and for public shows).

Once it's connected to your network, I'm guessing that it talks to the cloud to see if there is any outstanding Alexa messages. Otherwise, I have no idea how Alexa (cloud) can control it. Presumably it polls a job queue.


#10

I have a TP-Link electric outlet, but, after I bought it the instructions said something about having their own hub to control it. I saw the TP-Link plugin for Octoprint, but, assumed that I'd still need their hub

After having made all those assumptions, I never actually got as far as plugging it into the wall

It's currently sitting in a box in the basement somewhere


#11

Bring it out and give it a try.

I note that the iOS version of the Alexa app does not currently allow you to speak into your phone to control her/it. The Android version of the app does appear to allow this functionality so you could technically get away without purchasing an Amazon Echo Dot, for example, nor using the KASA app to control it.

  1. In the Alexa phone app, I turn on the TP-Link and do a Settings -> Smart Home -> Add Device and let it find the TP-Link and I name it "3D printer" in this case.
  2. In the KASA phone app, I also do a discovery and name it "3D printer" but I rarely use this app to control it.
  3. I say "Computer, turn on the 3D printer" and the Dot will forward the command to the TP-Link (either via the cloud as I described above or maybe via the wi-fi locally).

But come to think of it, I demo'd this at the San Diego JS meetup in front of about 120 people and I turned on the TP-Link remotely so that suggests that either the Dot or the TP-Link is in polling mode.


#12

Okay, it's not a TP-Link, it's a zigbee

Looks like it's controlled by some sort of radio signal. RF, 915mhz and 2.4ghz

No wonder it was so cheap


#13

Oh, Zigbee's are awesome... they're just more for radio communications like peer-to-peer or remote control planes and such.


#14

I wasn't trying to make my printer fly or anything


#15

I would go for a simple device like an ESP2286

and shut on/off with a relay by sending simple AT codes to the ESP8266 steering it´s GPIO
All that Alexa , Zigbee stuff is too complicated for diy ..unless you are willing to pay and put your printer power in the safe hands oif a cloud provider. I would not even think about all that cloud based switching stuff.

Imagine you sit in cold house and your DSL is defunct and you cannot switch it oin...


#16

Well, this technically would work great if you never applaud your printer...

Clapper


#17

Yes, I heard Ronald Reagan had that connected to our nuclear missiles

Wouldn't work from the next room tho

Unless I clap really loud. But that would scare the cat

On the other hand, so would the nuclear bomb


#18

Did you ever get the original problem sorted out (printer-not-reachable)?


#19

Yes, thank you for asking.

It seems that the pi3bPLUS has some special needs of its own that I had to navigate

Unfortunately, I visited so many google pages and made so many changes that I can't remember exactly which one solved the problem

From memory... one problem had something to do with editing wpa-supplicant (correctly), also had to go into raspi-config (had to manually set country, then specific region) and then there was a bind, or bound command that I tried, but, at the end, I think wasn't relevant

I think the one that was probably the answer was the region

Oh, and after you do a sudo, it's going to ask you for the password every time


#20

Well done, then. The wi-fi country code is seen in both the /boot/octopi-wpa-supplicant.txt (uncomment out your country and comment out the default) and in the raspi-config configuration. It may configure that country's wi-fi channels but at least I'm certain that it sets country-specific power transmission rates (for example, Bolivia allows the maximum dB versus the U.S.).