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

I’ve not tested with Windows 11, but if it works it works!

Now you can use webrequestor to send html requests to internet addresses. Follow the format specified in the documentation:

[GET | POST] http://<edgebridge IP:port>/api/forward?url=<URL string>

Yep that’s what I did and it did work. Thank you.

1 Like

I have been slammed but this is awesome, and I will test this out soon!

Using http:///cm?cmnd=status%201 as the webrequest to a Tasmota device, is it possible possible just to see / extract the Uptime value from the response?

I wish to use this in a routine to trigger if the device restarts?

Update: Found the link to the help, I needed to use “StatusPRM.Uptime” as the response key - works great thanks @TAustin

{“StatusPRM”:{“Baudrate”:115200,“SerialConfig”:“8N1”,“GroupTopic”:“tasmotas”,“OtaUrl”:“http://ota.tasmota.com/tasmota/release/tasmota.bin.gz",“RestartReason”:"Software/System restart”,“Uptime”:“0T08:33:10”,“StartupUTC”:“2022-12-17T05:56:58”,“Sleep”:50,“CfgHolder”:4617,“BootCount”:19,“BCResetTime”:“2022-12-11T11:13:02”,“SaveCount”:303,“SaveAddress”:“F7000”}}

Thanks,
Sam.

1 Like

I’ve configured settings for Web Request #2 and #3, but when I select web request to execute they respond 404 not configured.

I have a screenshot of the edgebridge4pi -d
I know the app communicates with the server because when I send web request to execute 1, the server complains Endpoint: /urlpath?parm1=xxx Not an API request.

I’ve got a screenshot from postman with this GET command, so I know smartthings can fetch the URL from the server

I must not be configureing the app with the proper GET command.

This is what I have programmed in Settings Web Request #2 and #3

GET http://10.0.0.3:8088/api/forward?url=https://api.wheretheiss.at/v1/satellites/25544




Simple error: you are missing a colon (:) after the method name in the device setting configuration. For example you should have:

GET:http://10.0.0.3:8088/api/forward?url=

I put a colon after the = sign but it didn’t work.

What is a method name.

This is what I put:
GET http://10.0.0.3:8088/api/forward?url=:https://api.wheretheiss.at/v1/satellites/25544

This is what I had before:
GET http://10.0.0.3:8088/api/forward?url=https://api.wheretheiss.at/v1/satellites/25544

Oh wait a minute.

Let me try GET:http
like you said

That worked. Now I get a HTTP Response Data,
but what am I supposed to do with it.

Is it supposed to display somewhere? Do I need to create a routine or something to see the data somewhere.

Oh wait. I found I could:

Create a routine that posts a Pre-configured web request

There is not a lot you can do with returned data given the limited functionality of SmartThings automations. If the return data is JSON, you have the capability of configuring a key to extract one value from the return data and then have an automation that triggers based on the value of that extract field. Please see the readme file for more info.

Todd, can I ask for a feature development request to your Forwarding Bridge Server for SmartThings Edge driver.

Can you make your driver have the option to send SMS messages in addition to forwarding HTTP requests to destinations outside of the LAN.

I found this thing called nodemailer, Node.js Send an Email.

With this feature we could send SMS or email from home LAN for 100% local execution.

The user could use their mobile provider’s email-to-text tool to send SMS or MMS.

For example, my provider is XFinity. To send myself an SMS I would send an email to MyPhoneNumber@vtext.com

Here is a partial list of provider email-to-text addresses. Sending emails to SMS or MMS

Here is the link and Example to nodemailer. Node.js Email

var nodemailer = require(‘nodemailer’);

var transporter = nodemailer.createTransport({
service: ‘gmail’,
auth: {
user: ‘youremail@gmail.com’,
pass: ‘yourpassword’
}
});

var mailOptions = {
from: ‘youremail@gmail.com’,
to: ‘myfriend@yahoo.com’,
subject: ‘Sending Email using Node.js’,
text: ‘That was easy!’
};

transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ’ + info.response);
}
});

