Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here

Alternate Means of Accessing Mayfly Data

Home Forums Monitor My Watershed Alternate Means of Accessing Mayfly Data

Viewing 2 reply threads
  • Author
    Posts
    • #14897
      Zach
      Participant
        I’m looking to access Mayfly data from MonitorMW.org for the development of a simple web application to display the current reading of a variable. If there exists a CORS friendly access method for MMW station site data, please let me know.
        Barring that option, I’ve looked through the documentation as to modifying DRWI_LTE.ino in order to publish the data to another web server. I see in EnviroDIYPublisher.cpp ‘enviroDIYHost’ and ‘postEndpoint’, modifying that much is obvious, but as for establishing a host server using a SQL script to accept this transfer, it gets rather murky. Would you be able to share documentation on such a set up?
        I heard from Heather Brooks that @aufdenkampe or @ensign may be able to assist.
        Also, thanks to @dbressler for helping to connect me in my last thread which is now closed.
      • #14898
        Sara Damiano
        Moderator

          To use ModularSensors to publish to a new endpoint, the “best” way to do it would be to create a new publisher, set the format there, and push it to the library.  There is documentation on how the ModularSensors library works here:  https://envirodiy.github.io/ModularSensors/index.html

          As far as posting to SQL, you can’t do that directly, at least not that I’m aware of.  There’s not a way to send a raw SQL query over TCP-IP.  Generally, you would use HTML on top of TCP to send a post request to a HTTP server which will make the SQL query via a PHP script.  You have to set up that in-between step.  TinyGSM, which ModularSensors uses under the hood for all internet connection, only creates the TCP link.  If you look again at the EnviroDIYPublisher.cpp, you’ll see that the HTML POST request format for MonitorMW is all created manually there.

           

          I’m sorry, I hope that that’s not too much alphabet soup for you to follow.

        • #14902
          Zach
          Participant

            Thank you for clarifying that, Sara.

            I was a too vague in my second paragraph, what I should have asked for was documentation, or a code excerpt for handling the Mayfly’s POST request data as defined in DRWI_LTE.ino on the web backend. I found here a guide that addresses the matter of handling POST requests in PHP directly, I’ll update when I have results.

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.