Git Product home page Git Product logo

mmm-jsontable's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mmm-jsontable's Issues

Awaiting json data

Hey, love this module, but couldn't get it to work.

My origin: https://api.myjson.com/bins/z68sj
My config:

config: {
    url: 'https://api.myjson.com/bins/z68sj'
}

But getting Awaiting json data on the screen..

Colors

Hi,

First, thank you for creating this module, as a hobby programmer it made it very easy to implement my project into the MM without knowing anything about js.

I saw how enthusiastically you implemented the Font Awesome idea and I was hoping maybe you could help out with some basic colors.

I made a table to display Air quality information from a co2 sensor and i'd like to color code it so that if the CO2 levels are high the row is then displayed in yellow and red (depending on the levels). the other rows that display temperature and humidity should ideally stay white.

would it be possible to had a simple "color"-key to the json so that it is then changed in the table... "color":"yellow"

If not is there any other way i could implement this?

thank you

Get Json from Google "awating" issue

Hello, I'm trying to retrieve my sheet from google spreadsheets , but module says "awaiting"

The data in "entry/feed/gsx.." category, I'm not sure what is wrong with my code, but needs your touches.

I also need create loop for bringing with prefix "gsx " values.

URL

https://spreadsheets.google.com/feeds/list/1dVwsdP3K49XGTaixhTTzuybEz4nFubtQzB_Qa32c4ZM/od6/public/values?alt=json

