Read the statement by Michael Teeuw here.
MMM-MyCommute
-
-
Hi all.
Wondering if there’s a way to hide the arrival time? Can’t see an option in the config.
Thanks -
Additional question - the startTime option doesn’t seem to be working correctly for me. The module doesn’t display in the morning on the pi/mirror, even after the specified startTime. Weirdly, when I browse to the mirror from my laptop or phone (http://ip:8080) that seems to trigger the module to display on the pi.
Any ideas there?! -
@matt216 said in MMM-MyCommute:
Weirdly, when I browse to the mirror from my laptop or phone (http://ip:8080) that seems to trigger the module to display on the pi.
Any ideas there?!this means the module is not written for multiple browser instances.
when the helper sends data back, it sends data back to ALL connected clients at the same time.
the clients need to check if the message is for them , but the helper needs info on the request to do it… so the modulename.js has to change too… -
@matt216 said in MMM-MyCommute:
Additional question - the startTime option doesn’t seem to be working correctly for me. The module doesn’t display in the morning on the pi/mirror, even after the specified startTime. Weirdly, when I browse to the mirror from my laptop or phone (http://ip:8080) that seems to trigger the module to display on the pi.
Any ideas there?!I think I remember with this module that it has an odd hide/show behaviour. Are you working with MMM-pages or any module scheduler being able to hide modules?
When you open your browser, a request is sent to node_helper and it sends the data back to the module (like Sam said, ALL instances). With receipt f the data the module.show() function gets triggered, so it gets shown again while it has been hidden for some reason before. -
@sdetweil thanks for the help (again).
I’m not sure I understand… it seems to take a second browser loading the page for the main mirror to display the module.
As per the github page for the module, the startTime option is “The start time of the window during which this module wil be visible.” but this is not happening.
endTime option works fine - the module disappears, but it does not reappear at startTime.
Thanks -
@matt216 said in MMM-MyCommute:
@sdetweil thanks for the help (again).
I’m not sure I understand… it seems to take a second browser loading the page for the main mirror to display the module.See my response. Every time any instance on any browser (pi/laptop) gets created, it sends a request to the server-side node_helper. This happens with most of the modules.
node_helper sends it back and all the instances get fresh data and certain functions get triggered.Here is the client side: running when you open the broser (note the
this.getdata()
function.start: function() { Log.info('Starting module: ' + this.name); //start data poll this.getData(); var self = this; setInterval(function() { self.getData(); }, this.config.pollFrequency); },
and here the client side receives the data from node_helper : note the
this.isHidden=false
andthis.show()
functions at the end.socketNotificationReceived: function(notification, payload) { if ( notification === 'GOOGLE_TRAFFIC_RESPONSE' + this.identifier ) { this.predictions = payload; if (this.loading) { this.loading = false; if (this.isHidden) { this.updateDom(); this.show(1000, {lockString: this.identifier}); } else { this.updateDom(1000); } } else { this.updateDom(); this.show(1000, {lockString: this.identifier}); } this.isHidden = false; }
-
@lavolp3 thanks - the node_helper and multiple browsers makes sense now.
No - no MMM-pages or module schedulers being used.
I have my startTime option set to 05:00. I will try a cron job to pm2 restart mm at 05:15… -
@matt216 there might be an issue with your start and end time. Can you post your config for the module?
-
{ module: 'MMM-MyCommute', position: 'bottom_left', header: 'Google Maps', config: { apiKey: 'xyz', origin: 'xyz', startTime: '05:00', endTime: '20:00', showUpdated: false, destinations: [ { destination: 'xyz', label: 'Erica commute', mode: 'driving' } ] } },
Thanks