Logs Question - manual vs RM reboots

I have a RM.4 Rule to reboot the hub each day in the early morning.

When I dig into the rule, I find these logs:


Looks good. However, when I did into System Events logs I see:

I guess the question is, shouldn't I expect a systemStart for each day the hub reboots?

I just ran a manual reboot from the system settings, and it created a new row:

Yes. That most likely means that your rule is triggering but the hub is actually not rebooting. Which makes me think that you don't actually have to reboot every day.

Can you show a copy of your rule?

You should, so my question would be whether your rule is really working. If you're sending the reboot POST from the same hub you're rebooting, you'll probably need to specify port 8080 in your URL (e.g., http://localhost:8080/hub/reboot). If you don't have any waits or delays in your rule, you could try just clicking the button to run your rule actions and seeing if your hub really reboots. My guess is no. If this doesn't help,,feel free to post your rule for troubleshooting.

Sorry should have included this initially. Did I do it correctly? I initially had it trigger once a week, so then the trigger selected makes sense. Yes, now that I have it daily, there could be a more elegant trigger re-written...but I was lazy and this should still work. Also this....

I will try the "Run Actions"...

Run action has no effect.

I'm not sure if this would actually cause it to fail, but you don't need the body for this POST. Try removing those contents (type doesn't matter) and see if that helps.

2 Likes

Removed body section. Now looks like this:

image

Run Actions on that had not difference. No action or result.

Do you have authentication turned on for your hub GUI? Do you have to log in to the GUI when you open your browser? Do you have the IP address of the hub correct in your rule?

1 Like

Should work, but if you are not using Hub Security as @Ryan780 is asking about, and it still won't work, you can try this method (but it is essentially the same thing). I've used the method below from time to time. Currently I'm using it until I have a chance to figure out which of my devices is causing the issues.


Use this code from @ogiewon for the HTTP switch.

/**
 *  HTTP Momentary Switch
 *
 *  Copyright 2018 Daniel Ogorchock
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 *  Change History:
 *
 *    Date        Who            What
 *    ----        ---            ----
 *    2018-02-18  Dan Ogorchock  Original Creation
 *
 * 
 */
metadata {
	definition (name: "HTTP Momentary Switch", namespace: "ogiewon", author: "Dan Ogorchock") {
        capability "Switch"
        capability "Momentary"
	}

	preferences {
		input(name: "deviceIP", type: "string", title:"Device IP Address", description: "Enter IP Address of your HTTP server", required: true, displayDuringSetup: true)
		input(name: "devicePort", type: "string", title:"Device Port", description: "Enter Port of your HTTP server (defaults to 80)", defaultValue: "80", required: false, displayDuringSetup: true)
		input(name: "devicePath", type: "string", title:"URL Path", description: "Rest of the URL, include forward slash.", displayDuringSetup: true)
		input(name: "deviceMethod", type: "enum", title: "POST, GET, or PUT", options: ["POST","GET","PUT"], defaultValue: "POST", required: true, displayDuringSetup: true)
	}
}

def parse(String description) {
	log.debug(description)
}

def push() {
    //toggle the switch to generate events for anything that is subscribed
    sendEvent(name: "switch", value: "on", isStateChange: true)
    runIn(1, toggleOff)
    //sendEvent(name: "switch", value: "off", isStateChange: true)
    runCmd(devicePath, deviceMethod)
}

def toggleOff() {
    sendEvent(name: "switch", value: "off", isStateChange: true)
}

def on() {
	push()
}

def off() {
	push()
}

def runCmd(String varCommand, String method) {
	def localDevicePort = (devicePort==null) ? "80" : devicePort
	def path = varCommand 
	def body = "" 
	def headers = [:] 
    headers.put("HOST", "${deviceIP}:${localDevicePort}")
	headers.put("Content-Type", "application/x-www-form-urlencoded")

	try {
		def hubAction = new hubitat.device.HubAction(
			method: method,
			path: path,
			body: body,
			headers: headers
			)
		log.debug hubAction
		return hubAction
	}
	catch (Exception e) {
        log.debug "runCmd hit exception ${e} on ${hubAction}"
	}  
}

You can make that rule a lot simpler and simply "push" the reboot device to get the HTTP request. And since your only trigger is at that specific time there is no need for the conditional statements.

1 Like

Day got crazy @ work today.

  1. Yes, log in security is enabled
  2. IP address is triple checked

You will not be able to reboot the hub in this way if security is enabled.

There is an app called Rootin' Tootin' Something Wild Yahoo Don't Do This Reboot app. I dunno exactly the name. It is a weird and fun name that I'm not going to lookup because I'm on a phone. The name is fun but the app is even "more fun." It detects slowdowns and reboots. It isn't totally safe to use. I have put my hub in a tailspin with it a couple of times and it's pretty funny. Stopping the boot loop becomes a bit of an arcade game where you have to watch for the user interface to come up and then quickly log in and disable the app before it reboots again.

Anyway... my point is that it has an example of how to authenticate to the hub, save the session and then turn around with that session and reboot.

If you wanted to you could rewrite the app to just reboot every night. If you do not have the skills to do this you may have some luck by making a request for help on modifying it to do what you want.

1 Like