I am trying to use Rule Engine to make a POST/JSON request to a local device (a WLED server on the local network). The command will turn the attached LEDs on or off. My problem, I THINK, is that the target URL has to be Internet accessible.
I can curl to make this work: curl -X POST -H "Content-Type: application/json" -d {"on":true} 192.168.0.175/json/state from my local network, so it makes sense that I can reach a private address.
The SharpTools rule engine is running outside of your local network and you will not be able to access a 192.168.x.x address (or any other private address) since it not on your local LAN. There are solutions to tunnel and then DNS, but a ābetterā solution would to run a local device handler on your hub. Are you running SmartThings or Hubitat?
Makes sense that the Rule Engine isnāt running locally hence needs an external address. But webCore isnāt running locally either and I can use a private address.
webCoRE does issue the command within the local LAN when using a non DNS address. It uses the hubAction class to have the SmartThings query devices local. Outside of the externally hosted web GUI, webCoRE itself is just a [very] well designed SmartThings application and has the same ability to issue commands from the hub just like any other purpose built SmartThings application.
Update: With the deprecation of Groovy, you may want to use the Web Requestor Edge Driver as the HTTP Button will no longer be available.
@Bry you may want to check out the HTTP Button device below as @Bloodtick_Jones allured to, which also uses hubaction to send local HTTP request, and you will just use the rule to trigger the button push to send the HTTP request locally.
IMHO - Probably better to use webCoRE similar to your test and hit the pistons external address with SharpTools. Since webCoRE is a ST application and not Device Handler it should be in viable longer as they depreciate groovy. The SmartThings team has indicated that applications will move later.
Thanks. Itās working in webCore, predicated on a switch turning on and off. Iāll revisit down the road as things deprecate. I was asking more for education sake. Thanks for the help!
@josh how come you canāt send Get requests like webCoRE that also runs in the cloud?
Have you thought about using HubAction to do it? Could you add it at some point in the future? Does this feature need voting on?
Iām looking into moving everything over from webcore and it looks like Iāll run into the same issue you did. What was your work around using web requestor?
Basically on a whim, I tried using Web Requester as a ādeviceā to access and send web requests on the local network, and unlike STās Routines, you can send more than one.
You can see the Web Requestor part. The rule is still incomplete, as itās too cumbersome and time consuming to finish. I have 10 radio switches that 9 need to turn off when 1 turns on, that then sends Radio URL to a speaker, and a local web request to a Raspberry Pi to change a media image on a dashboard. On webCoRE it took minutes, here Iāve only done 2, I would need a day to complete it. Very underwhelmed with Sharptools at the moment, itās like trying to drive a car whilst being in a straitjacket.
Something odd is going on with the screenshot, everything is on top of each other. I agree using sharptools is a bit cumbersome compared to webCore. It would help if they would let you select multiple devices at the same time.
Thanks for the info, I voted on the request. I currently have some automation that checks if the garage door was left open and then broadcast to my speakers in the home. I would like to move that over, would that work in sharptools.
Web Requestor has 5 slots that can be preconfigured with ābodyā data to be sent over with the request. But these donāt include a JSON ācontent-typeā header, which means it wonāt work with a lot of servers.
I submitted a request to either default to JSON or provide a configuration optionā¦ and also to expose the ability to dynamically send body content via the Web Requestor driver. It sounds like the device author has their hands full at the moment, but lets see what happensā¦