Display the return message of a @webaction (GET method)

Hello all

I've recently purchased the Pro license for repetier-server and I am quite happy so far. Now I'd love to get the output of my filament scale (based on ESP8266, NodeMCU) displayed on the touchscreen of repetier-server. I can get the actual filament weight with a GET method, but how can I display the return message on the touchscreen? Basically it would be sufficient to show the return message of "@webaction RemainingFilament" in the form of a "@message". Is that possible? If yes, how? Many thanks in advance!

Comments

  • Yes, that is possible with our gcode/server commands using a custom dialog and
    • http_get(url)
      Sends a simple GET query to the url. The response is stored in a json object string with the fields code for the status response code data for the response body. Normally a positive answer has the status code 200.
    computed expression. With this you get the result and can store it in a variable that you then show in a dialog. Be aware that in contrast to @webaction this is a blocking command - means until we get the answer the server can not send commands to printer! No problem beside a print or when the sensor is available and answers quickly.

  • Repetier said:
    Yes, that is possible with our gcode/server commands using a custom dialog and
    • http_get(url)
      Sends a simple GET query to the url. The response is stored in a json object string with the fields code for the status response code data for the response body. Normally a positive answer has the status code 200.
    computed expression. With this you get the result and can store it in a variable that you then show in a dialog. Be aware that in contrast to @webaction this is a blocking command - means until we get the answer the server can not send commands to printer! No problem beside a print or when the sensor is available and answers quickly.

    Thanks a lot, I am glad that this is possible. Well, it really is to check quickly the weight of the remaining filament on the spool and to get rid of the necessity of a separate LCD (space and design concerns...). So it would be sufficient to have the value displayed before the print starts. 

    Would you mind pointing me a little bit more detailed in the right direction on how to implement that, please?

    Thanks a lot!
  • Best is to write it as wizard or quick command. Completely untest, just to get a feeling.

    @set global.spoolWeight {{get_json(http_get("http://192.168.1.22/your_url"),"/data")}}
    @dialogStart "Spool weight: {{global.spoolWeight}}" "Weight"
    @dialogButton "Close" 

    First line queries the url and gets a json object where the content is in data field, which we extract with get_json and store it in global value spoolWeight. The rest is opening a dialog and adding some text including the spoolWeight value.
  • Repetier said:
    Best is to write it as wizard or quick command. Completely untest, just to get a feeling.

    @set global.spoolWeight {{get_json(http_get("http://192.168.1.22/your_url"),"/data")}}
    @dialogStart "Spool weight: {{global.spoolWeight}}" "Weight"
    @dialogButton "Close" 

    First line queries the url and gets a json object where the content is in data field, which we extract with get_json and store it in global value spoolWeight. The rest is opening a dialog and adding some text including the spoolWeight value.
    Good evening!

    Many thanks, that helped and I can confirm it is working :) Very nice, I am really happy to have purchased the Pro license... Super product and good support!
Sign In or Register to comment.