Simple Remote Control Via URL


#1

Here is a simple piston which can be used by any external service capable of making HTTP calls, from simple bookmarks saved in your phone browser / on your desktop to software packages like Blue Iris or other home automation platforms etc.

With this piston you can control any device by quoting the device name in the URL, so no need to hard code devices into separate pistons.

Find the piston URL here:

image

Then add the following to the end of the URL:

?device=device_name&request=on (or request=off)

If your device name includes spaces or special characters, you will need to URL encode the name, for example “D - Kitchen” would be encoded to “D%20-%20Kitchen”

i.e. ?device=D%20-%20Kitchen&request=on

You can use an online encoder to make this simple:

https://meyerweb.com/eric/tools/dencoder/


Stringify type http trigger in Webcore
[Resolved]Execute reusable section of code (subroutine) based on event/conditional/device state
#2

Now with set level option:

Example:

Add the following to the end of the piston URL:

?device=D%20-%20Kitchen&request=dim&level=72

This will dim “D - Kitchen” lights to 72%


#3

I may have to borrow this. I’ve got an EventGhost + Piston operation that turns on my desk lamp when I unlock my desktop and turns it off when I lock it again. That would combine my On and Off pistons into one and allow me to turn other switches On and Off by URL too. Very Nice.
One of the advantages of using an interpreter-based language like this is that you can get away with stuff like
device device={$args.device};


#4

This is brilliant! I have never tried setting a device variable via arguments before, but I like this very much!

Thanks for sharing!!


#5

As requested by @bwarman on another thread, I’ve added options to wait until a specific time or wait a specific duration:

Arguments in the URL can be as follows:

  • device=URL_Encoded_Device_Name
  • request=on, off or dim
  • level=1-100
  • delayType=until or wait
  • time=time_in_24h_format or duration_in_seconds

Examples:

Set ‘D - Kitchen’ to 50%:
?device=D%20-%20Kitchen&request=dim&level=50

Set ‘D - Kitchen’ to 25% in 70 seconds:
?device=D%20-%20Kitchen&request=dim&level=25&delayType=wait&time=70

Turn on ‘D - Kitchen’ at 4:30pm:
?device=D%20-%20Kitchen&request=on&delayType=until&time=16:30


#6

Just curious Robin… If there is a device currently waiting, does that mean that other devices cannot be controlled in the meantime without messing up the WAIT?


#7

By default yes, but if you change the ‘piston execution parallelism’ to ‘enabled’ in the piston settings, then multiple triggers will spawn multiple concurrent waits.

I’m not 100% certain if this will mess up the existing $args.device value though… have fun testing that one lol! :crazy_face:

For the benefit of others, this setting is accessed by clicking on the piston name whilst in the editor, then the cog symbol.


#8

So I did a quick test… parallelism enabled does not help… if you change any of the $args, only the last sent values are used.

I guess you would need to store the various $args values in variables, so each parallel execution can refer to the original $args values, not the newly updated ones.

Leave that one to you @WCmore

EDIT: Storing $args does not work either… they get overwritten… will need to store an array of values, and a counter for each execution so the correct position in the array can be called back… more than I can be bothered to do lol


#9

LOL. I think I will leave out the extra code for the WAIT.
IMO, piston “69q0” is much more elegant & useful without it,
so any (all?) devices can be controlled with that one piston.


#10

I agree… waits can be processed on the device / software sending the request.


#11

For anyone looking for a use case for this, I’ve setup two iOS shortcuts to disable my Arlo cameras for a certain period of time or until a certain time or day. When running the shortcut I am asked for either the amount of minutes to disable them or the time to turn them back on (dependent on the shortcut run), and that number is then passed at the end of a Webcore URL request in my shortcut. I can post a screenshot of my shortcuts, if anyone else is interested.
I’m not sure why NetGear still hasn’t hopped on the shortcut bus yet, but this is actually a more powerful solution than they would have come up with.


#12

I have been experimenting with a wifi ESP8266/arduino device sending status to webcore like this…

URL/execute/Arduino1?motion=active&door=open&temp=75&humidity=50&pump=on

Ultimately wanted to use this device at another house (which doesn’t have SmartThings) to keep an eye on the failing sump pump.


Stringify type http trigger in Webcore
#13

Kevin, What Command are you running in webcore to disable and resume your Arlo cameras. I have not been able to get this accomplished. If I can I will then emulate your iOS short cut. Can you share your piston?


#14

I think you were referring to me when you wrote this. If you’ve added your Arlo cameras to Smartthings and Webcore then they should show up there. You then just turn them “off” or “on”. I would rather the ability to Arm or Disarm, but Samsung doesn’t give us that ability.


#15

bwarman, Thanks. I tired on and off sometime ago, but did not work for some reason. I tried a test this morning and seem to work without issue. Agree Arm and Disarm would be much preferable, but I am just turning 2 of my 3 cameras off when my wife or I am at home, and then turn on when we are all away.


#16

@millsjq, yeah, I’ve had spotty reliability with any type of API calls to Arlo. I used to use Stringify to control my Shortcuts and that wouldn’t always work either. I’ve noticed that it seems less likely to turn off/on when there is activity being recorded on one of the cameras. If I turn them off because I’ve gotten an alert, I almost always check to make sure they’ve all turned off.


#17

Thanks for the additional info. I also was using Stringify and with Arlo, had greater reliability and options. In almost all other areas Webcore give me more flexibility.