Closed JonPhno closed 4 years ago
Could you share your config file? Make sure to remove passwords, api-keys and other sensitive information.
Here's my config file(changed the extension because github doens't allow .js files) :MMM-MyCommute.txt
Did you modify the module's code? Normally you would configure modules in your config/config.js...
I actually meant for you to attach a copy of that file.
I did not modify the code. I don't remeber why I put my configs there, but it worked so I didn't bother. In my config.js I simply put { module: 'MMM-MyCommute', position: 'top_left', header: 'Traffic', classes: 'default everyone' }
I can try to debug it with Chrome on my pc next week. I'm currently trying to cancel the fees that Google Cloud Platform is trying to charge me.
Somehow your code is missing parts from the suspend branch. That was all merged into master recently.
Could you make sure you really are on 672388341b8768c2260746cebe959b5e3b5c8e05?
$ git show HEAD
commit 672388341b8768c2260746cebe959b5e3b5c8e05 (HEAD -> master, origin/master, origin/HEAD)
...
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
...
$ git diff
I checked and I have the same commit as you. The only difference I see when I enter git diff is my changes to my location. Also, when I look in my Cloud Platform, I see that there is more requests than it shoudl have since the begining. I started late August so the first month didn't had any problem because it didn't make enought request to bust the free 40 000 request per month.
I see more differences if I use the file you've attached earlier.
--- MMM-MyCommute.js 2019-10-03 17:08:44.937652502 +0000
+++ /tmp/MMM-MyCommute.txt 2019-10-03 17:02:35.320565433 +0000
@@ -18,14 +18,13 @@
Module.register("MMM-MyCommute", {
defaults: {
- apikey: "",
- origin: "65 Front St W, Toronto, ON M5J 1E6",
+ apikey:
+ origin:
startTime: "00:00",
endTime: "23:59",
lang: config.language,
- hideDays: [],
+ hideDays: [0,6],
showSummary: true,
- showUpdated: true,
colorCodeTravelTime: true,
moderateTimeThreshold: 1.1,
poorTimeThreshold: 1.3,
@@ -33,33 +32,24 @@
travelTimeFormat: "m [min]",
travelTimeFormatTrim: "left",
pollFrequency: 10 * 60 * 1000, //every ten minutes, in milliseconds
- maxCalendarEvents: 0,
+ maxCalendarEvents: 5,
maxCalendarTime: 24 * 60 * 60 * 1000,
calendarOptions: [{mode: "driving"}],
destinations: [
{
- destination: "40 Bay St, Toronto, ON M5J 2X2",
- label: "Air Canada Centre",
- mode: "walking",
- time: null
+ destination:
+ label:
+ mode: "driving",
+ time: null,
+ alternatives: false
},
{
- destination: "317 Dundas St W, Toronto, ON M5T 1G4",
- label: "Art Gallery of Ontario",
- mode: "transit",
- time: null
- },
- {
- destination: "55 Mill St, Toronto, ON M5A 3C4",
- label: "Distillery",
- mode: "bicycling",
- time: null
- },
- {
- destination: "6301 Silver Dart Dr, Mississauga, ON L5P 1B2",
- label: "Pearson Airport",
- time: null
- }
+ destination:
+ label:
+ mode: "driving",
+ time: null,
+ alternatives: false
+ }
]
},
@@ -154,19 +144,12 @@
suspend: function() {
Log.log(this.name + " suspended");
- if(!this.suspended) {
- this.suspended = true;
- clearInterval(this.interval);
- }
+ this.suspended = true;
},
resume: function() {
Log.log(this.name + " resumed");
- if(this.suspended) {
- this.suspended = false;
- this.getData();
- this.rescheduleInterval();
- }
+ this.suspended = false;
},
/*
@@ -529,15 +512,6 @@
wrapper.appendChild(row);
}
- if(this.config.showUpdated) {
- var updatedRow = document.createElement("div");
- updatedRow.classList.add("row");
- updatedRow.classList.add("light");
- updatedRow.classList.add("xsmall");
- updatedRow.innerHTML = "Last update: "+this.lastUpdated.format("HH:mm");
- wrapper.appendChild(updatedRow);
- }
-
return wrapper;
},
@@ -545,7 +519,6 @@
if ( notification === "GOOGLE_TRAFFIC_RESPONSE" + this.identifier ) {
this.predictions = payload;
- this.lastUpdated = moment();
if (this.loading) {
this.loading = false;
@@ -573,6 +546,9 @@
this.isHidden = true;
} else if ( notification === "CALENDAR_EVENTS" ) {
this.setAppointmentDestinations(payload);
+ if ( !this.suspended ) {
+ this.getData();
+ }
}
}
Oh I think I see what happend here. I stashed my changes to the MMM-MyCommute.js file because git would not allow me to pull. Then when I applied my stash, it ovewrited your new lines. I will move my configs in config.js where it should be. Do you think thats what cause the large amount of request?
It could be. There have been some changes to the suspension and updating. If anything caused the MMM-MyCommute module to repeatedly suspend/resume it might have triggered too many requests.
I have tried to fix that in the module too. See for example 00b92ebe5b8ffc9e6f2816b8f387aa2e4585720e.
I would suggest to keep an eye on your billing dashboard the coming days and make sure everything is in order. I think it's quite a loss, for this module, the free tier was removed from the Advanced Directions Api... The kind of issue you've run into is a nightmare come true for me.
I really hope you can work things out with Google regarding the payments...
I already see a difference. I pulled your MMM-MyCommute.js file and put all my configs in the main config.js file. Before that, I was seeing a lot of line on the server console saying that I busted my api limit (I set some quotas to make sure I don't bust again) even when the module is hidden. Now I don't see anything poping up. I will update in a couple of days if that fixed the problem and the outcome of my payments.
Okay so sorry I took a long time to update but here's where I am now. The Google support told me I am credited the full amount so I do not have anything to pay. The automatic did try to charge me anyways a couple of time and then my payment account got suspended. As I do not plan on paying any fees for their apis, I don't think I will do anything about it for now. Regarding of the module, I do see normal amounts of request now. Some times "error" is shown when displaying commute time and sometimes the module simply don't show when it sould. I don't know if it as anything to do with my account being suspended as I didn't look into it but for now I think that this particular issue is good.
Describe the bug Insane amounts of request, but like 200 000 requests per month insane. My poll frequency is 10 minutes, yet on my Google Cloud Platform I see 4000 requests for Directions Api and 200 000 requests for Advanced Directions Api.
To Reproduce I setup my Magic Mirror by having the server on a Ubuntu VM and I display it on a Raspberry Pi 0 on Chromium. Can't really help much more. I have no waypoints setuped but I do use traffic infos.
Expected behavior Make a request every 10 minutes.
Running version Lastest 672388341b8768c2260746cebe959b5e3b5c8e05