HttpPost using UIflow



  • You should write a own parser for this response.

    You could use a block:
    text->replace oldvalue with newvalue in yourresponse
    to remove uneccessary values from your response

    where as:
    oldvalue you assign "<HTML>"
    newwalue you assign "" (empty string)
    yourresponse assign your response variable

    And repeat this for all other html markups exists in your response. When you have only interested values
    ua 1 ub 1 ... ul 1
    when you could use: list -> make list from text yourresponse with delimiter " "



  • UiFlow Example?



  • something like this:

    0_1595860935159_Screenshot_20200727-163409-01.jpeg

    0_1595860973942_Screenshot_20200727-163429-01.jpeg



  • 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



  • 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).



  • 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.



  • 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)



  • @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



  • @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



  • @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.



  • @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.