-
Couldn't load subscription status.
- Fork 484
Description
Is your feature request related to a problem? Please describe.
Not a problem, but here's the context:
I want to drive my 3D printer with a cheap 433MHz plug.
I have a home automation system similar to Jeedom which controls about ten of these plugs, via a RFLINK gateway.
Describe the solution you'd like
Controlling a home automation system from a HTTP request is very simple, and this is what I wanted to add to ESP3D to simply turn off my 433MHz plug at the end of printing.
To do this, I didn't find anything in the current release. So I added in the Arduino code command.cpp a new custom command case.
Describe alternatives you've considered
I didn't find any simple alternative to control my home automation, then knowing that the ESP is connected to the home network it would be stupid to do without a simple request.
Here is the solution that I set up in command.cpp (as a beginner coder I specify, I have no pretension to say that it is optimized it is simply functional and it meets my need) :
Before the originals #include
#include <ESP8266HTTPClient.h> // PERSONNAL MOD
HTTPClient http;
after #endif and before case 700:
//HTTP Custom request [ESP666] URL=<url>
case 666:
parameter = get_param (cmd_params, "URL=", true);
if (parameter.length() == 0) {
ESPCOM::println ("Faut entrer une URL banane", output, espresponse);
return false;
}
http.begin(parameter);
http.GET();
http.end();
break;
I can now add to my gcode this command in order to launch a GET request:
M118 P0 [ESP666] URL=http://domotic-ip:8080/devicetype/4/exec?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxf&value=0
and this is turning off my plug 👍
We can then imagine an infinite number of scenarios
EDIT : I changed my scenario, now I intend to inform my home automation at the beginning of printing so that it blocks the wifi on if I go to bed, and at the end of printing to turn it off then, and also turn off the plug a few seconds later.
I haven't received my printer yet the only tests I've done are in serial, but it must be the same ;)
The only "problem" encountered is the disappearance of the end of the message after the "&" character in the link when I enter the order via the ESP3D web interface. I have no idea why, but when I enter this character it considers the command as finished, so everything else after this character is ignored. I was unable to identify the source of the problem.
This problem does not exist when using the serial console to send the command. Knowing that this is the protocol that the printer will use, it is fine with me.