{ module: 'MMM-JsonTable', position: 'top_left', header: 'Majken', config: { url: 'https://spreadsheets.google.com/feeds/list/1dVwsdP3K49XGTaixhTTzuybEz4nFubtQzB_Qa32c4ZM/od6/public/values?alt=json', // Required arrayName: 'object/feed/entry' // Optional } },

image

Unexpected token '�', "��{ | "... is not valid JSON

Allthough I follow the exact examples in the readme file, I receive this error:

0|mm | [10.08.2023 12:51.58.234] [ERROR] (node:7568) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token '�', "��{
0|mm | "... is not valid JSON
0|mm | at JSON.parse ()
0|mm | at Response.json (file:///home/pi/MagicMirror/modules/MMM-JsonTable/node_modules/node-fetch/src/body.js:149:15)
0|mm | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
0|mm | (Use electron --trace-warnings ... to show where the warning was created)
0|mm | [10.08.2023 12:51.58.235] [ERROR] (node:7568) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

The issue is in the URL format: 'https://server.vdplas.net:8083/thuis.json' . Because when entering 'https://jsonplaceholder.typicode.com/users' it works perfectly, the table is shown, but when entering the former URL, even when there is the exact same file located, it does not work.

What is wrong in the format? Is it the : ?

JSON syntax error

Hi @timdows ,
I've tried to solve this for two days by now but with no luck.

Hope you can help since I can't really see where the problem with position 5 is.

From console log I have this error:

[2020-09-23 16:08:12.958] [LOG]    http://192.168.1.50/home/pi/MagicMirror/modules/MMM-JsonTable/prova.json
[2020-09-23 16:08:12.967] [ERROR]  Whoops! There was an uncaught exception...
[2020-09-23 16:08:12.968] [ERROR]  SyntaxError: Unexpected token < in JSON at position 5
    at JSON.parse (<anonymous>:null:null)
    at Request._callback (/home/pi/MagicMirror/modules/MMM-JsonTable/node_helper.js:14:21)
    at Request.self.callback (/home/pi/MagicMirror/node_modules/request/request.js:185:22)
    at Request.emit (events.js:200:13)
    at Request.<anonymous> (/home/pi/MagicMirror/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:200:13)
    at IncomingMessage.<anonymous> (/home/pi/MagicMirror/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:288:20)
    at IncomingMessage.emit (events.js:205:15)
    at endReadableNT (_stream_readable.js:1154:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:9)

[2020-09-23 16:08:12.971] [ERROR]  MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[2020-09-23 16:08:12.972] [ERROR]  If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues

This is the config array:

		{
			module: 'MMM-JsonTable',
			position: 'top_right',
			header: 'Dati ultima corsa',
			config: {
					url: 'http://192.168.1.50/home/pi/MagicMirror/modules/MMM-JsonTable/prova.json',
					arrayName: "items",
					tryFormatDate: true
					}

While this is the JSON content (UTF encoded, no BOM characters):

{
	"items": [
		{
			"name":"Data",
			"value":"20/9/20"
		},
		{
			"name":"Distanza",
			"value":"10 Km"
		},
		{
			"name":"Durata",
			"value":"0:52:30"
		},
		{
			"name":"Passo",
			"value":"0:5:15"
		},
		{
			"name":"VDOT",
			"value":"38"
		}
		]
}

Thank you in advance for your precious support.

Flavio

Does this work with MM 2.18

Can you make this work with MagicMirror 2.18 when I try to use it I get a black screen.
Removing it makes my MM work again.

Descriptive Row not showing.

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'

right-justified?

I would like to right-justify my numbers. Can anyone give me a clue, how to do it. It´s always is left-justified.
1

Local json

How can I use the module without node_helper only for local file?

The table looks bad on my mirror, better on the computer.

On my computer the table looks good, with even spacing.
But on my actual mirror, raspberry with its web browser the spacing is off. It is lined up but there is no spacing.
I guess I could solve it with descriptiveRow and even make it invisible but that would add on the height.
Any ideas? Maybe an option to make the width fixed?

Firefox on Windows
2022-09-25

MagicMirror
IMG_20220925_093146

json

{
  "domoticz": [
    {
      "name": "Temp ute / uppe / nere",
      "value1": " ",
      "value2": "8.0 C",
      "value3": "23.2 C",
      "value4": "Error"
    },
    {
      "name": "Sval / Varm/ Sol / Luftf.",
      "value1": "22.9 C",
      "value2": "26.2 C",
      "value3": "27.2 C",
      "value4": "60%"
    },
    {
      "name": "Majken får mat",
      "value1": " ",
      "value2": " ",
      "value3": "om",
      "value4": "7 dagar"
    },
    {
      "name": "Lilla garagedörren",
      "value1": " ",
      "value2": " ",
      "value3": " ",
      "value4": "Låst"
    },
    {
      "name": "FTX / Garage / VVB",
      "value1": " ",
      "value2": "100 W",
      "value3": "14 W",
      "value4": "293 W"
    },
    {
      "name": "Server / Terrarium",
      "value1": " ",
      "value2": " ",
      "value3": "73 W",
      "value4": "148 W"
    },
    {
      "name": "Förbrukning idag",
      "value1": " ",
      "value2": " ",
      "value3": "10.6 kWh",
      "value4": "19.6 kr"
    }
  ]
}

jsontable.php

$sendback0 = array( 'name' => 'Temp ute / uppe / nere', 'value1' => ' ', 'value2' => $tempute, 'value3' => $tempuppe, 'value4' => $tempnere );
$sendback1 = array( 'name' => 'Sval / Varm/ Sol / Luftf.', 'value1' => $tempsvalzon, 'value2' => $tempvarmzon, 'value3' => $tempsolplats, 'value4' => $luftfuktighet );
$sendback2 = array( 'name' => $majkenheader, 'value1' => ' ', 'value2' => ' ', 'value3' => $majkenheader2, 'value4' => $daystogo );
$sendback3 = array( 'name' => 'Lilla garagedörren', 'value1' => ' ', 'value2' => ' ', 'value3' => ' ', 'value4' => $string_door );
$sendback4 = array( 'name' => 'FTX / Garage / VVB', 'value1' => ' ', 'value2' => WattORkiloWatt($ftxPower), 'value3' => WattORkiloWatt($lvpGaragePower), 'value4' => WattORkiloWatt($NibePower) );
$sendback5 = array( 'name' => 'Server / Terrarium', 'value1' => ' ', 'value2' => ' ', 'value3' => WattORkiloWatt($serverPower), 'value4' => WattORkiloWatt($terrariumPower) );
$sendback6 = array( 'name' => 'Förbrukning idag', 'value1' => ' ', 'value2' => ' ', 'value3' => $forbrukning . ' kWh', 'value4' => $elkostnad . ' kr' );

$sendback['domoticz'] = array( $sendback0, $sendback1, $sendback2, $sendback3, $sendback4, $sendback5, $sendback6 );

header('Content-type:application/json;charset=utf-8');
echo json_encode( $sendback, JSON_PRETTY_PRINT ) ;

config.js

{
        module: 'MMM-JsonTable',
        position: 'top_right',
        //header: 'Majken',
        config: {
                url: 'http://192.168.44.15/jsontable.php', // Required
                arrayName: 'domoticz', // Optional
		updateInterval: 60000, //Milliseconds between the refersh 
		//keepColumns: ["name", "value1", "value2", "value3", "value4"],
        }
},

Json type is not an array error

I apologize is this is an obvious issue, I am sort of a coding rookie. I am running an icecast server and I wanted to leverage your module to show currently playing tracks on my magic mirror. I dont feel the icecast server provides the best formatted json hence not correctly identifying an array parameter. I was curious if you could point me in the right direction to get your Module to display the currently playing track. it is the title: nested in the Json response. Thanks you for your wonderful module.

Here is the json output.
{
"icestats": {
"admin": "[email protected]",
"host": "radio.phreakn.tel",
"location": "Earth",
"server_id": "Icecast 2.4.4",
"server_start": "Mon, 21 Dec 2020 02:41:56 -0500",
"server_start_iso8601": "2020-12-21T02:41:56-0500",
"source": {
"genre": "Science and Technology",
"listener_peak": 4,
"listeners": 0,
"listenurl": "http://radio.station.com:8000/stream",
"server_description": "Defcon talks and live performaces",
"server_name": "WirelessPhreak Radio",
"server_type": "audio/mpeg",
"server_url": "https://www.wirelessphreak.com",
"stream_start": "Thu, 24 Dec 2020 19:40:44 -0500",
"stream_start_iso8601": "2020-12-24T19:40:44-0500",
"title": "DEF_CON_Safe_Mode_-_Shadowvex",
"dummy": null
}
}
}

Numerical values displayed as "object"

From the JSON data:
[{"cid":"PWER","data":[{"1531345190000":345}],"sid":"743125","units":"kWm","age":6}]

I see the following displayed:
PWER | [object Object] | 743125 | kWm | 6

Which is to say, way better than any of the other JSON modules (which don't seem to be able to parse my source at all)

I'm not very well versed in javascript and I was wondering if you could help me get that number "345" and make it possible to display?

That's my main goal. Having a weird format, and including a bunch of stuff I don't need is completely fine. I just want that number.

Thank you for making this!

fetching data from array withing an array

Hey @timdows thank you for this great module!

Maybe i am doing something wrong? i am trying to get the data from "mres" and "Forbruk" to be displayed on two different modules.
The config i've been trying to use is under arrayName:

  • $.data.[mres]
  • mres
  • $.[mres]
  • $.*.[mres]

tried same for "Forbruk"

am i missing something?

{"status":"success","url":"/soppel","method":"GET","data":[{"Forbrok":[{"deviceName":"Power consumption","currentValue":"Now: 3009 watts","currentTarget":" ","lastUpdate":"Limit: 5000 watt"},{"deviceName":"Varmepumpe","currentValue":"Now:25.8°C,","currentTarget":"Target:21°C,","lastUpdate":"Home override: true"},{"deviceName":"Hotwater","currentValue":"Now:44.38°C,","currentTarget":"Last heat complete","lastUpdate":"66.9 : 05:46 @ 19-12-2022 "},{"deviceName":"Last update","currentValue":" ","currentTarget":" ","lastUpdate":"23:27 19-12-2022"}]},{"mren":[{"avfallstype":"Restavfall","dato":"30-12-2022"},{"avfallstype":"Matavfall","dato":"30-12-2022"},{"avfallstype":"Papiravfall","dato":"30-12-2022"},{"avfallstype":"Plastemballasje","dato":"30-12-2022"},{"avfallstype":"Glass- og metallemballasje","dato":"30-12-2022"}]}]}

HELP- MM on a Windows 8 PC

Just now learning to code.
I can get the table to show on the display but it is showing as waiting on Json data.

I am using a local hosted file. To test it, i put the Raw Json data in a JSON file but still no luck.

Is there a way to check to see if the file is being reached or any trouble shooting ideas you can give would be great.

How to change moduleName

Hi again

I want to change that module name, here are my steps, but it doesnt work.

  1. Changed config array module
    `{
    module: 'MMM-JsonTable-2',
    position: 'bottom_left',
    header: 'Test Result',
    config: {
    url: 'https://spreadsheets.google.com/feeds/list/1dVwsdP3K49XGTaixhTTzuybEz4nFubtQzB_Qa32c4ZM/2/public/values?alt=json',
    arrayName: 'entry'

     }
    

2- changed /module directory name to `MMM-JsonTable-2
3- Change Js name to "MMM-JsonTable-2.js"
4- Inside the Js, changed register module name to "MMM-JsonTable-2"

Module.register("MMM-JsonTable-2", {

I 'didn't touch node_helper.js

when I run the code , it doesnot work. (show loading)

Please help me on it

Font Awesome Icons and images support

Hello! I'm trying out your module to display some statistics from my coffee machine.
I would like to be able to use small "icons". I'm thinking if I define in the json for example the fa-icons, se below... And also if possible, if an image is inserted that could be displayed as well...

Here is an example of my json...

{  
   "cups":[  
      {  
         "icon":"fa-calendar",
         "data":"Senaste bryggning",
         "value":"2019-03-07",
         "type":""
      },
      {  
         "icon":"fa-clock-o",
         "data":"Klockan",
         "value":"17:32:06",
         "type":""
      },
      {  
         "icon":"fa-coffee",
         "data":"Totalt antal bryggda koppar",
         "value":60,
         "type":"st"
      },
      {  
         "icon":"img=http://10.0.0.30/img/magicmirror/buttons/coffeebeans-512x512.png",
         "data":"Kostnad b\u00f6nor (alla koppar)",
         "value":319.2,
         "type":"kr"
      },
      {  
         "icon":"fa-cog",
         "data":"Kostnad b\u00f6nor \/ kopp",
         "value":5.32,
         "type":"kr"
      },
      {  
         "icon":"fa-cogs",
         "data":"Kostnad maskin \/ kopp",
         "value":408.17,
         "type":"kr"
      },
      {  
         "icon":"fa-diamond",
         "data":"Kostnad totalt \/ kopp",
         "value":413.49,
         "type":"kr"
      }
   ]
}

In this example I would like to get the "icons" from font awesome displayed instead of the text, and when the img= is present, the picture should be displayed instead.
Result in this case would be:
image

I hope you get what I mean. :)

Best regards Erik

nested arrays?

Hi,

would it be possible to extend the module with the feature of handling nested arrays?
actually after parsing i get a (object Object) even if i point to the right key :/

thank you!

Blinking when update

Very nice module thanks.

I don't know if this is only for your module, since I don't use many other modules with update every 10 second, like I have with your module.

Is it possible to disable the blink?

Wrong format / columns are stretched ?

What am I doing wrong here?
My table is way more stretched than your examples.

{
    module: 'MMM-JsonTable',
    position: 'top_left',
    header: 'Majken',
    config: {
        url: 'http://192.168.xx.xx/echo.php', // Required
        arrayName: 'domoticz' // Optional
    }
},
{
    "domoticz": [
        {
            "name": "Sval sida",
            "value": "0.0 C, 0 %"
        },
        {
            "name": "Solplats",
            "value": "23.2 C"
        },
        {
            "name": "L\u00e5g v\u00e4nster",
            "value": "21.6 C"
        },
        {
            "name": "H\u00f6g mitten",
            "value": "21.9 C"
        },
        {
            "name": "L\u00e5g h\u00f6ger",
            "value": "21.6 C"
        },
        {
            "name": "Dvalbox",
            "value": "13.1 C"
        },
        {
            "name": "Temperatur ute",
            "value": "4.9 C"
        },
        {
            "name": "Temperatur inne",
            "value": "20.8 C"
        },
        {
            "name": "Varmvatten",
            "value": "45.2 C"
        }
    ]
}

2020-01-10-164510_864x1152_scrot

How to load local JSON file

Hi, Is there any way to load a local JSON file?

I am currently running a python3 script to create a .json file in the MMM-JsonTable directory in valid JSON, but it does not seem to load the file, it just says "Awaiting JSON"? I have tried loading a file from an online URL and it loaded fine? Is it just not supported to load a local file?

Cheers in advance!

load a local Json File

Someone already had that problem with the local JSON File, but I cannot fix it for me. It always says Awaiting for json data...
The file is located in the folder MMM-JsonTable as a test.json- file and url in the config.js is 'file:///home/pi/MagicMirror/modules/MMM-JsonTable/test.json'. Does anyobdy have a solution?

My test.json-file looks by the way

{ "items": [ { "name": "Watt", "value": "234.6" }, { "name": "Test", "value": "3 kwH" } ] }

What format is the data expected to be in?

This is what I've got but it says "awaiting json data..."

[
   {
      "councilReference":"CC-###/##/#",
      "dateReceived":"2021-06-16",
      "address":"some address",
      "description":"some length description.",
      "authority":"Council"
   },
   {
      "councilReference":"SC-####/##",
      "dateReceived":"2021-06-16",
      "address":"some address",
      "description":"some length description.",
      "authority":"Council"
   }
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.