[APP][Pro] Simple (Sys) LOG - Use this app for Simple (Sys) Logging

Perhaps uninstall and reinstall the app?

If you don’t have a SLL device, after installing it again, everything, like flows, should stay intact.

(You will ofc loose your current log when uninstalling)

Ok, I uninstalled the app, restarted the Homey (just to be safe) and reinstalled the app again. It’s quite scary to see so many flows with grey cards, but now the flows seem to be okay again.

Now let’s wait for a few days to see if this solved the problem.

Thanks so far!

Greetings,

Wim

I have problems with the clearlog GET request. When I try to clear the log with GET /api/app/nl.nielsdeklerk.log/clearlog → 192.168.1.5:4859/api/app/nl.nielsdeklerk.log/clearlog/
I get the error

{"error":"Missing Session","error_description":"Missing Session","stack":"Error: Missing Session\n    at file:///app/packages/homey-local/lib/ManagerApiLocal.mjs:86:27","statusCode":401,"statusName":"HomeyErrorUnauthorized"}

How to fix this issue?

Athom changed stuff a while ago; you can use this Homeyscript for example:

// Clear SimpleLog log
let slApp = await Homey.apps.getApp({id:"nl.nielsdeklerk.log" }); // Simple Log app
const resGet = await slApp.get({path: '/clearlog/'});
console.log ("Log cleared: ", resGet);
1 Like

I have used syslog to add log MESSAGE detail to steps in my flows and then used the GET command to retrieve in CSV format. Where is the CSV then stored so I can review it?

Or have I misunderstood how this works?

Steve

It should save the CSV to your device. Maybe it only works in the web app? AFAIK the mobile app doesn’t support downloading files.

Are you referring to the Simple (sys) log app, @Steve_Nye

Yes I am.

Did you use the web app? The mobile app can’t download files.

I was using a desktop Mac

The CSV should be downloading like any other file you download in the browser.

By chance I found that the card says that it creates a tag of LOG. Further experimenting shows that I can then select all and paste directly into a spreadsheet. Is there no easier way to say the log?

In the app settings page (Settings→Simple (Sys) Log → Configure), you can download as CSV.

Hmmm, this might be the case on your end, but it’s not in general; I just downloaded the .csv w/o issues using the Android app:

@Steve_Nye

  1. In case you want do save the logs on external storage, you can use the FTP Client app for example.
    First add a FTP enabled server / NAS to Homey per FTP Client app


    .
    EDIT: use the “get log as CSV (Base64)” card instead, when you get a bunch of odd characters as file contents:

    .

  2. Another possibility is using a syslog server.

  3. When you want to peek the log every now and then, you can save and open this html file (change the IP address to your Homey’s IP

<!-- Save as html file and open it to view the logs -->

<!-- NOTE: at line 48: Replace IP address with IP address of your Homey -->

<!DOCTYPE html>
<html>
<head>
    <!-- (optional) Replace title with your own -->
	<title>Homey1 log</title>
    <style>
        table, th, td
        {
            border: solid 1px #ddd;
            border-collapse: collapse;
            padding: 2px 3px;
            font-family: verdana;
            color: #fff; <!-- change font color-->
            <!-- font-size: 30px; -->
            text-align: left;
         }
            tr:nth-child(even) {
            background-color: #393939; <!-- change background color of even rows -->
            }
            tr:nth-child(odd) {
            background-color: #101010; <!-- change background color of odd rows -->
            }
            tr:hover {
            background-color: #874444; <!-- change background color of mouse hovering -->
            }
        th {
            font-weight: bold;
            font-family: verdana;
            text-align: left;
        }
    </style>
</head>
<body>

	<p style="font-size:30px;" id="showData"></p>

</body>

<script>

 // the json data //

// !! Replace IP address with your Homey's IP address !!

const url = "http://192.168.2.7/api/app/nl.nielsdeklerk.log/"; 

// END of Replace IP address

async function FetchData() {
  const response = await fetch(url);
  const data = await response.text();
  const string = "["+data+"]";
  const myJSON = JSON.parse(string);
  const JSONtable = myJSON[0].logs;

  response.ok;     // => false
  response.status; // => 404

  return JSONtable;
}

FetchData().then(JSONtable => {
  JSONtable; // => 'Page not found'

    // Extract value from table header.

    let col = [];
    for (let i = 0; i < JSONtable.length; i++) {
      for (let key in JSONtable[i]) {
        if (col.indexOf(key) === -1) {
          col.push(key);
        }
      }
    }

    // Create table.
    const table = document.createElement("table");

    // Create table header row using the extracted headers above.
    let tr = table.insertRow(-1);                   // table row.

    for (let i = 0; i < col.length; i++) {
      let th = document.createElement("th");      // table header.
      th.innerHTML = col[i];
      tr.appendChild(th);
    }

    // add json data to the table as rows.
    for (let i = 0; i < JSONtable.length; i++) {

      tr = table.insertRow(-1);

      for (let j = 0; j < col.length; j++) {
        let tabCell = tr.insertCell(-1);
        tabCell.innerHTML = JSONtable[i][col[j]];
      }
    }

    // Now, add the newly created table with json data, to a container.
    const divShowData = document.getElementById('showData');
    divShowData.innerHTML = "";
    divShowData.appendChild(table);

	});


</script>
</html>
  1. This can be taken further, by adding it as Dashboard widget:
    [APP][Pro] Simple (Sys) LOG - Use this app for Simple (Sys) Logging - #449 by Peter_Kawa

I also have the Android app, but there it can’t download the file

Don’t use the app myself (just installed it once for testing) so I don’t know if there are workarounds.

Thanks, that was the missing part of the jigsaw.

I also managed to download the CSA file on iOS.

Many thanks Peter this opens up a whole lot of opportunities that I will explore, I also have a Synology NAS and the FTP route looks like a good route to go.

1 Like

Aaaaah, that functionality appears to be dependent on the Better Logic Library app, Sven (like the tooltip says), which I’ve installed as well.

And when it “just works” in my case, it doesn’t mention BLL, hence I forgot to mention it as prerequisite!

You need to install the BetterLogicLibrary app for advanced features.

Edit: a, like peter mentions just above this message :sweat_smile: