[RELEASE] Hub Health Monitor & Auto Reboot Application

How odd, I’m sure this was working the other day, but today it’s not working on any of my hubs.

I'll poke around in the morning to see if I can find the replacement

Edit: The endpoint works but you need to use an HTTP POST

1 Like

Cheers, I’ll try that.

I may have reversed the methods above, here is the code that I use in Hub Info

    if(!minVerCheck("2.3.7.14")){ //hub version is less than 2.3.7.14
    	httpPost(
	    	[
		    	uri: "http://127.0.0.1:8080",
			    path: "/hub/rebuildDatabaseAndReboot"
    		]
	    ) {		resp ->	} 
    } else {
        httpPost(
		[
			uri: "http://127.0.0.1:8080",
			path: "/hub/reboot",
			headers:[
                "Content-Type": "application/x-www-form-urlencoded"
			],
            body:[rebuildDatabase:"true"] 
	    ]
    	) {		resp ->	} 
    }
1 Like

Thank you, I’ll give that a shot.

Btw, does it matter that I’m doing this from an app rather than driver?

Ok, I am basically using your code, but only the regular reboot endpoint is working.

if (rebuildDatabase) {
            httpPost(
                [
                    uri: "http://127.0.0.1:8080",
                    path: "/hub/rebuildDatabaseAndReboot"
                ]
            ) { resp -> }
            log.info "Database rebuild and reboot command sent successfully"
        } else {
            httpPost(
                [
                    uri: "http://127.0.0.1:8080",
                    path: "/hub/reboot"
                ]
            ) { resp -> }
            log.info "Reboot command sent successfully"
        }

And if I try the endpoint manually, I get a 404

Try this as the else branch:

 else {
        httpPost(
		[
			uri: "http://127.0.0.1:8080",
			path: "/hub/reboot",
			headers:[
                "Content-Type": "application/x-www-form-urlencoded"
			],
            body:[rebuildDatabase:"true"] 
	    ]
    	) {		resp ->	} 
    }

note that it is a POST (not the GET that your browser uses) and there is a Content Type and Body. If you want to test outside of the code you'll need to use something like curl or maybe postman to send it as a POST.

1 Like

Cheers, I’ll take a look tonight after work.

This worked! Thank you mate. :pray:

Release:
v1.1.3 - Finally got the Rebuild Database on Reboot funtion working

1 Like

So now that that works, I've added some extra logic to the scheduled reboot function to cater for folk having run recent hub firmware updates etc.

v1.1.4 - Added uptime check - skips scheduled reboot if hub uptime < 70% of scheduled interval

1 Like

Release
v1.1.5 - Updated default memory threshold to 200 MB and minor improvements to scheduler logic.

1 Like

Big release today:

v1.2.0 - Renamed to "Hub Health Monitor & Auto Reboot" and added hub event monitoring for zigbeeOff, zwaveCrashed, and severeLoad events with 5-minute startup grace period

I also added section breaks and bolded section titles to make it easier to read.

3 Likes

Is there an event or endpoint for Matter going offline/Crashing. - I'm not aware of one, but it would be a useful add, if such an event exists.

Im not sure, but Im happy to add this if there is.

I haven't seen one yet. Only indication that I know of is to request the matter details (/hub/matterDetails/json) and look at networkState.

1 Like

Cheers, I’ll have a look.

1 Like

Bug Fix Release - this was breaking the scheduled reboots.

v1.2.1 - Fixed BigDecimal.round() compatibility issue for Hubitat
v1.2.2 - Improved debug mode for testing. (to make my life easier when finding bugs)

Minor Update:

v1.2.3 - Added hub model detection using getHubVersion and display in info panel. Total RAM now determined by hub model