MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. Tippon
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 10
    • Posts 53
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: MMM-Fitbit2

      Sorry for replying to an old topic, but I thought it was best to keep this in the same place.

      I realised today that I’m having a problem with MMM-fitbit2. I fixed the issue in my other thread here yesterday:

      https://forum.magicmirror.builders/topic/14879/mmm-fitbit2-pythonshell-is-not-a-constructor?_=1617917654075

      but updated Magic Mirror shortly after, so I’m not sure if the problem existed before the update or not.

      The module loads and seems to work, but I’m only getting values returned for the calories I’ve burned water drank, and my weight. My food eaten isn’t updating, even though it’s showing in my Fitbit dashboard. I don’t have a Fitbit device so I’m not sure if the other values are flled in on my dashboard.

      posted in Health
      TipponT
      Tippon
    • RE: Weather not working since MM update

      I realised today that I’m having a problem with MMM-fitbit2 too. I fixed the issue in my other thread here yesterday:

      https://forum.magicmirror.builders/topic/14879/mmm-fitbit2-pythonshell-is-not-a-constructor?_=1617917654075

      but updated Magic Mirror shortly after, so I’m not sure if the problem existed before the update or not.

      The module loads and seems to work, but I’m only getting values returned for the calories I’ve burned and my weight. My food eaten isn’t updating, even though it’s showing in my Fitbit dashboard.

      I know this probably isn’t related, but as both issues appeared at the same time I thought it was worth a mention just in case.

      posted in Troubleshooting
      TipponT
      Tippon
    • RE: Weather not working since MM update

      @sdetweil I’ve just done npm install and it made no difference. I rebooted and there was no difference, so I did git pull on both installations too, just in case. Git pull said already up to date in both cases, and npm install ran through but made no difference.

      EDIT: Sorry, I’ll be a little while before I answer again. I’ve just realised that it’s 5am here, so I’m going to bed :astonished_face:

      posted in Troubleshooting
      TipponT
      Tippon
    • RE: Weather not working since MM update

      @sdetweil Not as far as I know. I used MMM-Remote-Control to update remotely

      https://github.com/Jopyth/MMM-Remote-Control

      I’ll try npm install now and see if it fixes it.

      posted in Troubleshooting
      TipponT
      Tippon
    • Weather not working since MM update

      I’m running two mirrors from one virtualised Pi, and both gave me the update is available message earlier. I backed up and updated, and now the weather module is stuck on loading on both. I get the following error message in the browser console:

      openweathermap.js:479 Uncaught TypeError: this.hide is not a function
          at Class.getParams (openweathermap.js:479)
          at Class.getUrl (openweathermap.js:122)
          at Class.fetchCurrentWeather (openweathermap.js:31)
          at weather.js:163
      

      and line 479 is:

      this.hide(this.config.animationSpeed, { lockString: this.identifier });
      

      I’ve just checked the old file from the backup, and the same line exists, but on line 440:

      this.hide(this.config.animationSpeed, { lockString: this.identifier });
      

      The only change I’ve made on my end was to the MMM-Fitbit2 module, and that only runs on one of the mirrors. The change is here in case it makes a difference:

      https://forum.magicmirror.builders/topic/14879/mmm-fitbit2-pythonshell-is-not-a-constructor

      Please let me know if you need any more information :)

      posted in Troubleshooting
      TipponT
      Tippon
    • RE: MMM-Fitbit2 PythonShell is not a constructor

      @sdetweil Once again, you are a superstar. It’s working, thank you :)

      I thought I’d tried that the other night, but for some reason it didn’t work. I don’t know if I typed it in wrong, or if I messed it up when I tried to do it remotely through my phone. Either way, it’s working now, and I’m a happy bunny :D

      posted in Troubleshooting
      TipponT
      Tippon
    • MMM-Fitbit2 PythonShell is not a constructor

      I set up MMM-Fitbit2 recently, and have gone through the setup and authorisation. It seemed to go ok, but now it stops at loading. There’s a PythonShell error in the logs, which seems to be affecting a few other modules.

      I’ve tried to use the fixes for some of the other modules, but I don’t know enough to get them to work.

      I’ve attached the error below. Does anyone know how to fix it please?

      [05.04.2021 01:04.45.169] [ERROR] Whoops! There was an uncaught exception...
      [05.04.2021 01:04.45.169] [ERROR] SyntaxError: Unexpected end of JSON input
          at JSON.parse (<anonymous>)
          at /home/pi/MagicMirror2/modules/MMM-Remote-Control/node_helper.js:1018:33
          at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
      [05.04.2021 01:04.45.169] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
      [05.04.2021 01:04.45.169] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
      [05.04.2021 01:07.33.662] [ERROR] Whoops! There was an uncaught exception...
      [05.04.2021 01:07.33.662] [ERROR] TypeError: PythonShell is not a constructor
          at Class.getData (/home/pi/MagicMirror2/modules/MMM-Fitbit2/node_helper.js:54:25)
          at Class.socketNotificationReceived (/home/pi/MagicMirror2/modules/MMM-Fitbit2/node_helper.js:17:9)
          at Socket.<anonymous> (/home/pi/MagicMirror2/js/node_helper.js:112:11)
          at Socket.emit (events.js:198:13)
          at process.nextTick (/home/pi/MagicMirror2/node_modules/socket.io/dist/socket.js:435:32)
          at process._tickCallback (internal/process/next_tick.js:61:11)
      [05.04.2021 01:07.33.662] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
      [05.04.2021 01:07.33.662] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
      
      posted in Troubleshooting
      TipponT
      Tippon
    • RE: MMM-Cryptocurrency

      @sdetweil parseInt and parseFloat sound vaguely familiar. I was teaching myself Python last year, but had to stop when the schools closed and my daughter was home all day.

      Now that the schools are back, I’m hoping to start again. After trying out MagicMirror, I might learn Javascript first though. I find it a lot easier if I’ve got a real world project to learn about, and MM is more interesting too :)

      Thanks again for your help :)

      posted in Troubleshooting
      TipponT
      Tippon
    • RE: MMM-Cryptocurrency

      @sdetweil said in MMM-Cryptocurrency:

      @tippon has nothing to do w javascript

      how do u get from the text value to the proper number?

      write the steps down

      I’m not sure. I know it’s multiplying my number of coins from the wallet section in config.js by the price result from the API, and it’s rounding the figures to the number of decimal points I specified, but I’m getting lost.

      I think I’ve spotted the problem now though, and it seems to be working. These two lines:

      var myPrice=currentCurrency.price.replace("£","");
      var myPrice=myPrice.replace(".", "").replace(",", ".");
      

      strip out the pound sign, then the decimal point, then change the thousands separator to a decimal point.

      Removing the pound sign is at least part of what changes the amount from text to a number (sorry, I’m figuring it out as I’m typing), but removing the decimal point for the low value coins under £1 multiplies their value by 10. e.g. Doge goes from 0.039 to 0039, or 39p. Swapping the thousands separator to a decimal point does the opposite for the large value coins, turning Bitcoin’s £43,000 into £43.000, or £43. I’ve changed it to this:

      var myPrice=currentCurrency.price.replace("£","");
      var myPrice=myPrice.replace(",", "");	
      

      Now the pound symbol is still removed, so the coin’s value is still changed from text to a number, and the thousands separator is removed for the same reason, but without changing the value. I think that the original contributor was European, so uses dots instead of commas for number separation, and changing to GBP messed that up.

      @sdetweil said in MMM-Cryptocurrency:

      @sdetweil get rid of leading no decimal
      remove thousands separator
      if it contains the decimal separator, use string.parseFloat, otherwise use string.parseInt
      once u have the right numbers it should work

      Now that my brain’s caught up with what you were saying, I think I’ve got it right. I have no idea how to use string.parseFloat or string.parseInt though, and no idea how to check which numbers the API sends. That can be my project for tomorrow though, it’s 2am here, and my brain is melting :beaming_face_with_smiling_eyes:

      Thank you for helping me, and giving me a shove in the right direction :thumbs_up: :slightly_smiling_face:

      posted in Troubleshooting
      TipponT
      Tippon
    • RE: MMM-Cryptocurrency

      @sdetweil said in MMM-Cryptocurrency:

      @tippon said in MMM-Cryptocurrency:

        	var myPrice=myPrice.replace(".", "").replace(",", ".");
        	var myWallet=(this.config.wallet[i]).toFixed(4);
        	var myValue='£' + (this.config.wallet[i]*myPrice)
      

      shouldn’t it be myWallet*myPrice

      u converted the config wallet to fixed, then didn’t use it

      So this should read

        	var myPrice=myPrice.replace(".", "").replace(",", ".");
        	var myWallet=(this.config.wallet[i]).toFixed(4);
        	var myValue='£' + (myWallet*myPrice)
      

      is that right? I just tried it but nothing changed.

      If I change

       var myPrice=myPrice.replace(".", "").replace(",", ".");
      

      to

      var myPrice=myPrice.replace(",", ".");
      

      so getting rid of the first .replace(“.”, “”), all the coins except for the first two are correct. Something is separating the coins into groups, and moving the decimal points. Unfortunately, I know nothing about Javascript, and am just using trial and error :see-no-evil_monkey: :beaming_face_with_smiling_eyes:

      posted in Troubleshooting
      TipponT
      Tippon
    • 1 / 1