@TomBrown compliments can read from a file, and u can link that file to be on a file server.
and u can run two instances of compliments showing different info.
only issue is that it reads the file only on startup.
@TomBrown compliments can read from a file, and u can link that file to be on a file server.
and u can run two instances of compliments showing different info.
only issue is that it reads the file only on startup.
@kai no… don’t change anything… ignore the update message
not tested with that version
@UncleRoger then to update your repo
on the pi in your module folder
git status
will tell you the files that changed
git add .
will add them all
git add filename filename2
will add only those to the pending commit
git commit -m "some message why you made these changes"
then
git push
to upload
@TomBrown the ln command ‘creates’ the local file.
and the file can contain just words in each of the time slots.
make it work with an actual file, and then see if that is what u want. if so, then you can move the real file to the server. mount the drive into the pi, and then link the local file to the server file
@smart_user you could use my sample module which puts up a configured message every few minutes. Change the message and the time…
I downloaded a fresh MagicMirror copy, and changed the electron version to “latest”, in package.json
And then did npm install
Default config runs fine
Will try some other modules
Pir, hotword, assistantmk2.
Ubuntu 18.04.2 LTS, Intel, electron v6.0.10, ok
node 8.10.0
npm 6.11.3
Ubuntu 18.04.3 LTS, odroid, electron v6.0.10, ok
node 8.10.0
npm 6.10.2
MMM-PIR-Sensor fails, access denied, exportGPIO, /sys/class/gpio/export
MMM-Hotword, V2, ok.
MMM_AssistantMk2, ok
Raspian stretch 9.4, pi V3, electron v6.0.10, ok
node 10.6.0
npm, 6.11.3
@UncleRoger when you created the repo on GitHub you should have seen this output
I named my repo fribble2 for this test
in the section on create new from commandline
I would not do the git add for the readme as I have that already on the GitHub side
@alexrm I haven’t seen such a thing. mm is really output only. some of the touch stuff gets u to change pages or move modules.
none really have capabilities like a phone app.
@innovation this sample module shows a whole host of things.
defaults: {
message: "STAY HYDRATED! DRINK A GLASS OF WATER"
},
config:{
message: "some message to replace the default"
}
notificationReceived(), ALL_MODULES_STARTED
sendSocketNotification
receiveSocketNotification
then sends data back to the module sendSocketNotification()
this 'data' is the configured message, the module sends all the config down to the helper,
the helper sends back JUST the message to display from the config info
it just shows how the parts fit together and communicate with each other
4a. the module receives the notice from the node_helper, and then setup up to display that data
socketNotificationReceived()
4b. the module tells MM that there is new data to display
updateDom(1000)
getDom()
now, the current implementation ONLY sends and displays the message once…
send down to node_helper, timer, send to module, display
u want two things
but u need something to start the work… after all of the above, there is nothing to do… getDom() ALWAYS displays whatever is in the message variable.
SO, we could start ANOTHER timer, and when it expires, cause getDom() to display something different (from the same old place)
the timerRoutine() will do the second part , change the message variable, and tell MM it changed, which calls getDom()
but some NEW code has to cause the timerRoutine to run…
for this example, when getDom() runs, lets add some code to run the timerRoutine later
setTimeout(this.timerRoutine, ???) where ??? is some number of milliseconds
15000 is 15 seconds (15 seconds times 1000 milliseconds per second)
so , our updated getDom() looks like this
getDom (){
var wrapper=createElement("div")
wrapper.innerText=this.somestring // use the value of the somestring variable to display
setTimeout(this.timerRoutine, 15000) // start a timer, when it expires call our routine
return wrapper;
}
so lets look at our timerRoutine
every time it runs, it will update the counter variable and then create a new message string
timerRoutine: function(){
this.somestring="some other string "+ this.counter++;
this.updateDom(?????) // time_to_delay_in_ms, 0 = immediately
}
updateDom takes a number as a parameter, number of milliseconds…
how FAST do you want the new info to display??? immediately? or after some time?
if immediately, then the number is 0
so, the updated routine looks like this
timerRoutine: function(){
this.somestring="some other string "+ this.counter++;
this.updateDom(0) // time_to_delay_in_ms, 0 = immediately
}
(ps u need to add the counter variable at the top near your defaults, not IN defaults, so that this code will work)
so, now we have the whole loop, start, send to node_helper, node_helper waits, sends message back, module updates variable, and tells mm we have content, mm calls getDom, which creates the html content to display, starts ANOTHER (one time) timer, and gives the current content to MM.
and then that timer expires and calls our routine, which changes the variable, and tells MM we have new content, mm calls getDom, which creates the html content to display, starts ANOTHER (one time) timer, and gives the current content to MM.
repeat this last cycle forever, over and over and over.
so the displayed message will change every 15 seconds
so, NOW you want the message to go away, before the next message appears…
well, we have to start some OTHER timer, OR piggy back on the existing timer…
lets use a second timer and a second timerRoutine (otherwise the time cycle is 15 seconds on, 15 seconds off
----> need to add showMessage:true, to the variables at the top
timerRoutine2: function(){
this.showMessage= !this.showMessage // this will cause the flagShowMessage to toggle between true and false
this.updateDom(0) // time_to_delay_in_ms, 0 = immediately
}
and now we need to fix getDom()
getDom (){
var wrapper=createElement("div")
if(this.showMessage){ // if we should show the message
wrapper.innerText=this.somestring // use the value of the somestring variable to display
setTimeout(this.timerRoutine2, 5000) // start the timer to CLEAR the message in 5 seconds
}
// we don't need the negative case, cause we created a new empty div, so it will have nothing to display
setTimeout(this.timerRoutine, 15000) // start a timer, when it expires call our routine
return wrapper;
}
these are just examples, there are lots of ways to do something like this, up to your imagination…
write it down on a piece of paper, walk thru it in your native language, get the flow… then write code to match