As good as Samsung SmartThings is at putting all of your smart home devices into one control system, when you get down to automating your home there are still plenty of restrictions, making it harder to program the more in-depth ways of automatically managing your home.
Thatâs where Webcore comes in. A free add-on for SmartThings, this powerful system gives you a complete scripting language that lets you control your home exactly the way you want.
Explained: The best smart home ecosystems
Webcore can be a little intimidating for first-time users, but once you get your head around the basics, itâs surprisingly easy to build quite complex automations. In this guide, weâll help get you started.
How to install Webcore
Webcore isnât straightforward to install and requires you to access the online Samsung SmartThings IDE backend. From here you can install the main Webcore SmartApp. We recommend following the official Webcore installation instructions, following the GitHub Installation method.
Read the installation instructions carefully, as you need to follow each step. When you get to the section that tells you to use the SmartThings app on your phone, make sure that youâre using the SmartThings Classic app, not the new app. Once Webcore is installed you can use either version of the app, but the installation only works in Classic.
Youâll also be prompted to enter a password for your Webcore system, so make sure you pick something secure and that you make a note of it.
Connecting to your Webcore installation
The easiest way to program Webcore is through a web browser on your computer. Before you can do this, you need some information from the SmartThings app.
For the new app, go to the main menu and select Automations, then tap Webcore. For the SmartThings Classic app, tap Automation at the bottom of the app, then tap Webcore. For both apps, select Register a browser. This will display a four-digit code, which is valid for three minutes.
On a computer, go to dashboard.webcore.co and enter the four-digit code from your app, then click the > symbol. When prompted, enter the password that you created when installing Webcore and youâll be connected to your system.
Creating your first Webcore Piston
Webcore calls automations Pistons. Each Piston is a set of instructions that tells your smart devices how to operate. Weâll start by creating a very simple Piston that simply turns on a light. Click New Piston, then select Create a blank piston. Enter a name for your Piston that describes what it does, such as âTurn on a lightâ, then click Create.
Youâll see a blank page with two elements written in purple: 'execute' and 'end execute'. The list of instructions that you want to perform go between these two elements. You can see three options. An 'If' block lets you control devices based on the conditions that you set (the if part). An 'Action' block lets you control devices. A 'Timer' block lets you run commands at regular intervals.
Weâll start by controlling a device, so select Add an action. You can now use the device picker to select the devices that you want to control â you can pick as many or as few as you want. For this demonstration, weâre choosing a single Philips Hue bulb, so choose something similar (a smart light or smart plug are both good choices). Click outside the list to remove it from view, then click Add a task, which is a method of control.
You can select any of the options that start with the word âdeviceâ. For our Hue colour bulb, the commands include 'Turn off', 'Turn on', 'Set hue', 'Set level', 'Set saturation', 'Set color' and 'Set color temperature'. To keep things simple, weâve just gone with 'Turn on'. Click outside the list of commands to hide it from view, then click Add. You now have a very simple Piston that will just turn on your lights. Click Save to keep the changes and go to the Piston overview.
The Piston wonât do anything until itâs run, so click the orange test button. Your light (or other device) should turn on automatically, showing that your Piston is working.
Run a Webcore Piston automatically
So far, weâve just created a very basic Piston that doesnât do much unless run manually. The next step is to make a Piston run automatically. Typically, you want a Piston to run when something else happens.
For example, if youâve got a SmartThings Multipurpose Sensor, you could have a light turn on automatically when itâs opened, or you can use a Timer to have a light turn on automatically at night.
Read this: How to set up and use your Hue lights
Weâll show you how to modify the Piston that you created above. Open it up and click the Edit button, then click add a new statement and choose Add an if. Next, you need to select Add a condition, which specifies when you will run a command. Select the physical device that you want to check â weâve selected our multipurpose sensor.
Next to the device, you have to use the drop-down menu to select the option that you want. In our case, weâve selected contact, but the multipurpose sensor can also measure acceleration, orientation and temperature alongside some more complicated options that we wonât go into here.
Next, select the kind of comparison that you want. For this simple Piston, weâre going with the âisâ option under Conditions. Then, make sure that you select Value and open under the Compare to heading. This rule says, âCheck if the multipurpose sensorâs contact sensor is openâ. Click Add when youâre done.
We need to select what happens next, which is the âthenâ section of our 'If' block. In this case, we want the 'Action' that we already chose (turning on the Hue light), although this is currently in the wrong place at the top of the Piston. To move a block around, click the up/down arrow icon at the top of the screen: if you hover over the icon, youâll see the text, âAllow moving of items by drag & drop.â
Click and hold to the up/down arrows next to the word âwithâ in the script (this should be line 12) and drag down under the word âthenâ. When you let go, your action will have been moved.
The Piston is now complete and youâll see that thereâs an 'If' part (when the sensor is open), and a 'then' part (turn on the Hue light).
Click Save, then you can test your Piston by opening your multipurpose sensor (or controlling the device that will trigger the automation to run if you selected a different device).
Taking things further with Webcore Pistons
If you look back at our last Piston, the script has an âelseâ option. The âelseâ section runs if the first check fails, and doesnât require any validation. So, âif the multipurpose sensor is open then turn on the Hue light, else turn the Hue light redâ. In this case, opening the sensor turns on the light; closing it (or leaving it closed) makes the light turn red.
You can nest 'If' statements, too, giving you multiple checks. For example, âIf the multipurpose sensor is open, then if the multipurpose sensorâs acceleration is active, turn your Hue light onâ. This will only turn on the light if the sensor is open and moving.
If blocks donât have to use physical devices and you can use system 'Variables' to check for other conditions. For example, you may want to only turn a light on between sunset and sunrise when itâs dark when your multipurpose sensor is open. To do this comparison, you need a second 'If' block in the then section of the first one, where you check the current time to see if youâre after sunset and before sunrise.
To check the time, select the 'What' to compare element as a Virtual device and select Time. Then select the comparison as 'is between' and select 'Variable' then '$sunset', and then select the next option (âŚandâŚ) as a 'Variable' and choose '$sunrise'.
The action you want (turning on the light) needs to be moved from the first then section to the then section of your new time comparison 'If' block, so drag and drop it and you should have a script that looks like ours below. Now, save the changes, and the Hue light will now only turn on if the multipurpose sensor is open and the time is after sunset and before sunrise.
So far, weâve shown you how the building blocks work, but itâs worth looking at a more complicated Piston, which we use in a garden office thatâs fitted with a Yale Conexis Lock, Hue lights (inside and in the garden) and a smart plug that controls power to a Ring Stick Up Cam.
When the smart lock is locked, the Piston automatically turns the lights off in the office, turns the power on to the Ring camera and, if itâs after sunset and before sunrise, and the garden lights arenât already on, the garden lights are turned on for ten minutes then turned off automatically.
Essential reading: The best smart locks 2019
As you can see from the script below, the first check is to see if the Yale Conexis Lock changes to 'locked', not 'is locked'. Thatâs an important statement, as the Piston only runs when the Conexis Locks, not when it is already locked. With the former, itâs a one-off action, with the latter, the Piston runs every time the lock is checked and found to be locked.
In all cases, all of the Hue lights in the office are turned off, regardless of the time of day under the assumption that if the door is locked we want the lights off. As SmartThings can occasionally fail to turn all Hue lights off (sometimes the command seems to get lost and a stray bulb remains on), weâve changed the action to 'Turn off, Wait 2 seconds, Turn off, Turn off'. Repeatedly sending the 'Turn off' command means that we donât get a situation where one bulb is left on.
Next, weâve got a separate action, which turns on the Ring camera power. This flicks on the smart plug and the Stick Up Cam boots up and starts monitoring the office. Next, weâve got a 'Restriction', which you can see by selecting Options > View restrictions. You can only add a restriction after adding a new 'If' block or 'Action' block. 'Restrictions' let Webcore only run a block if a condition is met. You can use an 'If' statement to do the same thing, but a 'Restriction' makes the script a bit easier to read in some cases.
For us, the 'Restriction' is that the rest of the script can only run when the Hue ambiance spot 1 switch is off. This is a bulb thatâs in the garden, and our assumption is that if the light is turned on, somebody wanted the garden lights on already, so we donât want to disrupt that.
When the garden lights are off already, the next check makes sure that the time is between sunset and sunrise. If it is, we turn on all of the Hue lights in the garden (sending the command twice to make sure they come on). Then, we wait 10 minutes, then we send the off command twice to make sure that we donât have a stray bulb left on. This gives us enough time to leave the office, get inside and have the garden lights turn off automatically.
We have another Piston that works in a similar way, only it looks for the Yale lock to unlock. Then, the Ring Stick Up Camera has its power cut (we donât want to record ourselves working), and the lights are turned on in the office, provided that itâs between sunset and sunrise.
Webcore has some even more complicated options, including waiting a set time after thereâs no movement to perform an action, and even querying the TWC Weather Service, so that you can perform actions based on the predicted weather at your home. The main thing is to experiment. Luckily, the Webcore Community Forum has plenty of people that can help, plus example Pistons.