Hi - thanks for the suggestion. FYA, this question probably belongs in the edgebridge topic.

But my question would be, why wouldn’t you use the built-in notification capability within SmartThings? What would be the scenario where you would use this feature through edgebridge?

I do have a Routine that is supposed to do that, but it doesn’t work. That’s why I started googling and found your site.

I have a smartthings groovy IDE smartapp called Elder Care that notifies my neighbor via SMS if I haven’t moved in 10 hours. It works.

SmartThings is going to pull the plug on IDE the end of this month, and then it won’t work.

I’ve been trying to make a routine work on smartthings app that monitors Echolink Motion Sensor, if No motion for 10 hours then Send text message. The problem is, it will only trigger once, and never again. It’s the same for the routine I made to monitor your edgebridge. If Status offine for 15 minutes, then send text message. It triggers once and never again.

I’ve also tried setting preconditions like member location to insure I’m home and not moving. Otherwise it would notify while I’m on vacation or away from home. I’ve also tried setting preconditions like certain times of day, say between 6PM to 10AM. Still the routine only triggers once. People tend to forget about a notification and need a reminder or two.

I’ve opened three tickets with smartthings tech support about this problem. They ignore me.

I thought having your Web Requestor with an SMS option would be good because the hub would not need smarthings.com to send the SMS. Everything could be done local, in house. I don’t like having to depend on third party apps and servers like IDE or IFTTT, if my raspberry pi can do it.

I’ve been trying three days to figure out how to make your edgebridge and Web Requestor do an Elder Care routine. I’m not a programmer. I was surprised when I got the Elder Care script installed on IDE and it worked.

I signed up for some online java training, but I’m old and slow. That will take some time.

If I can get the elder care routine to work I would also like to get Google Sheets logging to work with edgebridge. EdgeBridge is a great idea. Thanks for developing it.

Ah yes I saw and replied to your email. Take a look and get back to me there - I had a couple questions.

If it’s the email I sent at 12/25/22, 15:27 from trntrp. I don’t see your email in my inbox.

There’s a messaging app called “pushover”, it’s integrated with Sharptools, but I guess it’s possible to find other ways to use it.
The neat thing with pushover is, if your neighbor installs it on his phone, you can send him an actual alert message, that he needs to confirm before it stops reporting.

Hi. Apologies if I have missed or misunderstood something, but I can’t work out how to extract a value from a response and use it in an automation. Can anyone point me in the right direction?

Do you know the format of the data you are expecting back from the HTTP request?

The Settings field that you need to set up to get this to work is ‘Response key to extract’. Here you put the JSON key for the value you want to extract. So for example, if your response data is this:

{
  "data": {
    "key1": 123,
    "key2": 456
  }
}

And you wanted to extract the value of ‘key2’, then you would configure ‘data.key2’ in the Settings field called ‘Response key to extract’.

Now when you issue the HTTP request, that value will be extracted from the response data and placed in the field ‘Extracted Key Value’ that you see on the device Controls screen. You can test for values of that field in automations.

1 Like

Thanks for the super quick response.

I understand the process now.

The format of the data is

{“status”: “success”, “result”: [{“measurements”: {“time”: {“time”: “2023-01-05T18:31:41.858724Z”, “secondsAgo”: 6}, “temperature”: 20.1, “humidity”: 68.9, “feelsLike”: 20.1, “rssi”: -38}}]}

I’m trying to get the temperature. I’m guessing that is tricky because of the nesting in the response??

You just need to know JSON notation. If you want the temperature, then you should specify a key of:

result[0].measurements.temperature

It helps to format the JSON so you can see what the nesting is:

{
    “status”: “success”, 
    “result”: [ 
        {
            “measurements”:   {
                “time”:  {
                    “time”: “2023-01-05T18:31:41.858724Z”,
                    “secondsAgo”: 6
                },
                “temperature”: 20.1, 
                “humidity”: 68.9, 
                “feelsLike”: 20.1, 
                “rssi”: -38
            }
        }
    ]
}

Square brackets indicate an array, and in this case it is an array with only one element. Indexes start at 0.