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

    Posts

    Recent Best Controversial
    • RE: Getting an error when trying to implement MMM-Cursor into my config.js file

      hi @nateb827

      You might’ve just mangled the config.js file a bit is all - perhaps the sample config entry includes some brackets that you didn’t need in your case?

      If you take a look in your config.js file in your text editor -ideally something like Notepad++ if you can but there are many options - you just want an editor that will be more helpful than plain Windows Notepad. Scroll down to the modules: [ section.

      Here’s an example from the top of mine (just an edited chunk, to illustrate …

      modules: [
      		{
      			module: "alert",
      		},
      		{
      			module: "updatenotification",
      			position: "top_bar"
      		},
      		{
      			module: "clock",
      			position: "top_left"
      		}
      ]
      

      So the modules: section as a whole is contained between square brackets [ and ] as you can hopefully see - the opening [ comes immediately after modules: and the closing one ] comes at the end of the list.
      Inbetween those, the modules themselves are specified between curly brackets { and }. Entries for the modules have commas between them. Modules with detailed configuration options have those specified within further pairs of { and } nested inside the entry for the module - MMM-Cursor includes a config {} entry as an example of this.

      To add your new module to the config.js file you just need to make sure you follow this pattern when pasting the entry in.
      I’m assuming you’re adding the entry into the existing modules: section in your config.js, so you don’t need the

      modules: [
      

      or the last ] provided in the Using the module example on the github page, just the entry for the module itself:

      		{
      			module: "MMM-Cursor",
      			config: {
      				// See 'Configuration options' for more information.
      			}			
      		},
      

      It’s easy to drag in unwanted or unpaired brackets when you copy/paste though, and this might break your config. Some text editors will flag unpaired brackets that have made the overall .js file invalid, which can be helpful as you’re making changes.

      Using the example above, I’ve pasted an entry for the MMM-Cursor module in between the entries for the updatenotification and clock modules so you can see what it looks like.

      modules: [
      		{
      			module: "alert",
      		},
      		{
      			module: "updatenotification",
      			position: "top_bar"
      		},
      		{
      			module: "MMM-Cursor",
      			config: {
      				// See 'Configuration options' for more information.
      			}			
      		},
      		{
      			module: "clock",
      			position: "top_left"
      		}
      ]
      

      If you wanted to paste your new entry at the end of the modules: list (after clock in this example) the only difference would be to add a comma at the closing } for the clock module (and remove any trailing comma at the closing } of your new entry) i.e.

      {
      			module: "clock",
      			position: "top_left"
      		},
      		{
      			module: "MMM-Cursor",
      			config: {
      				// See 'Configuration options' for more information.
      			}			
      		}
      ]
      

      Hope this helps, apologies if I’ve gone into too much detail about stuff you already know. If you still don’t have any luck maybe try pasting your whole modules section from your config.js and someone can take a look?

      posted in Troubleshooting
      R
      raymondjspigot
    • RE: Grafana chart will not appear in MM

      Hi - there haven’t been any updates on this lately but I thought I’d add some notes from when I tried out Grafana recently.

      I’ve been using Grafana v8.4.6 installed on Ubuntu (so this might not help if your trouble is related to running it in a Docker container). I wanted to show a grafana-gauge on my Magicmirror. After changing some configuration and making some adjustments to the MMM-GrafanaGauges module I can confirm I’ve got it to show my gauge on the mirror, although I still have a couple of issues with it.

      Anyway, notes on how I got to this point:

      1. Logged into my Ubuntu machine (the Grafana-host) and made some updates to the grafana.ini file (as noted in one of the guides linked above)

      In v8.4.6 the grafana.ini file is at /etc/grafana so in a terminal I could go

      sudo nano /etc/grafana/grafana.ini
      

      in order to edit the file. I needed to allow anonymous viewing of shared dashboards (i.e. without needing to log in as a Grafana user) and allow embedding. I set

      [auth.anonymous]
      enabled = true
      
      [security]
      allow_embedding = true
      

      Note that I think the ; character shows a comment in the .ini file, so I needed to uncomment these entries as well as update them to = true

      I needed to restart the grafana-server for these changes to take effect.

      sudo system-ctl restart grafana-server
      
      1. Logged into Grafana on the grafana-host, and viewed the graph that I wanted to show on my mirror. There’s a Share option, with an Embed tab available. It provides some HTML to use to embed the graph in another page. In my case this looked like
      <iframe src="http://localhost:3000/d-solo/kJ03KuhMk/power-gauge?orgId=1&panelId=5" width="450" height="200" frameborder="0"></iframe>
      

      I’d updated the parameters for the module in my MagicMirror config.js but when I checked the dev console on my MagicMirror I could see that MMM-GrafanaGauges was writing the URL it was trying to use to the log, and it looked like

      <iframe src="http://grafanahost:3000/dashboard-solo/db/power-gauge?orgId=1&panelId=5" ...
      

      The log also included a 404 Not found message just after. So possibly the URL-format has changed since the module was written, or my grafana configuration is different.

      I updated the MMMGrafana-Gauges.js file to build the URL to match the one provided on the Share/Embed page anyway, i.e. using /d-solo/kJ03KuhMk instead of the dashboard-solo/db literal, and now I can see the graph on my mirror.

      Issues I still have with it:

      • When the graph is refreshed, it fades out (which is neat) but then fades back before the graph is ready to be displayed. It shows a bouncing grafana logo followed by some white text (Loading and initializing dashboard, or something) which looks pretty ugly. It would be neater if it would fade back in only once the graph has finished loading.

      • I haven’t been able to get the background-transparency on the graph to work. There is a Transparent background setting when editing graphs in grafana, but the frame still shows up as a dark-grey rectangle around the graph on my mirror, which doesn’t look so good.

      Hope this is helpful to someone anyway

      posted in Utilities
      R
      raymondjspigot
    • RE: Problem with MMM-MyGarbage module

      @rkvant maybe post the contents of the csv you’ve put together? Possibly if there’s just a typo like a comma out of place the module will fail to load it, might be helpful to see the data you’re feeding in : )

      posted in Troubleshooting
      R
      raymondjspigot
    • RE: MMM-WeatherOrNot - Forecast

      Hi @bjoern - so I think this should be possible (although there doesn’t seem to be a way to configure it in the module’s config.js entry just now)

      The MMM-WeatherOrNot readme says that the information it displays is pulled from https://weatherwidget.io/. If you go there and try adjusting the sample widget shown on the site, there’s an option for Current / Forecast, which you can set to Current, Forecast or Both. It looks like it defaults to Both, which I guess is what you’re seeing.

      By trying the different options and clicking on the GET CODE button, I get a code block including either

      data-mode="Forecast"

      data-mode="Current"

      or a block with no data-mode in at all, if I select Both.

      If you look in the MMM-WeatherOrNot.js file you can see at the bottom where this codeblock to pull the correctly-configured information is sort of constructed, based on the values you’ve given in your config.js.

      So it looks like you could theoretically:

      • add a new parameter to your config.js, e.g.
      {
          disabled: false,
          module: 'MMM-WeatherOrNot',
          position: 'middle center',
          config: {
            location: "staten-island",
            dataMode: "Forecast",   // valid options are "Both", "Forecast" or "Current"
      
      • update MMM-WeatherOrNot.js to refer to the parameter - where it shows
      / Insert config options
      		iframe.srcdoc = `&lta class="weatherwidget-io"
      

      you could maybe include data-mode="${this.config.dataMode}"

      Something like that anyway. And then it might allow you to control whether the Current weather is shown or just the Forecast using the config.

      posted in System
      R
      raymondjspigot
    • RE: Correct json syntax (MMM-Json-Table)

      hi @grinly no worries : )

      I agree, I think MMM-JsonTable doesn’t like the structure of the json message you’re getting back - it’s expecting to see information laid out in an array and isn’t set up to parse a different message structure.

      Your investigations into Node-RED sound interesting - it’s not something I’ve tried but just from a quick look you might well be able to get it to act as an intermediary between your inverter and MagicMirror. If you’ve managed to get Node-RED to call the inverter endpoint for the energy data then that’s a good start. You’re right, if you go this route I think you’ll still have to clean up/reformat the message for consumption by MMM-JsonTable. But the Node-RED documentation might help - it does look like there are ways to get data back to the module too - you could perhaps get MMM-JsonTable to call a Node-RED endpoint instead of the inverter directly, and Node-RED could serve “cleaned-up” json back to MM?

      https://cookbook.nodered.org/http/serve-json-content

      Another option might be to see if there’s an alternative MagicMirror module that can handle (or be configured to handle) a wider range of json (or XML) messages? Though you might have to get hands-on with a module to adjust it exactly the way you wanted. If your json message always follows the same format it shouldn’t be too hard to extract the values you’re interested in - I think there are some fairly straightforward modules that would give you an outline of how to request and parse json (e.g. MMM-stocks maybe?). If you wanted the output shown in a table you could take a look inside MMM-JsonTable and see how it’s done there too. Just scrolling the 3rd-party modules list there’s also MMM-Tabulator? I’ve not used this one either but it mentions displaying data from XML or json sources, so it might be worth a try.

      posted in Troubleshooting
      R
      raymondjspigot
    • RE: Correct json syntax (MMM-Json-Table)

      hi @grinly that’s good progress persuading it to respond with a json message anyway. It looks like what you’re getting is now more like

      {
      "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"
        }
      }
      

      which does look much more json-ish. Unfortunately your inverter’s not providing the power and energy data in an array[] format. In json an array would look more like the Example 1 message - it would be essentially a named list (called items in the example) and show a set of readings, each providing the same kind of datapoints, and contained in the message between [ and ]. I’m guessing that the error you’re seeing is because you’ve provided

      arrayName: "overview"

      in your config.js, so the module’s looking in the json for an array with that name, and there isn’t one (there’s a json element overview, but it’s not an array.)

      I haven’t tried using the MMM-JsonTable module so I don’t know for sure - do you get anything displayed by the module if you request the inverter data in json format again but then leave the arrayName blank in your config.js (or comment-out the arrayName entry)?

      posted in Troubleshooting
      R
      raymondjspigot
    • RE: Correct json syntax (MMM-Json-Table)

      Hi @grinly - so (apologies - just to make sure what you’re looking for …)

      From your screenshot it looks like you’re receiving an XML message back from your inverter (hopefully this comes out ok - something like -

      &ltoverview>
        &ltlastUpdateTime>2020-09-25 17:06:53&lt/lastUpdateTime>
        &ltlifeTimeData>
          &ltenergy>1109407.0&lt/energy>
          &ltrevenue>236.23314&lt/revenue>
        &lt/lifeTimeData>
        &ltlastYearData>
          &ltenergy>1073747.0&lt/energy>
        &lt/lastYearData>
      etc.
      

      Whereas I think the MMM-JsonTable module is looking for a json response to parse. Are you wanting to transform the XML message you have into json first, so that MMM-JsonTable can work with it? The raw json message in Example 1 on https://github.com/timdows/MMM-JsonTable shows a simple structure you could aim for, e.g.

      {
          "items": [
              {
                  "name": "Lifetime Energy",
                  "value": "1109407"
              },
              {
                  "name": "Lifetime Revenue",
                  "value": "236.23314"
              },
              {
                  "name": "Energy Last Year",
                  "value": "1073747"
              },
              {
                  "name": "Last item in my example array for now",
                  "value": "3 or something"
              }
          ]
      }
      
      

      which gives MMM-JsonTable an array named “items” (hence arrayName : ‘items’ in the config.js for the module - so you can change the array name as long as the config entry changes to match) and each entry in the items array has 2 datalabel:datavalue pairs in. You can see the syntax - the array entries go between [ and ], and each entry gets its own { and } with a trailing comma between them.

      Does this help any? Hopefully I haven’t misunderstood what you’re trying to achieve :)

      posted in Troubleshooting
      R
      raymondjspigot
    • RE: Can someone help me understand "updateInterval"? DarkSky is charging me a lot of money.
      updateInterval: 15 * 60 * 1000, //every 15 minutes or whatever you choose
      

      that’s the original ^ and I updated the 15 to 60.

      I guess I don’t understand what each number represents. Milliseconds, Seconds, Minutes? >

      Hi @cotxwx - I think the updateInterval in the original is currently set to 15 minutes. The time will be based in milliseconds, so reading it right-to-left that gives you

      1000 (milliseconds per second) x 60 (seconds per minute) x 15 = a 15 minute interval

      which I think ends up being clearer than just giving a sort of anonymous/unit-free total (e.g. 900000 or something like that)

      hope this helps anyway

      posted in Troubleshooting
      R
      raymondjspigot
    • RE: Using MMM-BackgroundSlideshow with MMM-MagicMover

      Hi @C-son thanks very much for your update! I’ve updated my installation of the module and given it another try, and it’s definitely better:

      • my mirror now shows the picture from MMM-BackgroundSlideshow ok (instead of just the black background with no picture under my other modules that I was getting before when MMM-MagicMover was enabled)

      • watching carefully I can see my displayed modules (e.g. default Clock, weather modules) getting shifted slightly in the mirror display every now and again

      • but my module at position: bottom_centernow gets displayed shifted to the right of the mirror. I have MMM-WeatherOrNot displayed at this position, configured to show a 7-day forecast as a horizontal row of icons, and the last 3 or so icons (perhaps 40% of the whole row) is shifted off the right hand side of the screen (if that helps give you an idea of how much it’s been moved across).

      I do have a module configured to display above that (at position: lower_third) and below that too (at position: bottom_bar) and they both appear displayed on the mirror normally (i.e. centred like I’d expect)

      I still have MMM-MagicMover configured at position: top_bar, just in case that makes a difference.
      Let me know if there’s any more info I can help with anyway, happy to try it out.

      posted in Troubleshooting
      R
      raymondjspigot
    • RE: Config file missing but no syntax errors?

      Hi @Wenike in your MMM-Carousel config it looks like you have

      mode: global,

      which might need to be quoted? i.e.

      mode: 'global',

      posted in Troubleshooting
      R
      raymondjspigot
    • 1
    • 2
    • 3
    • 2 / 3