@chengstark,
Possibly the internet connection was lost during a refresh, this will cause the tokens to get out of date.
I stop MM, re-run the “setupAccess.py” script using credentials from the file, then re-start MM and all is fine, until the next time I have an internet hiccup.
Read the statement by Michael Teeuw here.
Posts
-
RE: Fitbit
-
RE: Default calender module - two calenders in one module
@Laca44 I don’t see anything wrong with the config, if you just have the second calendar by itself will it show?
-
RE: Fitbit
Had my first issues in a while last night. The problem was that my router lost internet connection and when it was restored the tokens were expired. I ran the setupAccess.py and got new tokens.
Seems that there should be a better way to reset the module on restart, like if the tokens are expired, the go get new ones. -
RE: Modules stop work over time
Is there anything in the logs? That would be first place I would start, maybe turning up the log level to get more detail.
-
RE: RPI and HDMI->VGA converters..
Sounds like you have a bad Pi then.
Don’t know if there is any support in the Pi/Linux world but maybe you can use a USB to VGA adapter? I’ve got one on my PC (running winblows) for a dual monitor setup.
-
RE: RPI and HDMI->VGA converters..
Best i can say is, have you done an update and upgrade recently to your Pi (assuming you are on Rasbian or NOOBS OS)?
sudo apt-get update sudo apt-get upgradeand make sure all drivers and configurations are current?
Might start with a new installation of the Pi OS and go from there.
May also need to try to find the differences in the configurations between your Pi and your friends.
-
RE: Fitbit
3 days of syncing without an issue. Not sure what changed, I did pull the latest dev code for MM but made no changes to the fitbit module.
(of course now that I’ve said this, it will error out during the day :) ) -
RE: Fitbit
@Hellangel1987 said in Fitbit:
dont know exactly but im also interested in your cronjob solution, can you inform us about your steps ? im tired getting every day that setupaccess working :(
I haven’t done it, yet, just thinking about it since it was mentioned. I think I’ve narrowed down the issue though:
{"message": {"401": {"errors": [{"message": "Access token expired: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0NU5QMzUiLCJhdWQiOiIyMjdRVjkiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZW4iLCJzY29wZXMiOiJ3aHIgd3BybyB3bnV0IHdzbGUgd3dlaSB3c29jIHdhY3Qgd3NldCB3bG9jIiwiZXhwIjoxNDcxNzAxNjYzLCJpYXQiOjE0NzE2NzI4NjN9.VvLWtyYYvVShgrWC4UOVMXfdv0uiy7Nic-WDj7RMiKA. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process.", "errorType": "expired_token"}], "success": false}}, "type": "error"} {"message": "Getting a new access token", "type": "status"} {"message": "Error getting new access token", "type": "error"} {"message": {"400": {"errors": [{"message": "Refresh token invalid: 4292cf037821b9441122e432bdd92a238fac61028dfbd6be982d2e6b73474c32. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process.", "errorType": "invalid_grant"}], "success": false}}, "type": "error"}First got an “expired” token notice, then the process tries to get a new token (possibly using the “refresh” token, I’m not sure at this point). But refresh tokens are valid for one use only, so it’s like the updated token is getting updated in the token.ini file.
-
RE: Fitbit
Anyway to get around having to run the setupAccess.py everyday/every other day to keep the tokens fresh?
Since I have to stop the MM from running, run the script to get new token, start MM again, it gets kind of annoying. I also run my Pi w/o keyboard/mouse so when I need to refresh the tokens I have to connect them.
I thought about adding a cron job to stop the MM, run the script and start MM, thoughts? Since the script leaves a browser window open, can the cron job kill it or is there a way to have the python script close the window when done?TIA
-
RE: Fitbit
@olliewarren411 said in Fitbit:
Yes, you can change the refresh interval. In the script MMM-fitbit.js you’ll see
start: function() { Log.info('Starting module: ' + this.name); this.sendSocketNotification('SET CREDS',this.config.credentials) this.sendSocketNotification('GET DATA', 'intial'); this.fadeSpeed = 500; // Schedule update interval. var self = this; setInterval(function() { self.updateData(); }, 60*60*1000); },change the 60 x 60 x 1000 to an interval of your choosing. Just be careful to to refresh too often as you’ll get emails from FB telling you that you are pulling too much data. I think (and I’d have to check tonight) that I have mine set to 15 x 60 x 1000.
-
RE: Looking for Beta-testers!
I am now on the development branch.
I have verified that the changes fixed my “blank screen” with the language set in the config file.Thanks!
-
RE: Fitbit
Solved my issues.
Saw the following when starting up MM
results: [{"message":"Writing credentials to credentials.ini","type":"status"},{"message":"Writing id: undefined and secret: undefined","type":"status"},{"message":"Credentials write successful","type":"status"}] Create new todo fetcher for list: Groceries - Interval: 60000 Create new todo fetcher for list: Family - Interval: 60000 Whoops! There was an uncaught exception... { Error: process exited with code 1 at terminateIfNeeded (/home/pi/MagicMirror/modules/node_modules/python-shell/index.js:100:23) at ChildProcess.<anonymous> (/home/pi/MagicMirror/modules/node_modules/python-shell/index.js:88:9) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12) executable: 'python', options: null, script: 'modules/MMM-fitbit/python/getData.py', args: null, exitCode: 1 } MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issuesTracing the information back, it was in the config.js file. I had an extra set of [] around the credentials data. Not sure how or why I had it that way, but all cleared up now.
-
RE: Fitbit
I’m having a problem with my fitbit module. (mods if this should be a new thread just let me know).
I can start the MM and the FB data loads, then after a time my ‘credentials.ini’ file gets changed to “undefined” for both entries[Credentials] c_id = undefined c_secret = undefinedNow, when I ran setupAccess.py the file was correct and my tokens file was created. What I’m seeing happen is that after a while the FB module stops refreshing. I’m guessing it’s because the tokens need to be refreshed and because my credentials are gone, it can’t authorize.
Any thoughts?
I’m not sure how to get any logs or info out of the system. I’m running MM through pm2 and I don’t see any log files.TIA
-
RE: Looking for Beta-testers!
Cool, I’m in, I like breaking things LOL :D
As a noob to the MM project I’m really fascinated by it and eager to start writing my own modules (though I keep finding modules that suit my purpose).
-
RE: Fitbit
OK, So I’m working on this and being new to MM, NodeJS, GIT, etc. is not helping :) (I am a programmer, so at least I have that going for me).
Something that I don’t think was too clear, at least it wasn’t for me. When runningsetupAccess.py, it’s starting a web service, the direction say tolog into your fitbit account and authorize your app, what I had to do, on my Pi, was to go to127.0.0.1:8080. This initiated the redirect to Fitbit, when I logged in I had the check boxes to enable/disable items and the allow/deny buttons.
When I clicked on the “allow” then the terminal with setupAccess running showed that the tokens were getting written out, and indeed the tokens.ini file was finally created. -
RE: Fitbit
Lots of good info to try out. I failed at getting this working this morning before leaving for work.
I do have a question. The directions say MM has to be started with sudo, i’m starting it by running ‘pm2 start mm’ per the MM install setup. How do I run this as root?
Thanks
-
RE: mm-system-temperature
@PointPubMedia
Sorry,
the correct syntax is prependString per the documentation:prependString: 'Pi 3 Temp: 'worked on my system.
-
RE: mm-system-temperature
@PointPubMedia Yes, the prepend string is in the config
modules: [ { module: 'mmm-systemtemperature', position: 'top_center', // This can be any of the regions. classes: 'small dimmed', // Add your own styling. Optional. config: { **prepend: 'your string'** } } ] ~~~ -
RE: mm-system-temperature
The module worked for me, running on RPi 3. The plugin is just executing a script, then stripping off extra data.
What system are you running the module on?
-
RE: System temperature really hot
My system runs 144F when in a case and about 130F out of the case (well, with the top removed). It a Vilros case for the PI3.
Is your Pi in a case or somewhere where there is no good air flow? Do you have a heat sink on the CPU?