MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. grinly
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    G
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Groups 0

    grinly

    @grinly

    0
    Reputation
    5
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    grinly Unfollow Follow

    Latest posts made by grinly

    • RE: Correct json syntax (MMM-Json-Table)

      @raymondjspigot Thanks once again for your reply. Even with arrayName: "overview" commented out it returns the same error on screen.

      From other research, I think that half of my problem is that the url returns “nested” data, which MMM-JsonTable doesn’t like. I did look to work around the problem another way, by getting Node-RED to send the API url, and then “clean up” the message in to the bits I wanted; whilst I could do that, I then ran in to the problem of how to get this back in to MMM-JsonTable :anguished_face:

      Ho Hum, the delights of programming! (But I won’t give up just yet …)

      posted in Troubleshooting
      G
      grinly
    • RE: Correct json syntax (MMM-Json-Table)

      OK, I have some progress, in that a very slightly amended url now returns data in json format (I think!). Here is an example of what comes back …

      {"overview":{"lastUpdateTime":"2020-09-30 10:35:31","lifeTimeData":{"energy":1162278.0,"revenue":247.86499},"lastYearData":{"energy":1126618.0},"lastMonthData":{"energy":450237.0},"lastDayData":{"energy":1600.0},"currentPower":{"power":1234.6772},"measuredBy":"INVERTER"}}
      

      I have altered my MMM config to be

      {
      			module: 'MMM-JsonTable',
      			position: 'top_right',
      			header: 'Solar Panels',
      			config: {
      				url: 'https://monitoringapi.solaredge.com/%20site/REDACTED/overview.json?api_key=REDACTED',
      				arrayName: "overview",
      				updateInterval:  '60000',		
      			}
      		},
      

      But whilst the config.js “runs”, it returns an error on the mirror screen saying “Json data is not of type array! Maybe the config arrayName is not used and should be, or is configured wrong”.

      Is there anything obvious that I have done wrong?

      TIA

      posted in Troubleshooting
      G
      grinly
    • RE: Correct json syntax (MMM-Json-Table)

      @raymondjspigot said in Correct json syntax (MMM-Json-Table):

      https://github.com/timdows/MMM-JsonTable

      Hi @raymondjspigot - thank you so much for your reply. Very helpful.

      You are right re: your first code “window” formatting - that is almost exactly what I see. I now also realise that it is in XML format, rather than json (but I hadn’t when I posted my OP). And you are correct that I need to change the XML in to json.

      This is all at the edge of my knowledge, but how might I “translate” the XML in to json? By using Node-RED perhaps? I already use NR for another project, but if so, I am not sure how I would then send on the re-formatted message back in to MMM-Json-Table, as does the latter not expect to receive the information from a webpage, rather than from a programme (such ass NR)?

      That last bit might not even be a sensible question, but I’ll ask it anyway :face_with_stuck-out_tongue_winking_eye:

      posted in Troubleshooting
      G
      grinly
    • Correct json syntax (MMM-Json-Table)

      A url with my details in returns the following data about my solar panels;

      <overview>
      <lastUpdateTime>2020-09-25 17:06:53</lastUpdateTime>
      <lifeTimeData>
      <energy>1109407.0</energy>
      <revenue>236.23314</revenue>
      </lifeTimeData>
      <lastYearData>
      <energy>1073747.0</energy>
      </lastYearData>
      <lastMonthData>
      <energy>397366.0</energy>
      </lastMonthData>
      <lastDayData>
      <energy>10979.0</energy>
      </lastDayData>
      <currentPower>
      <power>278.9876</power>
      </currentPower>
      <measuredBy>INVERTER</measuredBy>
      </overview>
      

      If that doesn’t display well on this forum, I have also put a screen grab on DropBox https://www.dropbox.com/s/x2larxqazl4vau7/Screenshot 2020-09-25 at 17.38.02.png?dl=0

      The module https://github.com/timdows/MMM-JsonTable shows an example of the config as follows:

      {
      	module: 'MMM-JsonTable',
      	position: 'top_right',
      	header: 'HouseDB Sevensegment',
      	config: {
      		url: 'https://xyz/abc/get.json', // Required
      		arrayName: 'items' // Optional
      	}
      }
      

      I would be most grateful if someone could help me sort out the correct syntax to use within the module? Just one dataset would be fine, and then I can work from there…

      TIA

      posted in Troubleshooting
      G
      grinly