timdows/MMM-JsonTable

Descriptive Row not showing.

Closed this issue · 9 comments

This is the data from the json file I am incorporating.

"data": [
[
"2020-10-30 07:46",
75.79,
35.00,
46.20,
71.92
]
]

First off, if there is a way for it to omit the second line of data (75.79) that would be ideal as it is redundant and confusing. Second, i used this string in my config, however, the descriptive row didn't populate. any thoughts?

url: 'http://10.0.1.150/transfer/log.json?start-time=0&end-time=60', // Required
arrayName: 'data', // Optional
tryFormatDate: 'true',
descriptiveRow: 'DateTempDewpointHumidityTemp'

This is the entire JSON string if interested, with some personal info redacted.

{
"status": "ok",
"dataStart": -64080,
"devices": [
{
"id": "08801F12AF1789C3",
"name": "REDACTED"
},
{
"id": "C700000C358A8128",
"name": "REDACTED"
}
],
"labels": [
{
"id": null,
"measurement": "Timestamp"
},
{
"id": "08801F12AF1789C3",
"measurement": "Temperature",
"path": "08801F12AF1789C3/entity/0/measurement/0"
},
{
"id": "08801F12AF1789C3",
"measurement": "Humidity",
"path": "08801F12AF1789C3/entity/0/measurement/1"
},
{
"id": "08801F12AF1789C3",
"measurement": "Dewpoint",
"path": "08801F12AF1789C3/entity/0/measurement/2"
},
{
"id": "C700000C358A8128",
"measurement": "Temperature",
"path": "C700000C358A8128/entity/0/measurement/0"
}
],
"data": [
[
"2020-10-30 07:46",
75.79,
35.00,
46.20,
71.92
]
]
}

The "data" object contains a nested array

For example, if you use "devices", it will work, that is because the devices array contains objects

You have to change the data array to be an array of objects
Or we have to look for another solution

And an example of the descriptive row is

descriptiveRow: '<tr><td>Name</td><td>Today</td><td>ThisWeek</td><td>LastWeek</td><td>ThisMonth</td><td>LastMonth</td></tr>'

I'm not sure if this was solved or not, but I cannot get the descriptiveRow to show either. Here is my json:

{ 
    "Daten": [
        {
        "icon":"fa-thermometer-half",
        "value": "56.9",
        "unit": "°C",
        "lastUpdate": "17:10:17"
        },
        {
        "icon":"fa-microchip",
        "value": "14",
        "unit": "%",
        "lastUpdate": "17:10:19"
        },
        {
        "icon":"fa-memory",
        "value": "106.325",
        "unit": "MB",
        "lastUpdate": "17:10:17"
        }
    ]
}

And my MMM-JsonTable config:

{
    module: 'MMM-JsonTable',
    position: 'top_right',
    header: 'Raspi-Status',
    config: {
        url: 'http://192.168.178.99:1880/daten.json', // Required
        arrayName: 'Daten', // Optional
        tryFormatDate: false,
        descriptiveRow: '<tr><td>Messung</td><td>Wert</td><td>Einheit</td><td>Zeitstempel</td></tr>'
    }
},

And the result:
image

any idea @timdows ?

Doesn't look like this is implemented in the code.
I added this piece of code to get it to work:
if (this.config.descriptiveRow) { var header = table.createTHead(); header.innerHTML = this.config.descriptiveRow; }

I'm also having this issue.

      module: 'MMM-JsonTable',
      position: 'top_center',
      header: 'NSW Covid',
      config: {
        url: '<URL removed>',
        arrayName: 'data',
        keepColumns: ['Recovered', 'Deaths', 'NewCases', 'Cases'],
	descriptiveRow: '<tr><td>Recovered</td><td>Deaths</td><td>NewCases</td><td>Cases</td></tr>'
      }
    },```

For anyone still wondering about this, @orbekkum is 100% correct, descriptiveRow was never implemented, meaning it will never work.

I have submitted a Pull Request to resolve this issue ( #19 ).

For those that just want this working, you can replace your MMM-JsonTable.json file with this one: https://github.com/manifestinteractive/MMM-JsonTable/blob/master/MMM-JsonTable.js

CC: @alexsquared, @lsaadeh, @orbekkum, @GCE-Galotta

Thanks @manifestinteractive!

Let me know if anyone has any more feature requests!
But I'll close this for noe!