Trying to use asynchttp to send a Post

Good afternoon.

I’m wondering if someone could please help me.

I’m trying to use asynchttp to post to a webserver running on an ESP32.

I’m using the following code:
def params = [
uri: ‘’,
path: ‘/fieldValue?name=power&value=0’,
body: null
], params)

Which should spit out the following http post string

I’m having trouble debugging as I’ve no idea if it is even generating the correct post.

Any help would be greatly appreciated.

edit: Please let me know if this isn’t the correct place to ask.

Couple of things:

  1. Try using Postman as your target and it’ll show you what’s coming in (or there are many other services available which can show you the incoming HTTP request).
  2. You may also want to remove the body from your code if you aren’t using it
  3. Most importantly this won’t work because http and asynchttp are executed on the ST cloud, you seem to be using a local LAN IP address, so the cloud can’t reach it.

You have ways to resolve this:

  1. Use your public IP/DNS and do a port forwarding in router to have the ST cloud reach your local device
  2. Use hubAction to communicate with your device. HubAction is routed through the hub and is primarily used to communicate with LAN devices:
1 Like

Dude, I could kiss you. Thank you so much. I’ve got it now working, thanks to you.

Perfect answer.

Switched to hubAction to keep it internal, and discovered a malformation in the post call. Fixed that and all is golden. Again, thank you so much.