HI Todd, Is it possible to allow the Hostname to be used in HTTP Requests, instead of the IP Address?
Specifically from automations/routines.
I have a Raspberrypi which get allocated a different IP address occasionally.
HI Todd, Is it possible to allow the Hostname to be used in HTTP Requests, instead of the IP Address?
Specifically from automations/routines.
I have a Raspberrypi which get allocated a different IP address occasionally.
Iām afraid not; there is no name server running on the hub, so it knows nothing of host names, and I donāt think the HTTP library would even accept them (although I donāt recall if Iāve even tried it or not).
Canāt you configure your router to assign your Pi a static IP address?
Ok. Good to know Iām not missing something.
Ok, Iām trying to utilize this for the first time with a Denon receiver. The command
http://192.168.x.xxx/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/-45.0
works in a web browser. But when I then put it into a slot on the Requestor as
GET: http://192.168.x.xxx/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/-45.0
and attempt to run it, it returns the error āNot Configuredā.
The address Iām trying to hit is on my local network. What am I missing?
Hey there @TAustin,
Thank you for all your time and hard work on your edge drivers and in these forums. Iāve been following/using your drivers for some time and they work great!
I just had 2, (hopefully very quick) questions about this driver that Iām completely stumped on, unsure if Iāve hit a limitation here
Firstly, Iām hoping to use an API that uses temporary tokens for authentication. Iāve got a ST Device to request token and another to use the token but is there any way to use variables in the headers so I donāt need to manually copy paste the token?
Secondly, the page Iām looking at getting data from (undocumented Asus router webpage) doesnāt use proper json format Iām guessing this means I canāt extract the key values but thought Iād ask in case thereās a fancy trick to it! It looks similar to json but I donāt recognise the format so Iāve included the raw http response below in case you are familiar with it:
fanctrl_info = ; curr_cpuTemp = ā66.040ā; curr_rxData = fanctrl_info[3]; curr_coreTmp_2 = fanctrl_info[1]; curr_coreTmp_5 = fanctrl_info[2];
For this one, I think I saw a similar reply earlier in this thread. See if it works by adding a port as your browser will do this automatically. By default, http is port 80 so itāll likely be:
GET: http://192.168.x.xxx:80/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/-45.0
Turns out the solution is to, instead of using Web Requestor 1.2, go with Web Req Multi Master. It works in that utility.
But Iām going to keep the Requestor 1.2, as a ārepositoryā for the requests Iām utilizing in individual http switches.
<<>>>
Fixed my issue 10 seconds after posting
FYI - Web Requestor 1.2 is mighty old and has been replaced by the multi master version. It may still be out on my channel, but at some point you might want to get your automations transfer over.
Yea, thatās a tough one since SmartThings doesnāt support variables and I really have no way to implement them like the old webcore app. There IS a way to dynamically create your web requests using Rules. Iām not sure if there would be a way to pluck the token out of some other deviceās field and use it to build your URL in a ruleā¦ probably not. For what you are trying to do, you may need to accomplish it outside of SmartThings, if thatās an option for you. For example, if you have an always-on PC or Home server or Raspberry Pi or similar, you could better achieve what you are trying to do through use of the SmartThings RESTful API.
Yea, unfortunately I donāt have any tricks to help you. That definitely is not JSON and would need a custom parser to extract the values.
Thanks for taking a look at that one, @TAustin!
Thatās good to know, I will research up on rules and/or see what alternatives there are out there.
Iām using this utility to treat a Denon surround AVR as a multi-zone system. Iāve been doing that anyway, but this is the finishing touch. I created two Multi-Requestors; this is necessary because a device attribute can only be called once per routine. One Requestor is labeled ON-LEFT and the other OFF-RIGHT.
The Denon is set up as 5 + 2. Center in the bathroom, fronts in the dining room, surrounds in the garden. (2nd zone in the basement is a fully independent zone.) The Routines are in ST, and of course are exposed to Alexa as āscenesā. So if I say āturn on garden muteā, each of the Requestors is called. And each sends a goform/formiPhoneAppDirect.xml? GET to the correct IP address to change the appropriate left and right levels. -12 is mute; 50 is normal.
I will likely soon do Alexa routines for these. Because āAlexa, turn off dining room muteā is far more cumbersome than āAlexa, unmute dining roomā.
Awesome use of the driver! Thank you for sharing your setup.
Thanks! The other thing Iām going to do is assess which of my automations makes the most http calls, and then create that number of these Requestors. Iāve already created 15 separate http switches; using Requestors instead will likely allow me to at least halve that once I delete the switches. Always have to keep the device limit in mind nowadays.
Hi, my name is Jacinto.
I have a question. i do add an device scanning on my smartthings hub, but it does not show the device Web Requestor and i have it on the channel and edge driver install.
Thanks for your response.
First, be sure you have this driver:
Web Requestor Multi v1.2
Version 2023-01-17T16:50:07.623400032
Then after youāve done the Add device / Scan for nearby devices, be sure youāve checked all your rooms for the new device - it should be in whatever room your SmartThings hub device is in.
@TAustin Iāve currently got your Web Requestor driver set up and working correctly to start and stop an HTTP device (Hue Sync Box but thatās not relevant). I am trying to configure the same using the HTTP Devices driver but running in to a problem I canāt resolve.
Hereās the Settings for the ST device:
When I tap on (and off) I am getting this:
2024-02-20T21:38:18.067187488+00:00 TRACE HTTP Devices V1 Received event with handler capability
2024-02-20T21:38:18.103750321+00:00 INFO HTTP Devices V1 <Device: db0e572b-4d9d-4958-a9e1-5a3ac88e751c (HTTP Switch)> received command: {"args":{},"capability":"switch","command":"on","component":"main","positional_args":{}}
2024-02-20T21:38:18.209654405+00:00 TRACE HTTP Devices V1 Found CapabilityCommandDispatcher handler in thisDriver
2024-02-20T21:38:18.213652572+00:00 INFO HTTP Devices V1 Switch triggered: on
2024-02-20T21:38:18.254148947+00:00 INFO HTTP Devices V1 <Device: db0e572b-4d9d-4958-a9e1-5a3ac88e751c (HTTP Switch)> emitting event: {"attribute_id":"switch","capability_id":"switch","component_id":"main","state":{"value":"on"}}
2024-02-20T21:38:18.270363405+00:00 INFO HTTP Devices V1 SEND PUT COMMAND: https://192.168.254.68/api/v1/execution
2024-02-20T21:38:18.283776155+00:00 INFO HTTP Devices V1 with body: {"syncActive":true}
2024-02-20T21:38:18.288677072+00:00 INFO HTTP Devices V1 with headers: Authorization=Bearer <redacted>
2024-02-20T21:38:18.296511780+00:00 DEBUG HTTP Devices V1 HTTP Switch device thread event handled
2024-02-20T21:38:18.300823238+00:00 ERROR HTTP Devices V1 HTTP Switch thread encountered error: [string "init.lua"]:227: attempt to index a nil value (global 'key')
Can you tell what I may doing wrong?
Hi. Let me review the code for that error and Iāll get back to you.
BTW, do you have in device settings for HTTP Request URL Scheme set to āSeparate State URLsā?
UPDATE: It looks to be related to the header you have configured. How long is the bearer token and does it contain any special characters?
I do, yes.
Itās 210 chars and it does have characters such as / =
and .
Note it does work in the Web Requestor driver. At least I think it does. Iām actually running in to some issues there now, I have a single Web Req device with slots 1 and 2 working yet slots 3 and 4 do not with the same info (getting a 401 error suggesting an issue with the token). And as a test I tried creating a new Web Requestor device and replicating the working code from slots 1 and 2 and that does not work either. That has me confounded. Slots 1 and 2 on the original Web Req device continue to work. I thought maybe a copy and paste error but I cannot see it.
Ok Iāll try to reproduce the issue here.