How to use M118 to send http requests
-
Hi
I saw that a new feature in 1.21 is the support for the M118 code. With P3 one can send http request. Was thinking of using that to send requests to node-red, e.g. to inform that a print has finished.
However what should I put in the message string? Tried something like thsi and variants of
M118 P3 S"http://10.0.1.131:1880/hevo?format=json,1.1&name=test" but I get a blue response and nothing arrives at the the given server….
And what does a blue response to a G-code in the console means compared to a green one? -
Unfortunately M118 only is capable of sending a simple text notification to DWC (or one of the other types specified with P).
So no arbitrary HTTP requests.I'm using M118 to send a text notification via Telnet, which then triggers some other script which listens for it.
-
you could run a webserver on a raspberry pi and have the target of the m118 url be a cgi bin script to do more?
-
Unfortunately M118 only is capable of sending a simple text notification to DWC (or one of the other types specified with P).
So no arbitrary HTTP requests.I'm using M118 to send a text notification via Telnet, which then triggers some other script which listens for it.
That would work for me too. but what is the syntax of the message? how do I specify address and port (or is only 23 possible)
-
You don't specify an address or port. Use a PC to connect via Telnet to your Duet board. Then issue a [c]M118 P4 S"test"[/c] from DWC. Now your telnet client will receive the text "test" and print it in a newline - just like a serial interface.
-
aha the duet is the server…....OK thanks