Forum Home › Forums › Understanding the Software › Only Archive on “Status change”
- This topic has 15 replies, 2 voices, and was last updated 1 hour, 59 minutes ago by
TroyV23.
-
AuthorPosts
-
January 13, 2026 at 10:12 pm #17547
TroyV23
ParticipantIm attempting a different path, so I’ve created this feed using the API:

I am not able to display the channel number it always displays as undefined.
mainApi.getHistData(ARCHIVE_BIT, timeRange, “55500-55508”, function (dto) {
let outElem = $(“#divData2”);if (dto.ok) {
outElem.html(“”);
let timestamps = dto.data.timestamps;if (timestamps.length > 0) {
let trend = dto.data.trends[0];
let table = $(“<table></table>”);
table.append(“<tr><th>Date</th><th>Time</th><th>Channel</th><th>State</th></tr>”);for (let i = 0; i < timestamps.length; i++) {
let timestamp = timestamps[i];
let record = trend[i];
let state = record.df.dispVal;
let channel = record.cnlNum;// Only show On/Off
if (state !== “On” && state !== “Off”) continue;let dt = new Date(timestamp.lt);
let day = String(dt.getDate()).padStart(2, “0”);
let month = dt.toLocaleString(“en-US”, { month: “short” });
let year = dt.getFullYear();let hours = String(dt.getHours()).padStart(2, “0”);
let minutes = String(dt.getMinutes()).padStart(2, “0”);let dateStr =
${day}-${month}-${year};
let timeStr =${hours}:${minutes};// Pick CSS class
let stateClass = state === “On” ? “state-on” : “state-off”;table.append(
`<tr>
<td>${dateStr}</td>
<td>${timeStr}</td>
<td>${channel}</td>
<td class=”${stateClass}”>${state}</td>
</tr>`
);-
This reply was modified 1 hour, 57 minutes ago by
TroyV23.
-
This reply was modified 1 hour, 57 minutes ago by
-
AuthorPosts
- You must be logged in to reply to this topic.