Hub reboot URL doesn't seem to work

My hub slows down every 7-8 days, so I want to schedule a weekly reboot at a suitable time.

I was under the impression the following URL should work to reboot the hub, but it isn't.

curl -k -sb $cookiefile -X POST https://ip.address/hub/reboot

The cookie is recovered using:

curl -k -c $cookiefile -d username=$username -d password=$password https://ip.address/login

The same cookie works fine for my nightly backup. I also tried port 8081 - no luck there either. What is the correct URL to reboot?

Thanks!

Also interested in this auto reboot procedure. Ever since I got the hub I've been noticing these slowdowns as well. It's very quick for about a week, then most of my motion base lighting slows down to a SmartThings speed :confused:. My motion sensors show active instantly however, it seems like a processing problem between my iris motions and ge switches. I've noticed this with no customs apps/drivers on my hub, now I have a bunch and I'm glad it's not worse. Wondering where your noticing these slowdowns?

I don't have user authentication turned on but your reboot url is the same as what I use...just without secure http....I use http://ipaddress/hub/reboot. Maybe try without the "s" on your reboot curl command. :man_shrugging:

curl -k -sb $cookiefile -X POST http://ip.address/hub/reboot

@stephack

I tried that also - didn't work.

I'm really perplexed, because it reboots through the UI. And when I look at the page source, it seems to me that it should work:

reboot: function() {
            1 == confirm("Are you sure you want to reboot the hub?") && $.post("/hub/reboot").done(this.successMessage)
        },

Have you tried temporarily disabling user authentication and trying it again? That would nail down whether your link is correct or whether it's an authentication problem.

@stephack @Ryan780

Solved! It will not reboot (via curl) if I am logged on via the web interface. But if I log out, and then use curl, it works. That's weird.

Probably won't let you "log-in" twice.

Can you create a second "admin" account and do the reboot with that account?

@GatVlieg

I don't think you can create a second account on the hub itself.

Would you use a remote URL at the same time as you are logged into the hub though?

My Mac desktop is logged in more or less all the time.

I had not turned on user authentication, but reading this thread I thought I'd try a test.

After setting up a user and turning on authentication, I plugged this into Chrome on my local Windows machine:

http://192.168.XXX.XXX:8080/hub/reboot

This redirected me to the user credentials login screen with this URL:

http://192.168.XXX.XXX:8080/login?loginRedirect=%2Fhub%2Freboot

After entering in my credentials the hub UI popped up with URL http://192.168.XXX.XXX:8080/hub/reboot, but I get a 404 Error.

I tried re-loading on http://192.168.XXX.XXX:8080/hub/reboot but I just keep getting the 404.

Interestingly, even with authentication enabled, I can access the Hub Diagnostic Tool (http://192.168.0.102:8081) without any need to login.

Anyhow, it appears (?) that turning on user authentication disables local use of the reboot URL without passing on credentials in a cookie as with @aaiyar's confirmed method.

For anyone not using hub user authentication, I use a no-middleman solution suggested elsewhere (sorry, can't find the post at the moment):

I use @ogiewon's HTTP Momentary Switch device and set it up as a "Reboot Button":

Then you can make a rule that pushes / switches it every XX days, giving you self-contained automated reboots, as well as externally /manually available if so desired.

If the momentary reset back to the off state isn't fast enough, just change line 44 from

runIn(1, toggleOff)

which resets in 1 second to something like

runInMillis(200, toggleOff)

which shortens it to 200 milliseconds. That worked for me. It doesn't really matter because switching on or off will both result in a push event that reboots the hub.

1 Like

I had issues trying to do the soft reboot and getting the 404 error. Bobby said it was because I was logged in. Once I logged out I could do it. Is your hub not rebooting from that page because you are logged in ?

Could we use @ogiewon app there to do a shutdown VS a reboot - I guess we just change the URL path ?

I wasn't trying to reboot from the web page.

I was writing a shell script to reboot the hub from my Odroid as a weekly cron job. The shell script (execute on my Odroid) would not reboot the hub if I was logged in via the web page. The solution was to make sure I was logged out before running the shell script.

2 Likes

To: @veeceeoh and @ogiewon:
I just wanted to say "thank you!"
I was having the same problem that others were having (hub slowdown), and I saw that a reboot seemed to alleviate the issue.
I searched for "scheduled shutdown", and found this approach of using the HTTP Momentary Switch approach under the control of a rule. (It's even a simple lighting rule: Every Sunday at 4 am, do a hub reboot!)
Works great! Thanks again!

1 Like

@jtmpush18 I basically want to do what you done with the reset? can you share how you set this up? Thanks

Create a new rule:

  1. Trigger β€” Switch (momentary) turns on
  2. Action: send HTTP POST (form encoded) http://Hub_IP:8080/hub/reboot

That’s all there is to it!

2 Likes

Also, pretty certain you have to disable any login/passwords on the hub too.

2 Likes

This is correct. If one needs to maintain a login/password, then it is possible to reboot the HE externally using a script that runs on an SBC (for eg. an RPi), such as the one pasted below:

#!/bin/bash
#
he_login=hubitat_login
he_passwd=hubitat_password
#
he_ipaddr=hubitat_ip_address
cookiefile=`/bin/mktemp`
backupdir=/opt/hubitat/hubitat-backup/hubitat
backupfile=$backupdir1/$(date +%Y%m%d-%H%M).lzf
#
find $backupdir/*.lzf -mtime +5 -exec rm {} \;
curl -k -c $cookiefile -d username=$he_login -d password=$he_passwd https://$he_ipaddr/login
curl -k -sb $cookiefile https://$he_ipaddr/hub/backupDB?fileName=latest -o $backupfile
rm $cookiefile

This looks like only a backup script?

1 Like