🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    HttpPost using UIflow

    UIFlow
    4
    13
    20.5k
    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.
    • F
      franco @Thrasher
      last edited by

      UiFlow Example?

      1 Reply Last reply Reply Quote 0
      • R
        robalstona
        last edited by

        something like this:

        0_1595860935159_Screenshot_20200727-163409-01.jpeg

        0_1595860973942_Screenshot_20200727-163429-01.jpeg

        1 Reply Last reply Reply Quote 0
        • F
          franco
          last edited by franco

          My problem is before, how to get the data, i tested this but it doesn't work!
          "Get data" fail.
          0_1595873974367_Schermata 2020-07-27 alle 20.18.54.png

          1 Reply Last reply Reply Quote 0
          • R
            robalstona
            last edited by

            Maybe you need change POST to GET. Print get data and status code in the succes and failure part of http block. Finally try use another software to test debug requests you are send. Or read Api documentation for your service/device.I already use Restler and Pydroid3 on Android for test http connection. But i wrote code in pure python and later i create own custom block to read data from services.

            How do you get data from your first post? (this html page).

            1 Reply Last reply Reply Quote 0
            • F
              franco
              last edited by

              i use a browser and i give this Url :
              "http://79.8.125.79:8084/?onx"
              and then i get:
              <html>
              <head>
              </head>
              <body>
              ua 1 ub 1 uc 1 ud 1 ue 1 uf 1 ug 1 uh 1 ui 1 ul 1
              </body>
              </html

              there are lot of python example to get this result, but i want to replay it with UiFlow
              I tested with another software using HttpPost and HttpGet, both it work the response is different.
              This Url activate small board with 8 relè with a simple web server, few commands and i can control it.
              I want to do it using UiFlow example and M5stack basic.

              1 Reply Last reply Reply Quote 0
              • R
                robalstona
                last edited by

                maybe you should try this code:

                0_1596221966914_Screenshot_20200731-205438-01.jpeg

                also try add block to connect to your wifi and download code to device (not play button)

                F 1 Reply Last reply Reply Quote 0
                • F
                  franco @robalstona
                  last edited by

                  @robalstona
                  Tested, and it doesn't work, no response and it doesn't send the command.

                  I tested using the browser and i get the response and the hardware does what it have to do.

                  0_1596266244482_Schermata 2020-08-01 alle 09.17.07.png

                  1 Reply Last reply Reply Quote 0
                  • R
                    robalstona
                    last edited by

                    @franco try change address to: http://ip_address_of_your_wifi_router and check if yo get any tesponse. You must give back something.

                    I change adress to:https://www.google.com/index.html and i getback this response. I receive error, but show the server response for this request

                    0_1596271685936_IMG_20200801_103725-01.jpg

                    1 Reply Last reply Reply Quote 0
                    • world101W
                      world101
                      last edited by world101

                      @franco what is the m5stack device is talking to? It appears to be a web server or similar, but what is it? Also, I would recommend adding another label to the m5stack/m5stickC to get the HTTP status code. This would give an indication if the flow is timing out (no response or eventually failure after the timeout period) or what the response is with the HTTP error code (see this link for a list of error codes).

                      0_1596285055868_Screen Shot 2020-08-01 at 8.30.37 AM.png

                      Also, you showed two http addresses above, http://79.8.125.79:8084/?onx and http://192.168.1.123/?offx. I assume one is on a public network and the other is on your private/local network. So you would also need to make sure the servers are not blocking traffic from the network the m5stack/m5stickC is on.

                      1 Reply Last reply Reply Quote 0
                      • R
                        robalstona
                        last edited by robalstona

                        @franco see the python code tab. The urequests statement comes immediately after the try statement. If something goes wrong, e.g. a typo in the address (non-existent address), this requests instruction will be treated as if it never started and the blocks Get Data and Get Status Code will not return anything and probably their use in this case cause a error.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post