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.

    Add data from another Pi

    Scheduled Pinned Locked Moved Solved Troubleshooting
    9 Posts 3 Posters 3.4k Views 3 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.
    • R Offline
      Richard238
      last edited by

      I have another Pi, in an out-building, collecting data and serving it up via Apache/MySQL/PHP.

      How can I get this data integrated in to MM2?

      Thank you.

      1 Reply Last reply Reply Quote 0
      • yawnsY Offline
        yawns Moderator
        last edited by yawns

        If you use Apache and PHP you could create a php script which delivers JSON (or XML) data based on the query and is called by the other raspberry. I would avoid saving data into a text file on the Apache PI and having the MM² PI opening this text file. That could cause trouble when the file is in use (data is currently being written into the file).

        R 1 Reply Last reply Reply Quote 0
        • R Offline
          Richard238 @yawns
          last edited by

          @yawns said in Add data from another Pi:

          …you could create a php script which delivers JSON (or XML) data…

          Beyond my capabilities, I’ll keep looking though. Thank you.

          1 Reply Last reply Reply Quote 0
          • yawnsY Offline
            yawns Moderator
            last edited by

            Okay, one step back …
            Your data is stored in your mysql database, right? How is this data stored there? Did you program a script? Or are you using a script/system from the internet? Maybe there already is some kind of a backend you could use?

            1 Reply Last reply Reply Quote 0
            • R Offline
              Richard238
              last edited by

              @yawns said in Add data from another Pi:

              Okay, one step back …
              Your data is stored in your mysql database, right?

              Yes, correct

              @yawns said in Add data from another Pi:

              How is this data stored there? Did you program a script?

              It’s a couple of temperature sensors which are written to the MySQL DB via a .py script.

              1 Reply Last reply Reply Quote 0
              • I Offline
                izanbard
                last edited by

                @Richard238

                serving it up via Apache/MySQL/PHP.

                I can help modify the scrip that servers up the data for viewing and instead of returning HTML it could easily return JSON. That would be step one. To help I would need to see your php files and know what url you are using to access the PHP page. either PM them to me, or point me at a repo.

                Step two would be writing a MM module that gets the JSON and displays it right. I may be able help here too.

                I 1 Reply Last reply Reply Quote 0
                • I Offline
                  izanbard @izanbard
                  last edited by

                  @izanbard Of course if you already have a webpage with exactly the right stuff on it, then you could use the iframe module.

                  1 Reply Last reply Reply Quote 0
                  • I Offline
                    izanbard
                    last edited by

                    Have emailed you with some instructions, but check:
                    [card:izanbard/MMM-MyTemps]
                    for the full source

                    1 Reply Last reply Reply Quote 0
                    • R Offline
                      Richard238
                      last edited by

                      Thanks for all your work on this, it’s working great!

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        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