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

Good news is this worked! Parsed the value and stored it in the dashboard item.
Now, I need to figure out how to
a) run the request on some frequency
b) put it into a temperature tile for actiontiles

1 Like

Any advice on this?

@TAustin Sorry if this isn’t the right place for this query but re your http devices driver, is there a reason why the dimmer device doesn’t have an on/off option as well as the dimmer?

I notice that the dimmer option from the vEdge Creator has both options.

It works! I’m surprised that such a tiny request would get chucked. :man_shrugging:

Is there any caveat for using this alt implementation? Cheers.

No particular reason other than keeping the individual devices simple.

If you have a need for a combined switch/dimmer device I can look at doing that.

Well that’s very interesting indeed. Thanks for letting me know.

Feel free to use the driver for now. I’m going to have to think about maybe including this code in my web requestor and HTTP Devices drivers and make using it a settings option.

It’s not clear yet how many devices are going to have similar issues. It’s only been a few so far.

What’s not making sense is that the GET request worked ok but not the PUT. They both would have been chunked the same way.

The Lua library for some reason has separate socket sends for (1) the HTTP start line, (2) HTTP headers, and (3) body data.

Perhaps put is different from get because put can have a body of parameters and maybe the lua implementation always makes multiple sends even when the body is empty


If you could that would be great.

My challenge is that in routines you can’t turn on a dimmer for a specific amount of time. But you can if there is also an on/off switch.

I’ve got a work around involving a virtual switch but it’s clunky.

Just to say thank you, I now have my amp control working with a series of commands using Rules.

I coded the requests into the rule itself because as you guessed the Yamaha API calls are POST requests that just have PUT in the tag for some reason.

Thanks for this.

For others that might have Yamaha amps, it would be nice for you to publish the rules you created in a separate thread noting the model number(s) that they would work with.

1 Like

Trying to understand why i cant use Web Requester Multi to send Get to Telegram API using this command as i can do it in sharptools.

GET:https://api.telegram.org/bot1111111186:AAFusx7Zg9_xxxxxxxxx4OTplzc/sendMessage?chat_id=-1000000011117&text=Hello World

It wont work as i changed the token
etc


Any idea?

Is it possible to include actual smartthings variables in the body (such as the devices status, temperature, etc)

Without webcore, there is no longer anything like variables available. You can accomplish some level of mirroring of device attributes using Rules.

If you want to send HTTP messages with specific device values, then have a look at my HTTP Devices driver. I’ll be adding more device types like temperature in about a week, and you’d be able to use a Rule to set values based on another device, and have the value sent in an HTTP message.

If you have a computer on your LAN that is always on, probably a better approach is to use the SmartThings RESTful API to grab the values on some periodic basis and then send them where you need to. It would take a very little bit of Python or nodeJS script to do.

Hey we do now have variables in SmartThings actually, take a look at @Mariano_Colmenarejo’s Aplicaciones Virtuales driver


1 Like

SharpTools.io Rule Engine has variables as well.

3 Likes

Okay, at risk of looking dumb in front of everyone and embarrassing myself, I have a stupid question. I am sure it must be something simple, so please go easy on me as I am just a novice trying to move everything over from webcore to keep SmartThings limping along.

It seems that others may have figured this out, but I have been trying to get it going for the past few days. I am trying to control the lights and sirens on my ip cameras, but am having trouble with the login and password required for all my cameras.

From a web browser, the following commands work just fine:

Light on:
http://login:password@192.168.1.100:80/cgi-bin/coaxialControlIO.cgi?action=control&channel=8&info[0].Type=1&info[0].IO=1

Light off:
http://login:password@192.168.1.100:80/cgi-bin/coaxialControlIO.cgi?action=control&channel=8&info[0].Type=1&info[0].IO=0

Siren on:
http://login:password@192.168.1.100:80/cgi-bin/coaxialControlIO.cgi?action=control&channel=8&info[0].Type=2&info[0].IO=1

Siren off:
http://login:password@192.168.1.100:80/cgi-bin/coaxialControlIO.cgi?action=control&channel=8&info[0].Type=2&info[0].IO=2

Reading through the other posts here, I took note of the fact that “login:password@ip:port” won’t work, and that others had found success with using “Authorization=Basic bG9naW46cGFzc3dvcmQ=” in the headers field.

