[ST Edge] Web Requestor: a driver to issue local POST and GET HTTP requests

This is great. Currently I have several routines that send a command using Web Requestor to my home theater system. This will eliminate that and I can just create a device for the various inputs. Thank you!

1 Like

@TAustin This is fantastic, better than I could of hoped for, really appreciate the long address fields, this has eliminated an Android server, not only are you a code machine, you’re also helping the environment!

1 Like

@TAustin This is great, it eliminates several routines and is a much cleaner approach. Thanks for all your work.

1 Like

I’m a very basic user, could someone explain or show me examples how to set this up, I’m unsure if it’s the IP address of the device I want to operate or my router/SmartThings hub

Also what additional steps do I need to take to send webhooks to say Tasker ( I am ok with the process of receiving webhooks at the Tasker end)

Many Thanks

If you have a device on your LAN that accepts HTTP requests for control, then you configure that device’s IP address into the device settings along with the rest of the URL that the device expects.

I’m not familiar with Tasker myself so hopefully others can comment on that.

You can’t really send webhooks to Tasker, as there is no endpoint. But there are ways to accomplish the same thing. I use Pushover, but for other options, see Getting Data to Tasker in Android.

2 Likes

It’s a shame that you cannot access Public URLs. It would be nice to be able to send requests to Public APIs for devices such as an Ecobee Thermostat. Today, the stock integration doesn’t support changing the thermostat’s program mode. The Ecobee Suite SmartApp alleviates that issue, but it will die when the Groovy platform is shutdown. If we could send to the Ecobee public API via HTTPS, it would allow for greater control via Routines when a stock driver doesn’t support certain functions.

If you have an always-on computer available on your LAN, you can get to external APIs with my edgebridge app.

1 Like

I do, but that’s just another failure point. Seems like we should have the option to allow access to public endpoints.

Well I suppose technically that’s true, but the reality is that SmartThings fails often enough by itself, and hubs require occasional reboots, whereas I have scripts like edgebridge running on Raspberry Pis that virtually never fail. I’ve got one that hasn’t even been rebooted in nearly a year :slight_smile: I truly believe that anything you are running locally is going to be way more reliable than SmartThings or its hubs.

1 Like

A motion device would be amazing. The current ST Blue Iris smart app has a callback piece. Basically it allows you to use other ST motion sensors to trigger Blue Iris motion and trigger a recording. While that function is a nice to have and your web requestor nails it, it would be awesome to have a switch/motion sensor with the web request capability so I could manually trigger the motion event.

It’s so much easier to manage than the web requestor. Some reason my brain quits working unless I process map it and that is too much like work.

Again, no rush and feel free to prioritize whatever else ahead of it. Thanks again!

1 Like

It will make a good test case for a third type of value to be sent:

  1. commands (switch, button, alarm)
  2. variable attribute value (dimmer)
  3. fixed attribute value (motion: [active | inactive])
1 Like

@Rodd62 @Alwas @RJGill84 and anyone else interested in the new HTTP Devices driver:

I’ve added both motion and contact devices to the HTTP Devices driver.

  • Both these devices also include a switch to control the motion/contact state.
  • The motion device includes an option to auto-revert back to no-motion after a set delay.

Updated Driver version is 2022-11-12T23:15:23.867623154

In order to see the new device types in the Select & Create button list, you will have to first delete your existing creator device, then perform an Add device/Scan for nearby devices to create a new one. Then you should see the Contact and Motion types included in the list. And don’t worry about doing this - it won’t affect your other existing HTTP devices you already created.

Give it a try and let me know if you have any problems!

3 Likes

Thank you! This is amazing! You even seemed to have humored my indecisiveness with including and option to send a http request after auto-revert (I didn’t ask because I wasn’t sure I’d use it).

I think with this now I can wholly shut down my groovy Blue Iris smartapp.

Once again, you’ve made the seemingly impossible, possible.

2 Likes

