• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Wanting to do it the right way (revisited)

Scheduled Pinned Locked Moved Troubleshooting
3 Posts 2 Posters 1.7k Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    Mykle1 Project Sponsor Module Developer
    last edited by Feb 7, 2017, 1:27 AM

    Hi,
    Now that I have my MM built and operational (you can see it in the “Show your mirror” forum - and please comment) I want to perfect the way I’ve done my editing. I’ll explain:

    For example, a portion of my config.js file reads as follows:
    {
    module: ‘weatherforecast’,
    position: ‘top_right’,
    header: ‘Weather Forecast’,
    config: {
    location: ‘New York’,
    locationID: ‘5128581’, //ID from http://www.openweathermap.org
    appid: ‘This is where my API key goes’
    }
    },

    And a portion of my weatherforecast.js file reads:

    // Default module config.
    defaults: {
    location: false,
    locationID: 5128581,
    appid: “Im an idiot for posting my API key last time”,
    units: config.units,
    maxNumberOfDays: 10,
    showRainAmount: false,
    updateInterval: 10 * 60 * 1000, // every 10 minutes
    animationSpeed: 1000,
    timeFormat: config.timeFormat,
    lang: config.language,
    fade: true,
    fadePoint: 0.25, // Start on 1/4th of the list.

    initialLoadDelay: 2500, // 2.5 seconds delay. This delay is used to keep the OpenWeather API happy.
    retryDelay: 2500,
    
    apiVersion: "2.5",
    apiBase: "http://api.openweathermap.org/data/",
    forecastEndpoint: "forecast/daily",
    
    appendLocationNameToHeader: true,
    calendarClass: "calendar",
    
    roundTemp: true,
    

    },
    My question is this: Was I supposed to bring the settings in the weatherforecast.js file into the config.js file? Everything works fine but what is the right way of doing it? It would be easier to edit them if they were combined into the config.js file instead of bouncing back and forth between .js files. Or, are they supposed to remain separate?

    Create a working config
    How to add modules

    S 1 Reply Last reply Feb 7, 2017, 1:31 AM Reply Quote 0
    • S Offline
      strawberry 3.141 Project Sponsor Module Developer @Mykle1
      last edited by Feb 7, 2017, 1:31 AM

      @Mykle1 dont make changes in the module files

      only add the part to the config that you want to be different than the defaults

      Please create a github issue if you need help, so I can keep track

      M 1 Reply Last reply Feb 7, 2017, 1:33 AM Reply Quote 0
      • M Offline
        Mykle1 Project Sponsor Module Developer @strawberry 3.141
        last edited by Feb 7, 2017, 1:33 AM

        @strawberry-3.141 said in Wanting to do it the right way (revisited):

        @Mykle1 dont make changes in the module files

        only add the part to the config that you want to be different than the defaults

        That’s what I wanted to know, thanks.

        Create a working config
        How to add modules

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          3/3
          Last post
        Enjoying MagicMirror? Please consider a donation!
        MagicMirror created by Michael Teeuw.
        Forum managed by Sam, technical setup by Karsten.
        This forum is using NodeBB as its core | Contributors
        Contact | Privacy Policy