After chasing my tail on the Referrer issue, I finally just started throwing “console.log” everywhere in the .js. By dumping the actual result from the query (called “body”), I can actually see valid data being returned! So, it is getting the data, but failing to parse/process/display it. The module is stuck on “Loading…” (And, even weirder, while restarting my MM over and over, it seemed like the module worked once! But with no changes, it is not working again now.)
I am digging into how it parses the data, and learning a lot about the console.log statement to figure out where it is breaking down.
See below for proof that the module is actually pulling data. Hopefully, tomorrow will bring more time to investigate.
On a side note, it is amazing how easy it is to lose track of time while working on what amounts to a sophisticated clock!
/* Magic Mirror
* Module: Pollen allergies
*/
var NodeHelper = require('node_helper');
var request = require('request');
module.exports = NodeHelper.create({
start: function () {
console.log('MMM-Pollen helper started ...');
},
getData: function (url) {
var self = this;
console.log('requesting:' + url);
request({ url: url, headers: {'Referer' : url}, method: 'GET' }, function (error, response, body) {
if (!error && response.statusCode == 200) {
var result = JSON.parse(body);
self.sendSocketNotification('POLLEN_RESULT', result);
--> console.log('display body contents:' + body);
} else {
console.log("MMM-Pollen : Could not load data.");
}
});
},
//Subclass socketNotificationReceived received.
socketNotificationReceived: function(payload) {
this.getData(payload);
}
});
[2026-05-27 20:20:28.607] [LOG] Module helper loaded: MMM-Pollen
[2026-05-27 20:20:29.747] [LOG] Connecting socket for: MMM-Pollen
[2026-05-27 20:20:29.747] [LOG] MMM-Pollen helper started ...
[2026-05-27 20:20:31.512] [LOG] requesting:https://www.pollen.com/api/forecast/current/pollen/90210
[2026-05-27 20:20:31.605] [INFO] Checking git for module: MMM-Pollen
[2026-05-27 20:20:31.733] [LOG] display body contents:{"Type":"pollen","ForecastDate":"2026-05-27T00:00:00-04:00","Location":{"ZIP":"90210","City":"BEVERLY HILLS","State":"CA","periods":[{"Triggers":[{"LGID":186,"Name":"Oak","Genus":"Quercus","PlantType":"Tree"},{"LGID":346,"Name":"Grasses","Genus":"Grasses","PlantType":"Grass"},{"LGID":236,"Name":"Mulberry","Genus":"Morus","PlantType":"Tree"}],"Period":"0001-01-01T00:00:00","Type":"Yesterday","Index":4.5},{"Triggers":[{"LGID":186,"Name":"Oak","Genus":"Quercus","PlantType":"Tree"},{"LGID":346,"Name":"Grasses","Genus":"Grasses","PlantType":"Grass"},{"LGID":236,"Name":"Mulberry","Genus":"Morus","PlantType":"Tree"}],"Period":"0001-01-01T00:00:00","Type":"Today","Index":4.5},{"Triggers":[{"LGID":186,"Name":"Oak","Genus":"Quercus","PlantType":"Tree"},{"LGID":346,"Name":"Grasses","Genus":"Grasses","PlantType":"Grass"},{"LGID":236,"Name":"Mulberry","Genus":"Morus","PlantType":"Tree"}],"Period":"0001-01-01T00:00:00","Type":"Tomorrow","Index":4.1}],"DisplayLocation":"Beverly Hills, CA"}}