All - There has been an update to the webrequestor driver. This update contains the following changes:

  • supports more complete extract key specification, including support for array indexing (@Adam_Smith)
    • Please be aware that you may need to update your keys to a more complete notation with this driver update. Previously, in Settings, you only provided a single simple key name which was searched for anywhere in the response data (JSON or XML). Now you must provide the complete dot-notion including indexes if needed. (e.g. response.states[2].value). Array indexes start at 0 for the first element.
    • removed 36-character limit for extraction key Settings field
    • fixed ‘Extracted Key Value’ field label on Controls screen, although this might only be seen on newly created webrequestor devices.
  • ‘Create new device’ button label on Master device should now be corrected for everyone
  • automatically replaces any spaces in the configured URL with ‘%20
  • adds a new method for initiating on-the-fly requests via the RESTful API device command, where you can provide URL, body, and headers in the argument list (in that order). Use the new partyvoice23922.apiwebrequest capability. (@joshua_lyon)
  • fixed a nasty bug where if you made Settings edits to your URL request string, the configured body and headers may no longer have gotten sent with the request unless you edited them both as well (@Gusfmm, thanks for helping to verify this problem)

Latest Driver Name: Web Requestor Multi v1.2
Latest Driver Version: 2022-11-18T03:15:16.627903479
Channel Invite: SmartThings. Add a little smartness to your things.

6 Likes

Thanks you!!!

1 Like

hi one of my requests has stopped working , so i copied the request to number 5 of the pre made requests and it works fine, but not on number 1 i get

? Select a driver. 15
2022-11-19T19:53:49.683378190+00:00 TRACE Web Requestor Multi v1.2 Received event with handler capability
2022-11-19T19:53:49.688619485+00:00 INFO Web Requestor Multi v1.2 <Device: 2240bac9-3e85-4ee5-8e92-30559530887f (Web Req Multi Master)> received command: {“args”:{“value”:“1”},“capability”:“partyvoice23922.webrequestselect”,“command”:“setSelection”,“component”:“main”,“positional_args”:[“1”]}
2022-11-19T19:53:49.699848076+00:00 TRACE Web Requestor Multi v1.2 Found CapabilityCommandDispatcher handler in webreqDriver
2022-11-19T19:53:49.702814259+00:00 DEBUG Web Requestor Multi v1.2 Web request selection = setSelection 1
2022-11-19T19:53:49.706218431+00:00 INFO Web Requestor Multi v1.2 <Device: 2240bac9-3e85-4ee5-8e92-30559530887f (Web Req Multi Master)> emitting event: {“attribute_id”:“selection”,“capability_id”:“partyvoice23922.webrequestselect”,“component_id”:“main”,“state”:{“value”:“1”}}
2022-11-19T19:53:49.724844405+00:00 INFO Web Requestor Multi v1.2 SEND GET COMMAND: http://192.168.0.107:1880/freezer
2022-11-19T19:53:49.728190898+00:00 INFO Web Requestor Multi v1.2 with body: -
2022-11-19T19:53:49.731437607+00:00 INFO Web Requestor Multi v1.2 with headers: -
2022-11-19T19:53:49.737270148+00:00 DEBUG Web Requestor Multi v1.2 Web Req Multi Master device thread event handled
2022-11-19T19:53:49.742166448+00:00 DEBUG Web Requestor Multi v1.2 driver device thread event handled
2022-11-19T19:53:49.746350563+00:00 ERROR Web Requestor Multi v1.2 Web Req Multi Master thread encountered error: [string “init.lua”]:176: attempt to index a nil value (global ‘key’)
2022-11-19T19:53:54.760049668+00:00 INFO Web Requestor Multi v1.2 <Device: 2240bac9-3e85-4ee5-8e92-30559530887f (Web Req Multi Master)> emitting event: {“attribute_id”:“selection”,“capability_id”:“partyvoice23922.webrequestselect”,“component_id”:“main”,“state”:{“value”:" "},“state_change”:true,“visibility”:{“displayed”:false}}
2022-11-19T19:53:54.824746678+00:00 DEBUG Web Requestor Multi v1.2 driver device thread event handled
listening for logs… done

Thanks for the log; looks like a possible problem in the driver. Will get this fixed today!

thanks
martin

You have a ‘-’ character in both your body and header fields.

For header, delete it and you shouldn’t get the error. I need to put a better guard on the code so it doesn’t throw an error, but rather ignores it for headers, since it’s not the correct format.

But for body, the ‘-’ character is perfectly valid and will get sent in the request.

You can either use TWO dashes or delete everything from those fields if you don’t want to use them. Either a double-dash or empty field will ensure they don’t get sent.

Thanks for reporting this!