HTTP Control of device on local network - HTTP request POST

Hi all,
I am trying to control a device on my local network via the HTTP request node and POST option - but getting the '404 page not found' error below, regardless what I try:

The control documentation for the device only provides the following instructions for HTTP control:

The device is already set to 'HTTP control' and I can successfully read parameters via the HTTP request node and GET option, the issue is only with writing/control (using the POST option).

This is one of the many arrangements that I have tried, but I am guessing a little here based on other examples I have found.

I have spent a few hours looking through the Node-RED documentation, various online videos and this forum, but unable to resolve the issue (there is actually not so much info about the POST option) - so would greatly appreciate any pointers.

Many thanks in advance, Mark.

I have found that if you can access the page from a Web Browser (I can only speak of Chrome or Firefox), go to Web Developer Tools | Network and look at the message sent when you access the page, this will hopefully give some indication of the requirements to access the page (Method, Headers etc.)

Are you sure it has to be a post? Do the docs say that? What happens if you put that URL in a browser?

Hi @Colin thanks for the reply.

No I'm not sure at all that it needs to be a 'post' command, that just seemed logical to me and I saw it used elsewhere - if you have another suggestion I am very willing to try it.

If I put in the URL of IP/control.html the following page displays

Hi @mudwalker, thanks for the reply and suggestion.
Yes I can access the web page at [IP]/control.html with Chrome browser and access the web developer tools - I have looked under 'Network' and reloaded the page but not too sure what to look for...

These are a few screen images, please let me know if there is anything of interest there.

Regards, Mark.

so did you try it with a GET instead ? using the .../control.html?power=n as per you initial config.

Hi @dceejay, no not for anything on the control page yet, only to retrieve data from the IP/data.jsn page. Let me try that now...
Regards, Mark.

Using the GET command and IP/control.html?power=n as the URL I basically get back what is on that web page - see screen image

And if I use only IP/control.html as the URL I get exactly the same response back.

Well I would expect n to be a number eg of some device or other... read the manual

I meant to use the url that the docs say, so http://IP/control.html?power=n where n is presumably a number.

Hi @Colin and @dceejay,
Yes 'n' is the desired power output - a number between 0 and 3000.

I just got it to work with the GET option and entering the desired power direct into the URL. I will make that work dynamically next. What would be the best way, using {{{payload}}} in place of n?

I actually tried this a little earlier but had no load plugged in, and because of that there was no feedback - the power always remained as 0 (despite receiving the command). Now that I plugged a load in the power as displayed in that page changes (and the load activates).

Thank you both very much, your help is greatly appreciated!

Regards, Mark.

Yes, but you can use 2 brackets rather than 3, that's to pass unencoded HTML and you don't need to do that here.

Thank you @TotallyInformation - it's all working nicely and I am happy now! :grinning:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.