Hi,
I'm looking to add a dashboard tile which shows devices which haven't had any activity in a while.. similar to what this Hubiat app does
To do this I'll need to know the last time every device has had any activity -- the "Last Activity At" field.
But, I realized that I don't get this field back via MakerAPI. There is a date
field which is returned but it doesn't always match the "Last Activity At" value. In fact it's "null" for some of my devices.
So, what exactly does the "date" field represent returned from MakerAPI?
- response from MakerAPI for the same device as image above:
/devices/all
request
{
"label": "Tool Room Door",
"type": "Generic Zigbee Contact Sensor",
"date": null,
...
- Also, there's no date field returned in the
/devices/240
request:
{
"id": "240",
"label": "Tool Room Door",
...
I asked a similar question years ago but didn't get a reply: Maker API Request - add last updated date to device info response
It'd be really nice if both MakerAPI responses could contain a date
field for each device which matched the Last Activity At date displayed in the device details.
thanks - yeah that could be possible. The battery on this device likely died a while back. It would be nice if MakerAPI could return the same date that the device page shows for last activity at but I'll just ignore this one for now to get to my larger question/request:
The "date:" field reports the last time an Event was recorded and/or attribute got updated for that device or variable connector
That seems like it would work for an activity monitor dashboard tile. But, now the question is how to get it back via MakerAPI.
I tried a few different MakerAPI calls and date
is only returned in one of them. Unfortunately, that's the slowest API call by far.. does anyone know who at Hubitat might be able to add this to the other requests? I think it'd be useful for others too.
/devices/all
- date returned
/devices
- date not returned
/devices/*
- date not returned
/devices/1406
- date not returned
/devices/1406/attribute/date
- date not returned
@jpage4500 With the new UI changes in the past several releases you can get a list of devices via the hub-ip-address/hub2/devicesList endpoint. This is the JSON used behind the scenes to display the Device list when when you click Devices within the left navigation.
Within this JSON result you will find the "lastActivity" timestamp which is the same that shows up in the table. Maybe this helps your use case.
3 Likes
That's interesting, thanks! I would prefer to stay within the MakerAPI endpoints only because they'll also work remotely as well. But, it is nice to know about this endpoint and maybe I can find a way to use it if/until MakerAPI gets updated
2 Likes