@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:
- Trigger — Switch (momentary) turns on
- Action: send HTTP POST (form encoded) http://Hub_IP:8080/hub/reboot
That’s all there is to it!
Also, pretty certain you have to disable any login/passwords on the hub too.
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?
You are correct. I pasted the wrong script!
For reboot:
Replace:
curl -k -sb $cookiefile https://$he_ipaddr/hub/backupDB?fileName=latest -o $backupfile
with
curl -k -sb $cookiefile -X POST https://$he_ipaddr/hub/reboot
And delete
backupdir=/opt/hubitat/hubitat-backup/hubitat
backupfile=$backupdir1/$(date +%Y%m%d-%H%M).lzf
#
find $backupdir/*.lzf -mtime +5 -exec rm {} \;
Do you know how to reboot from RM using the url address? I have a friend with a c5 and wemo and I would like to set a rule to reboot the hub every X days....
Thanks
See below. The pre-requisite is that hub login security has to be turned off (under Settings -> Hub Login Security). Replace hub.ip.addr with the actual address of the hub. I don't know this for a fact, but I would bet that 127.0.0.1 (loopback address) would work.
This is the rule to reboot at 4AM every day:
Note that the HTTP request has to be a POST request (not an HTTP GET):
Thank you! Having the security off is not an option right now, but posible when I close the open port on his network. Thanks again.
However, I would like to state for the record, that sometimes just rebooting isn't enough.
Sometimes, you have to remain off, for say 10 minutes, and then start up again.
(This does some clearing of the zwave radio).
I do not think that this can be done pro grammatically from Hubitat, so I recommend getting a $10 WiFi outlet, and scheduling a 10 minute downtime.
P.S. Don't forget to schedule a shutdown, BEFORE turning off the power!
Hello, I am trying to get the URL triggered reboot to work. I am getting the Error 404 message mentioned above.
I guess that means I need to "log out" of the hub? I can't actually find where to do that...
two questions then:
- is the consensus that one must not be logged in for a reboot command to work?
- How the heck does one log out?
Thanks!!!
Are you trying to log in from the :8081 screen?
I am trying to find ANY fool-proof way to reboot my hub every night.
If you want a way to reboot the hub automatically, you need to turn off the option to require a password and login. This will mean anyone on your local network can browse to the Hubitat.
Unless the reboot commands are sent to the HE from an external source. For example as described in this post:
Do you have an SBC like a RPi? Or any other computer that runs "curl" as is powered on all the time?
You can use a curl script like this (if you have a hub login):
#!/bin/bash
#
he_login=hubitat_login
he_passwd=hubitat_password
#
he_ipaddr=hubitat_ip_address
cookiefile=`/bin/mktemp`
#
curl -k -c $cookiefile -d username=$he_login -d password=$he_passwd https://$he_ipaddr/login
curl -k -sb $cookiefile -X POST https://$he_ipaddr/hub/reboot
If you don't have a hub login, then something as simple as:
curl -X POST http://$he_ipaddr/hub/reboot
would work.
Yeah I have a pi running and can probably do that.... I am just stuck on whether or not I actually have the password/username thing turned off and also whether or not I can have Hubitat do it by itself... will do some more looking. Thanks for your code!!!
You currently don't have a username/password enabled.
My goodness... your simplest command actually seems to have worked - sent it from a terminal on my mac for now... THANKS!!!
I’m still planning to test a way to capture a cookie and send a packet securely, but haven’t had time if anyone wants to share notes, I’m happy to!