amcolash / MMM-json-feed

A MagicMirror module that displays information from any json source
MIT License
17 stars 15 forks source link

'Error Fetching Stats' #10

Closed fiveseven808 closed 6 years ago

fiveseven808 commented 6 years ago

So, I'm aware the project is dead, however I lack the necessary javascript ability to solve my own problem at the moment.

I'll just leave this information here in case someone else has the same issue or can help with solving the issue in a fork .

The JSON data to parse: [{"cid":"PWER","data":[{"1531345190000":345}],"sid":"743125","units":"kWm","age":6}]

I get the following error when displayed: 'Error Fetching Stats'

I'm not sure where to start looking to try and modify it for my situation.

Cheers!

amcolash commented 6 years ago

The project was never "dead", I just never thought it was going to be so popular! Can you post the relevant section of your config.js file? It might be an issue with actually getting the info from its source.

fiveseven808 commented 6 years ago

It is good to hear that this project is not dead! :) Here's what I'm putting in my config.js file:

{
                        module: 'MMM-JsonTable',
                        position: 'bottom_left',
                        header: 'HouseDB Sevensegment',
                        config: {
                                url: 'http://www.energyhive.com/mobile_proxy/getCurrentValuesSummary?token=token-goes-here', // Required
                        }
                },

At this point, I just intend to see what kind of output I can receive from this module. The URL with the proper token outputs data in the format I posted above.

amcolash commented 6 years ago

Just as a sanity check, are you putting in a token into the url? If that is the case, any chance your info is not private and you can pass along a temp key via DM/email so I can look closer into things? No worries if not but it might make things more complicated to debug.

pflodo commented 6 years ago

I am getting the same error, i reduced my config down to match your sample:

{
            module: "MMM-json-feed",
            disabled: false,
            position: "top_left",
            config: {
                    urls: [
                        'http://192.168.2.95:8080/rest/items/SensorFrontdoor_OpenStatus',
                    ]
                }
        },
}

My data is coming from an OpenHAB server - so if I run curl on the Raspberry PI using the URL above I get following (copied from terminal):

pi@raspberrypi:~/MagicMirror/modules/MMM-json-feed $ curl http://192.168.2.95:8080/rest/items/SensorFrontdoor_OpenStatus
{"link":"http://192.168.2.95:8080/rest/items/SensorFrontdoor_OpenStatus","state":"CLOSED","stateDescription":{"readOnly":true,"options":[]},"editable":true,"type":"Contact","name":"SensorFrontdoor_OpenStatus","label":"Open Status","category":"Contact","tags":[],"groupNames":[]} 

Eventually I just want to display the state variable, but at the moment it is having some issue pulling anything.

@fiveseven808 You, like me, have probably played with various JSON modules, as I noticed you sent config for a different module.

amcolash commented 6 years ago

I'm sorry, had a busy month so I have not been able to respond. Unfortunately, none of the posted data sources are public for me to test. If someone has a json file they can upload here I will be able to test it out.

amcolash commented 6 years ago

I am very very sorry. I did not realize that there was an issue with a commit that I made but did not test thoroughly (b43474a) a bit ago. I have fixed the issue and you should be able to test the fix with a simple:

cd MagicMirror/modules/MMM-json-feed
git pull
[restart magic mirror]
amcolash commented 6 years ago

No comments, I am going to close this out.