I added a new Zwave outlet to my devices and it shows up in Maker and works fine. However, it does not appear in the http://192.168....../devicedata.json file. Why is it not there?
What specific endpoint are you referring to? They one you note does not exist at the root of the hub (i.e., /, as indicated).
It would also be helpful to state what you are really trying to do.
I wrote my own dashboard in html/jquery and I collect the data from the devices and display it in a sortable table for reference (see below). The new Zwave device does not appear in the dump. Here's the code:
fetch('http://192.168.1.105:48888/devicedata.json')
I do a fetch on the webserver IP for the json and manipulate the results. The Zwave device is not included in the returned json data.
There is nothing on the hub that I am aware of running on that port. Are you sure this isn't something special you configured somehow?
Also, your use case seems like a better match for Maker API, a built-in app meant for purposes like this. Is there a reason you didn't take that approach?
Where is this endpoint that you are accessing located? It isnβt on a Hubitat hub.
Ack! My apologies. Brain fart. Senior moment. Forgot how my old code worked.
In code that I created some time ago, I DO use maker to provide data for selected devices to my local webpage/dashboard. But I also wanted to get detailed info from ALL devices, so I used http://192.168.1.137/hub2/devicesList (on my Hubitat) as the source. Unfortunately I could not get around the CORS issues. So I created a small bat file with a curl command that would just copy that data to a devicedata.json on my local webserver and scheduled the bat file to run daily. That's why I didn't see the Zwave device in my original post - the bat file had not run yet! This morning, it ran and I now see ALL the devices shown.
I've now included documentation on all the above into my script so that I won't be embarrassed again! ![]()
<script>
fetch('http://192.168.1.105:48888/devicedata.json')
//fetch('http://192.168.1.137/hub2/devicesList' ,{mode:"cors"})
//NOTE: Due to problems with CORS, I schedule a bat file which runs CURL daily to
// copy devicesList from the Hubitat to a local file devicedata.json.
.then((response) => {
return response.json();
})
.then((data) => {
json = data.devices;
var headers = Object.keys(json[0].data); // Extract headers dynamically from the first item in the JSON array
var flattenedJson = json.map(function(item) { // Flatten the JSON data
var flattenedItem = {};
headers.forEach(function(header) {
flattenedItem[header] = item.data[header];
});
return flattenedItem;
});
$('#columns').columns({
data: flattenedJson,
paginating: 0,
sortby: name,
schema:[
{ "header":"LABEL","key":"name"},
{ "header":"NAME","key":"secondaryName"},
{ "header":"TYPE","key":"type"},
{ "header":"ROOM","key":"roomName"},
{ "header":"ID","key":"id"},
{ "header":"ZIGBEE ID","key":"zigbeeId"},
{ "header":"NET ID","key":"dni"},
{ "header":"DISABLED","key":"disabled"}
]
});
}) //end THEN DATA
.catch(function(error) {
console.log(error);
});
</script>
