@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
Breaking changes in upcoming April release,
We’ve structurally reorganized the system to strictly separate user data from repository data.
The modules folder now contains only user data in the form of third-party modules. The standard modules included with MagicMirror² have been moved to a separate directory, defaultmodules.,
The previously located custom.css file has been moved to the config folder. This happens automatically the first time you start the new version of MagicMirror². The installer and upgrade scripts will do this too
The way config.js is loaded has changed. This should not affect standard users. However, it may have side effects for third-party modules. The client (browser) no longer loads config.js directly from the file system but via the web server (/config).,
Instead, config.js now supports curly braced bash variables. and the .env file remains the same
We’ve changed the default window manager in the startup script from X11 to Wayland. Most Raspberry Pi OS users are likely now using trixie or bookworm, which already ship with Wayland as the default. Running node --run start is now equivalent to node --run start:wayland. Users still using X11 must now switch to node --run start:x11.
The kioskmode, which has been marked as deprecated for 10 years, has been removed. If the kiosksmode parameter is set in config.js, it can be removed; it is now ineffective. You may need to adjust electronOptions parameters if you used kiosksmode before.
If you think any modules you’ve developed may be impacted, you can use the develop branch to test . see this topic about how to get the develop branch if you need to do that
https://forum.magicmirror.builders/post/86422
also if you test as a user and find any issues
please use this topic for any issues you find…
Also,
there are substantial changes to the Calendar module to finally cleanup all the date, timezone, and Daylight savings problems. this removes the use of the moment js library
a complete rewrite of the weather module, to move data acquisition into the node_helper and share that data between module instances (current/forecast for example) … this will help reduce the number of api calls the module makes when there are multiple instances.
@stardyze unuxpected token, means the line before doesn’t end with a comma
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 file
ALSO, 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 instructions
multi-module
https://github.com/sdetweil/MMM-Config/issues/2
and save and use schema file
https://github.com/sdetweil/MMM-Config/issues/11
open a terminal window
ctrl-alt-t
cd ~/MagicMirror/modules
rm -rf xxxxx
where xxxxx is the module you have installed and now want to delete.
exact letter case matters
foo is not the same as Foo on Linux
then do
cd ~/MagicMirror/config
nano config.js
use the arrow keys on the keyboard to move up and down, left and right
find the entry
module:"xxxxx`,
where xxxxx is the module u want to delete
move the cursor to the right end of that line
hit the enter key
type
disabled:true,
hit Ctrl-o
hit enter
hit ctrl-x
you will be back at the terminal window prompt
do
cd ~/MagicMirror
you can now restart MagicMirror however you do that
npm start
or
pm2 restart
read the two links in my signature below
we did the disable approach cause it’s the easiest to do, and requires the least amount of content format knowledge.
thanks guys.
send me text messages if u think I’ve missed some other troublesome users
@r3d6 my bullseye script should handle either way. I updated the comments to include other systems, not just bullseye
@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
@pminich weird
do
cd ~/MagicMirror
git pull
@bicolorbore586 no config option, just set cw to display:none in custom.css