@ray_mtl there is an issue open. looks like envcanada has changed their api significantly
Read the statement by Michael Teeuw here.
Posts
-
RE: MMM-EnvCanada stopped working ...
-
RE: CSS Order of execution
@buzzkc that is why u prefix any names with your module name to restrict your settings to your module
-
RE: Question about backup script
@nowayto restore, option 2 . restore will reinstall all the modules and copy any created files saved with them
(What’s the point of having a restore tool if it doesn’t?)
And restore will copy the GitHub repo down for you (part 1 of your option 2)now, on the github
its the same as ‘copy the MM_backup folder someplace’
backup also creates versions
backup today and next week, and restore either one
or one from last yeargithub is free
make a private repo -
RE: CSS Order of execution
@buzzkc great thanks… I always thought that custom.css was a bad idea… every module should supply their own file as the getStyles() function provides the mechanism.
-
new Raspi OS release
there has been an updated version of raspi os released this week
there appear to be a bunch of changes to screen mgmt
https://www.raspberrypi.com/news/a-new-raspberry-pi-os-release/
-
RE: Creating Module with API Key/Secret
@lilpkstud said in Creating Module with API Key/Secret:
JSON.stringify()
correct… u converted the object to a string… don’t need to do that
just pass the object from helper up to module …
then it will use the this.data.name
-
RE: Are you tired of editing config.js, or have trouble doing it, see my new module
I have updated the module now to support multiple instances of the same module,
a little config (adding name to a file) … altho the module will auto detect if multiples are being used NOW, regardless of the fileALSO, one lacking feature of this solution is being able to get the form exactly right… as the info is missing in the module data…
BUT i am creating the form info ANYHOW, so it can be saved and manually edited to improve the module experience, and I will use THAT instead of constructing the info every time…
this means u can add selection lists, and other features (very easily)
see the two issues for instructionsmulti-module
https://github.com/sdetweil/MMM-Config/issues/2and save and use schema file
https://github.com/sdetweil/MMM-Config/issues/11 -
RE: Head first developing MM module for extreme beginners
@nrayever see my sample module,
https://github.com/sdetweil/SampleModuleand follow the module developers doc
-
RE: MMM-cryptocoin
thanks guys.
send me text messages if u think I’ve missed some other troublesome users
-
RE: Help with creating a table
@Schmaniel welcome to the fun. 900,000 details to consider. size color, font … css
-
RE: MMM-HomeAssistant-Sensors (Development) - Show your HA Sensors on your Mirror
@Ivanov_d OR the better way, never change files supplied by mm or a module(as this breaks upgrades or fix distribution). the system is designed to support your local changes
edit ~/MagicMirror/css/custom.css
(if it doesn’t exist, create it)add all those definitions but add the module name (and a space) in front of each
.MMM-HomeAssistant-Sensors
notice the leading dot
-
RE: Read dates from file and do a compare
@bravooscar
in node_helper.jsvar NodeHelper = require("node_helper"); const fs = require('fs') const path = require('path') // add require of other javascripot components here // var xxx = require('yyy') here module.exports = NodeHelper.create({ // handle messages from our module// each notification indicates a different messages // payload is a data structure that is different per message.. up to you to design this socketNotificationReceived(notification, payload) { console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload); // if config message from module if (notification === "CONFIG") { // save payload config info this.config=payload let p = path.resolve('.','modules',this.name,this.config.filename) console.log("file="+p) fs.readFile(p, (error,filedata)=> { console.log("filedata="+filedata) let data =JSON.parse(filedata) this.sendSocketNotification('filedata', data) }) } }, }); -
RE: MMM-CalendarExt3
@bicolorbore586 no config option, just set cw to display:none in custom.css
-
RE: Head first developing MM module for extreme beginners
@Schmaniel ctrl-r to reload the screen
-
RE: MMM-ModulesGroupsRotation - simple alternative to MMM-pages
@plainbroke I’ve updated my fork of MMM-pages with the same function .
https://github.com/sdetweil/MMM-pagesonly they are called pages instead of slides
pageTimeout: [ {pageNumber:x, timeout:nnnnn},....] -
RE: Help developing first module, displaying webscraped text.
@enderflop cool
key here is module name = foldername = filename = register name
and node_helper.js has to be in the same folder -
RE: MMM-Chores - Manage and keep track of your household Chores
@ewingfox please always code block for code, config and logs
paste the text into the message editor window, blank line above and below
select the text just pasted
hit the </> button on the message editor toolbarI fixed prior
-
RE: Config option with array of multiple values?
@UncleRoger said in Config option with array of multiple values?:
great conversation topic
validSenders: [ { "mom@example.com", "Mom", "#ff0000" }, { "dad@example.com", "Dad", "#00ff00" }, { "son@example.com", "Son", "#0000ff" }, ]generally when you expand the number of items in an array to objects ({}) you start to get thinking about what happens if you decide to add another entry in the object…
so in javascript you can NAME the elements
validSenders: [ { name:"Mom", color:"#ff0000",url:"mom@example.com", }, { url"dad@example.com", name:"Dad", color:"#00ff00" }, { name:"Son", url:"son@example.com",color:"#0000ff" }, ]that way the code is not sensitive to the order of the elements
validSenders.forEach(sender =>{ if (sender.name =="Dad") { do_something(sender.url) } })you can also use the array.filter() function
let selected_sender = validSenders.filter(sender=>{ if(sender.url==mailObj.sender[0].address) return true else return false }) if(selected_sender.length>0){ // we found a matching sender }the filter function passes each element array in turn to the function
if you want the element in the output array return true,
if not return falseon the combined statements you don’t need the backslash
if (that.config.validSenders.includes(mailObj.sender[0].address) && daysAgo >= 0 && daysAgo <= that.config.daysToDisplay) {but this is THREE comparisons
- that.config.validSenders.includes(mailObj.sender[0].address)
- daysAgo >= 0
- daysAgo <= that.config.daysToDisplay
the last two CANNOT be true at the same time
maybe what you wanted was
if ( that.config.validSenders.includes(mailObj.sender[0].address) && (daysAgo >= 0 && daysAgo <= that.config.daysToDisplay) ) {this is two outer compares (with one inner)
-
RE: MMM-MealViewer
@ewingfox in this open source world the way to approach this is to submit your update as a pull request to the original module
Then the author doesn’t have to spend time inventing the changes, only reviewing your work
So, on GitHub
Fork the module, now you have a linked copy
git clone your copy, same as you did the original (only one in a place at a time)
Update your copy
git add your changes
git commit your changes to your local copy of the repo
git push. To upload your copy to GitHub, updating your fork
Use GitHub to submit/contribute your changes to the original module, -
RE: How difficult would it be to change the data an existing module receives?
@Tippon you can clone (fork) the module and add on what you want…
there are two parts of the module… the browser/ui part MMM-Fitbit2.js
and the helper, node_helper.jsthe MMM-Fitbit2.js cannot access hardware or files directly, so it has to call the helper
so, you could add on access to the spreadsheet (csv)
and send that data back as part of the response… the front end would never knowone of my modules uses a csv
in the node_helper
(you have to npm install csvtojson in the module folder to be able to use it)const cvt = require("csvtojson");and then
cvt().fromFile(payload.tmpfile) // input xls // changed to tmpfile .subscribe((jsonObj, index) => { // handle each row })