Read the statement by Michael Teeuw here.
mergeConfig() function
-
@Bugsounet I don’t understand
-
I will code a sample wait ;)
LoOOooL, now this script is not needed :)
now MM v2.12.0 have solve this issue :)
but still in v2.11.xI understand why you say
i don't understandI see this at now, pfff i don’t read ChangeLog lol
-
@Bugsounet also, _loadash lib is previously loaded, and loadash.merge does the deep merge, while Object.Assign does not.
and it only matters for modules with big deep config structures. like GA
-
it’s new because in v2.11.x, I have to use
mergeConfig() -
@Bugsounet lodash.merge loaded before 2.12.
just saying it’s easy, if u need to do this, without another script
-
So I do some another test and not worked without
configMerge()Module name : MMM-Freebox (in dev for new version)
in MMM-Freebox.js:defaults: { updateDelay: 5 * 1000, token: "", activeOnly: false, showIcon: true, showButton: true, showBandWidth: true, showRate: true, showClient: true, showClientRate: true, showClientCnxType: true, showFreePlayer: true, showMissedCall: true, showVPNUsers: true, maxMissed: 3, showIP: true, showPing: true, pingAdress: "google.fr", textWidth: 250, excludeMac: [], sortBy: null, debug: false, verbose: false, dev: false, debitText: "Débit total utilisé : ", player : { showPlayerInfo: false, // depuis le firmware 4.2.3, problemes d'affichage des logos // essayez avec les ips : "192.168.0.254" (l'ip du freebox server) // "mafreebox.free.fr" ou le resultat de l'ip de mafreebox.free.fr // "212.27.38.253" l'ip de mafreebox.free.fr (a voir si cela fonctionne pour vous) ServerIP: "212.27.38.253", UseEPGDayURL: true, EPGDelay: 2* 60 *60 *1000 } },I try to merge config with MMM-Freebox.js :
start: function () { this.config = Object.assign({}, this.defaults, this.config)I send config to node_helper.js with:
notificationReceived: function (notification, payload) { switch(notification) { case "DOM_OBJECTS_CREATED": this.sendSocketNotification("INIT", this.config) break } },module configuration in config.js:
{ module: "MMM-Freebox", disabled: false, header: "INFO Freebox", position: "top_center", config: { token: "xxxx", updateDelay: 5 * 1000, activeOnly: false, sortBy: "type", showButton: true, debug: true, //dev: true, //verbose: true, showVPNUsers: true, textWidth: 250, player: { showPlayerInfo: true } } },result in node_helper.js:
[2020-08-10 16:53:52.705] [LOG] { updateDelay: 5000, token: 'xxxx', activeOnly: false, showIcon: true, showButton: true, showBandWidth: true, showRate: true, showClient: true, showClientRate: true, showClientCnxType: true, showFreePlayer: true, showMissedCall: true, showVPNUsers: true, maxMissed: 3, showIP: true, showPing: true, pingAdress: 'google.fr', textWidth: 250, excludeMac: [], sortBy: 'type', debug: true, verbose: false, dev: false, debitText: 'Débit total utilisé : ', player: { showPlayerInfo: true } }so config is not merged !
now … Let’s try with configMerge() with SAME configuration
just modify :start: function () { this.config = configMerge({}, this.defaults, this.config)result in node_helper.js:
[2020-08-10 17:08:14.984] [LOG] { updateDelay: 5000, token: 'xxxx', activeOnly: false, showIcon: true, showButton: true, showBandWidth: true, showRate: true, showClient: true, showClientRate: true, showClientCnxType: true, showFreePlayer: true, showMissedCall: true, showVPNUsers: true, maxMissed: 3, showIP: true, showPing: true, pingAdress: 'google.fr', textWidth: 250, excludeMac: [], sortBy: 'type', debug: true, verbose: false, dev: false, debitText: 'Débit total utilisé : ', player: { showPlayerInfo: true, ServerIP: '212.27.38.253', UseEPGDayURL: true, EPGDelay: 7200000 } }You can’t see that
player: {}value is now set and merged with default valuein MM core
js/module.js/* setConfig(config) * Set the module config and combine it with the module defaults. * * argument config object - Module config. */ setConfig: function (config) { this.config = Object.assign({}, this.defaults, config); },Can I send you a patch with
configMerge()script for solve this developer issue (It take head !) ? -
@Bugsounet open a PR, describe the problem, and your solution
-
sure, i just open it
-
Ok, so, after one month
- No news on this topic (I have mentionned @MichMich but …)
- I have open an issue, no news
- i have make a PR, euh no news too ??
So i decide I close Issue and PR
it’s not a problem for me… i use my own tools :)In this forum,
There are not many developers left …
So avoid listening to them, you would have even less :)
I don’t know what you are looking for :)For the moment, you have one motivated!
This is not likely to continue for long …@bugsounet for @MichMich
-
Waiting… and Waiting …
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login