[Wiki] HTTP Features and Endpoints

The 'stats' have been exposed now via the "Logs" page in the Hub UI as part of the latest hub firmware release. This is why the URL's were removed.

5 Likes

Thanks, merged your changes in with a few that were suggested by csteele.

1 Like

thanks a few more changes

  1. your new temp code broke my temp display stuff, fixed it and was able to remove a now superflous fx.
  2. change the wording and code so the schuduling input description reflects updating the html attribute as well. Also added the call from the scheduling fx to actually update the html attribute.
  3. had to add an additional update to force it to update the formatted uptime as well when the sched. fx runs.
Summary

hubitat/hubstats.groovy at master Ā· lgkahn/hubitat Ā· GitHub

4 Likes

Done. Going to try adding this to HPM too.

3 Likes

You may also want to create a dedicated thread in the community for this. It would probably help it reach more users and keep the discussion focused in its own thread.

8 Likes

Probably should, this got a little bigger than I thought it would.

8 Likes

I did almost the same thing as I was playing around with this (my first attempt at groovy). I found some code that did the days/hours/minutes/seconds conversion and adapted it.

Uptime Formatted

def convertSeconds(int secondsToConvert) {
long millis = secondsToConvert * 1000;
long days = TimeUnit.MILLISECONDS.toDays(millis);
long hours = TimeUnit.MILLISECONDS.toHours(millis);
long minutes = TimeUnit.MILLISECONDS.toMinutes(millis) % TimeUnit.HOURS.toMinutes(1);
long seconds = TimeUnit.MILLISECONDS.toSeconds(millis) % TimeUnit.MINUTES.toSeconds(1);

hours = (hours - (days*24))

String format = String.format("%02d d, %02d h, %02d m, %02d s",Math.abs(days), Math.abs(hours), Math.abs(minutes), Math.abs(seconds));
return format

}

1 Like

i did it old school.

ie

Summary

def formatUptime(){
String attrval

Integer ut = device.currentValue("uptime").toDouble()
Integer days = (ut/(3600*24))
Integer hrs = (ut - (days * (3600*24))) /3600
Integer min =  (ut -  ((days * (3600*24)) + (hrs * 3600))) /60
Integer sec = ut -  ((days * (3600*24)) + (hrs * 3600) + (min * 60))

attrval = days.toString() + " days, " + hrs.toString() + " hours, " + min.toString() + " minutes and " + sec.toString() + " seconds."
sendEvent(name: "formattedUptime", value: attrval, isChanged: true) 

}

1 Like

Is there a way to see what memory individual app's and devices are using?

1 Like

Not that I know of.

Does http://ip/hub/cpuInfo work still?

Also what memory is 'free memory' I tried force CG and clean database but it didn't change the reported values

I get a 404 on ../cpuInfo (looked at it the other day). The GC will run on its own periodically, so adding an additional run may or may not free up any memory at the time of the run.

If you really want to experiment, the endpoint to change GC frequency is /hub/advanced/intervalBetweenGCs/123, with accepted value range of 30-300. Default is 100. I suppose the utility of setting it higher or lower depends on what exactly is running on the hub, but don't expect to get a lot out of it.

No. I've added a few metrics for both apps and drivers on Logs page, and will likely expand on it, though.

8 Likes

What's the interval measure, second,minutes,...?

It's seconds.

3 Likes

Perhaps not; two wrongs not making a right, etc. But...bad behavior erodes / avoids building trust. Lack of trust leads to people looking for security in other directions, among geeks often by acquiring information.

The very thin documentation here, combined with the (seemingly best option) advice to look at the previous version of a competing product, is also relevant. We need information to use this thing.

And possibly a mix of users with lots of software experience and users with none (and every gradation in between) leads to some people being pretty casual about what they'll try and rarely getting into trouble, and maybe being kind of optimistic about what we recommend :slight_smile:

2 Likes

@dd-b,

I said something along those lines almost a year ago ...

Documentation: when will we get a proper one?

3 Likes

Yeah, that does seem to be the big shortfall here. Heck of a nice group of users around these forums though!

1 Like

Yes, the community saves the day.

However, we canā€™t ignore the availability of the staff - always ready to help. But sometimes I feel uncomfortable to ask questions that I know are trivial but I canā€™t find the answers by myself, even after spending hours trying. Itā€™s frustrating.

I developed an app & drivers for the Nuki Smart Lock and I couldnā€™t remember the last time I took so long to get along with a platform. Itā€™s tiresome too.

Well, thatā€™s what we have and, to be honest, HE really is a great product. Letā€™s hope that, someday, a good documentation joins it!

3 Likes

Haven't actually updated a page, but it does look like users who create an account on the docs.hubitat.com can update things in the wiki. I get the edit page, it would be weird to let me have that and then forbid saving the result. So far I don't feel like I understand any of the missing things well enough to try to explain them to others.

Oh! Yes, the active participation of staff is very useful, I think. Not sure which of the notations that appear by forum user names represent staff -- all of them? But clearly some of the people who have helped me are staff, from credits on other bits of code and such :slight_smile: .