Wanting to do it the right way (revisited)


  • Module Developer

    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?



  • @Mykle1 dont make changes in the module files

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


  • Module Developer

    @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.


Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.