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!
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
- http_get(url)
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.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 codedata
for the response body. Normally a positive answer has the status code 200.Would you mind pointing me a little bit more detailed in the right direction on how to implement that, please?
Thanks a lot!
@set global.spoolWeight {{get_json(http_get("http://192.168.1.22/your_url"),"/data")}}
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.
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!