• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Displaying data from MySQL database

Scheduled Pinned Locked Moved Development
9 Posts 6 Posters 4.9k Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    Henrik @wolkenaj
    last edited by Mar 22, 2018, 8:46 PM

    @wolkenaj You could just display the charts from the website with the iFrame module.
    https://github.com/alberttwong/MMM-iFrame

    C 1 Reply Last reply Mar 23, 2018, 1:30 AM Reply Quote 2
    • C Offline
      cowboysdude Module Developer @Henrik
      last edited by Mar 23, 2018, 1:30 AM

      @Henrik said in Displaying data from MySQL database:

      @wolkenaj You could just display the charts from the website with the iFrame module.
      https://github.com/alberttwong/MMM-iFrame

      BINGO…that’s the easiest way :) I have a few ‘modules’ running that way on my mirror.

      1 Reply Last reply Reply Quote 1
      • W Offline
        wolkenaj @cirdan
        last edited by Mar 27, 2018, 9:00 PM

        @cirdan Thank you for this tidbit. I was aware that I would need a node helper. I think my preferred course would be to call the php file from the node helper. I will eventually need to also call a bash script from my node helper if possible as well. Do you know of a module that does a similar call that I could look at for reference?

        N 1 Reply Last reply Mar 27, 2018, 9:13 PM Reply Quote 0
        • N Offline
          ninjabreadman @wolkenaj
          last edited by Mar 27, 2018, 9:13 PM

          @wolkenaj MMM-PIR-Sensor uses shell scripting in node_helper.js to turn the screen on and off with tvservice.

          Problem with config or JavaScript? Copy/paste it into JSHint.
          Check out the detailed walkthroughs on install, config, modules, etc.

          W 1 Reply Last reply Mar 30, 2018, 7:29 PM Reply Quote 0
          • W Offline
            wolkenaj @ninjabreadman
            last edited by Mar 30, 2018, 7:29 PM

            @ninjabreadman This was very helpful to get a node helper function up and running. I am able to receive a socket notification and run a function based on the notification. My program in the node helper currently looks like

            activateShell: function(){
                 console.log("Activating shell");
                 exec("/Test -s");
            }
            

            I receive the activating shell in the console but the script (a simple echo “Hello World”) does not execute. I’ve tried placing it in my module folder, the Magic Mirror folder, and as a path in the desktop, all to no avail. Would you have any ideas on what is wrong?

            N 1 Reply Last reply Mar 31, 2018, 9:00 AM Reply Quote 0
            • N Offline
              ninjabreadman @wolkenaj
              last edited by Mar 31, 2018, 9:00 AM

              @wolkenaj /Test will tell the shell to look in the root of the filesystem (/) for Test. Instead, ./ will tell it to look in the current working directory (cwd), which I suspect is ~/MagicMirror. So ./Test is likely what you want.

              Worst case, you could use the complete path (~/MagicMirror/Test or /home/pi/MagicMirror/Test) which should also work. I also suggest renaming Test to test.sh, just so it’s always immediately apparent that it’s a shell script.

              Problem with config or JavaScript? Copy/paste it into JSHint.
              Check out the detailed walkthroughs on install, config, modules, etc.

              1 Reply Last reply Reply Quote 0
              • C Offline
                cruunnerr
                last edited by cruunnerr Mar 31, 2018, 10:33 AM Mar 31, 2018, 10:32 AM

                Don’t know if it helps and i am trying to keep it short…

                I build an Oiltank measurement system with another raspberry pi.
                The results will be written to a mysql database and to a JSON file, which will be uploaded to my NAS.
                On the NAS i run the database and a web server.
                To Display the results on a webpage i used this php script: https://github.com/cruunnerr/OilTank-Graph-WebPage

                To display the results on my MM i got some very much help from our user @doubleT
                He wrote this module for me: https://github.com/cruunnerr/MMM-Oiltank
                The module grabs the data from a JSON file and shows it on the MM.

                Maybe this could help :/

                MagicMirror:

                1_1522492360079_Bildschirmfoto 2018-03-31 um 12.30.56.png

                Web Page:

                0_1522492360077_Bildschirmfoto 2018-03-31 um 12.30.12.png

                1 Reply Last reply Reply Quote 1
                • 1 / 1
                1 / 1
                • First post
                  7/9
                  Last post
                Enjoying MagicMirror? Please consider a donation!
                MagicMirror created by Michael Teeuw.
                Forum managed by Sam, technical setup by Karsten.
                This forum is using NodeBB as its core | Contributors
                Contact | Privacy Policy