Basic authorization works (HTTP Response Code 200) if I shorten my address to just the ip and port (http://192.168.1.100:80), but if I add the rest of the url, or any other working destination on a browser, Web Requestor gives me HTTP Response Code 401. :frowning:

Wondering if I should be including something different/more in the headers field, or if I somehow need to divide up the url and send it in chunks.

I downloaded the CLI and pulled logs (this is for the Light on command):

2023-02-16T01:42:30.742862751+00:00 TRACE Web Requestor Multi v1.2 Received event with handler capability
2023-02-16T01:42:30.750685168+00:00 INFO Web Requestor Multi v1.2 <Device: [my device id] (Web Req Multi Master)> received command: {“args”:{“value”:“1”},“capability”:“partyvoice23922.webrequestselect”,“command”:“setSelection”,“component”:“main”,“positional_args”:[“1”]}
2023-02-16T01:42:30.756605751+00:00 TRACE Web Requestor Multi v1.2 Found CapabilityCommandDispatcher handler in webreqDriver
2023-02-16T01:42:30.757349335+00:00 DEBUG Web Requestor Multi v1.2 Web request selection = setSelection 1
2023-02-16T01:42:30.758022543+00:00 INFO Web Requestor Multi v1.2 <Device: [my device id] (Web Req Multi Master)> emitting event: {“attribute_id”:“selection”,“capability_id”:“partyvoice23922.webrequestselect”,“component_id”:“main”,“state”:{“value”:“1”}}
2023-02-16T01:42:30.761320960+00:00 INFO Web Requestor Multi v1.2 SEND GET COMMAND: http://192.168.1.100:80/cgi-bin/coaxialControlIO.cgi?action=control&channel=8&info[0].Type=1&info[0].IO=1
2023-02-16T01:42:30.761933085+00:00 INFO Web Requestor Multi v1.2 with body: nil
2023-02-16T01:42:30.762825126+00:00 INFO Web Requestor Multi v1.2 with headers: Authorization=Basic bG9naW46cGFzc3dvcmQ=
2023-02-16T01:42:30.769476376+00:00 DEBUG Web Requestor Multi v1.2 Web Req Multi Master device thread event handled
2023-02-16T01:42:30.771547168+00:00 DEBUG Web Requestor Multi v1.2 driver device thread event handled
2023-02-16T01:42:30.820824376+00:00 INFO Web Requestor Multi v1.2 response code=<401>, status=<HTTP/1.1 401 Unauthorized>
2023-02-16T01:42:30.826406460+00:00 INFO Web Requestor Multi v1.2 <Device: [my device id] (Web Req Multi Master)> emitting event: {“attribute_id”:“httpcode”,“capability_id”:“partyvoice23922.httpcode”,“component_id”:“main”,“state”:{“value”:“401”}}
2023-02-16T01:42:30.830767501+00:00 WARN Web Requestor Multi v1.2 HTTP GET request to http://192.168.1.100:80/cgi-bin/coaxialControlIO.cgi?action=control&channel=8&info[0].Type=1&info[0].IO=1 failed with http code 401, status: HTTP/1.1 401 Unauthorized
2023-02-16T01:42:30.835818543+00:00 INFO Web Requestor Multi v1.2 <Device: [my device id] (Web Req Multi Master)> emitting event: {“attribute_id”:“response”,“capability_id”:“partyvoice23922.httpresponse”,“component_id”:“main”,“state”:{“value”:“–”},“visibility”:{“displayed”:false}}
2023-02-16T01:42:30.841853460+00:00 INFO Web Requestor Multi v1.2 <Device: [my device id] (Web Req Multi Master)> emitting event: {“attribute_id”:“keyvalue”,“capability_id”:“partyvoice23922.keyvalue2”,“component_id”:“main”,“state”:{“value”:“–”},“visibility”:{“displayed”:false}}
2023-02-16T01:42:30.850137960+00:00 INFO Web Requestor Multi v1.2 <Device: [my device id] (Web Req Multi Master)> emitting event: {“attribute_id”:“keynumvalue”,“capability_id”:“partyvoice23922.keynumvalue”,“component_id”:“main”,“state”:{“value”:-999},“visibility”:{“displayed”:false}}
2023-02-16T01:42:30.857481043+00:00 DEBUG Web Requestor Multi v1.2 Web Req Multi Master device thread event handled
2023-02-16T01:42:35.779228209+00:00 INFO Web Requestor Multi v1.2 <Device: [my device id] (Web Req Multi Master)> emitting event: {“attribute_id”:“selection”,“capability_id”:“partyvoice23922.webrequestselect”,“component_id”:“main”,“state”:{“value”:" "},“state_change”:true,“visibility”:{“displayed”:false}}
2023-02-16T01:42:35.780223750+00:00 DEBUG Web Requestor Multi v1.2 driver device thread event handled

Humbled for any pointers you all may have for me.

Hi there.

Are you saying that in this case you are including this in the header?:

Authorization=Basic bG9naW46cGFzc3dvcmQ=

Where did you get the authorization key to use here?

Thanks @TAustin,

Yes, this is an example of what I have in the header:

Authorization=Basic bG9naW46cGFzc3dvcmQ=

“bG9naW46cGFzc3dvcmQ=” is “login:password” encoded via base64encode.org. This is just an example/placeholder for use in this forum post, in my case I am using my actual login and password for my cameras encoded via base64encode.org.

Edit: I should have mentioned that my login and password do not have any special characters, just letters and numbers encoded to base64.

If you computed the key yourself, you might try issuing the exact same URL (with the login:password@ prefix) in a browser, and use the browser’s developer tools to inspect what Authorization header was sent. That would give you a way to sanity check the key. Not that I doubt your work :slight_smile:

EDIT: you should also verify that Basic authentication is in fact being used. You’ll be able to tell by looking at the WWW-Authenticate header on the 401 return.