@enderflop cool
key here is module name = foldername = filename = register name
and node_helper.js has to be in the same folder
@enderflop cool
key here is module name = foldername = filename = register name
and node_helper.js has to be in the same folder
@Dimasua there is a bug in GoogleMapsTraffic
I have an updated version that seems to work, and have submitted to the author, but they have not taken the fix.
@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 false
on 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
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)
@spblat if the module has a node_helper.js, you need to restart MM for any changes to take place
@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.js
the 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 know
one 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
})
@Uwe-Kretsen do not install under mingw, just open a command prompt/ powershell prompt and do the git clone/npm install
u need git of course and node/npm (google how to install)
then u need to do some more steps as the setup is for linux
cd MagicMirror
cd vendor
npm install
cd ..
cd fonts
npm install
cd ..
then edit package.json and change the start line
from
"start": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron js/electron.js",
to
"start": "node_modules/.bin/electron js/electron.js",
then npm start works as expected
also, you must manually copy the MagicMirror/config/config.js.sample to the initial config.js
also create the empty MagicMirror/css/custom.css
we have received notice from Openweather, that they are shutting down the version 2.5 weather endpoint in June 2024
see
https://github.com/MagicMirrorOrg/MagicMirror/issues/3424
for the weather provided by MagicMirror, you will also have to change or add the apiVersion property
see the documentation for exact format
https://docs.magicmirror.builders/modules/weather.html
@Envynot sounds like you are running on windows…
.
two extra steps
cd MagicMirror
cd vendor
npm install
cd ..
cd fonts
npm install
cd ..
now u can start mm again
@dathbe you should list them , we can change the base at any time. there have been discussions to move away from moment.
we moved away from request, and etc,etc…
if you do require(x)
then you should list x in package.json
@wenike deprecated doesn’t mean no longer works… just means you “shouldn’t use it for NEW development”
SO, if its not loaded, YOU can still load it…
npm install valid-url
in whatever module needs it