Variables and WebCoRE

Yeah, plenty there to play with on the current front.

1 Like

We also added some HTTP Request features for power users to the latest beta. We haven’t announced / documented these features yet, but they’d allow you to bypass the need for a Momentary Switch since WebCoRE has the option to trigger a Piston via HTTP.

In your WebCoRE piston, you’d copy the “External URL” (Right Click → Copy Link Address):

Then anywhere that you can use a Hyperlink in SharpTools (eg. a Hyperlink Tile or in the action for a Media Tile), you can use a special syntax for the URL which tells the system to make the request without actually opening the page in a new window:


For example, here’s a dashboard with:

  1. Hyperlink Tile (Decrease)
  2. Media Tile (Current Value, Tap to Reset)
  3. Hyperlink Tile (Increase)

Syntax for other HTTP Methods




$.post("", { "mantra": "This is the way"})


$.put("", { "catchphrase": "I have spoken"})



Note that the PUT and POST requests support an optional payload to send with the request.

Edit: And here’s the topic showing how you can display WebCoRE variables in SharpTools (what the media tile is doing in the screenshot above):

How To: View WebCoRE Variables in SharpTools Dashboards

LOL. Just when you think you have it nailed, @josh comes out with a cool new feature!!!

Sweet! :grinning:


Well I’ve got it working with @Bry’s solution. Seems to be ok. I followed another tutorial on here for displaying the target. It’s a bit laggy using that image thing but it’ll do for now. It works so that it will only come on when motion is detected. It’s my other half’s domain. She does arty stuff and has a kiln out there but isn’t out there all the time. So the heater comes on for 30 minutes every day just to keep things from getting damp. If motion is detected then the heating will stay on until it reaches whatever target temperature she sets. I’ve got it all working on one piston to write the variable, do the ‘put’ to, read it back, set a global variable, copy it to a local variable, etc. All untested at the moment but I’m confident :wink:

I’m going to move a tablet out there so I might put the beta on that one and try @josh’s method. I wonder if it’ll work with Alexa? Firing the virtual button would probably be OK but it would be neat to be able to write a value straight to WebCoRE with a voice command.


That’s the one I followed. It would definitely be nice to be able to just pull the variables directly from WebCoRE though.

Glad to hear you got it all working. That sounds like a really neat setup.

Is the goal of pulling directly from WebCoRE reducing the lag? I would think the lag would primarily be related to the refresh interval that’s chosen for Media Tile.

As far as I’m aware, WebCoRE doesn’t expose an API, but even if they did we would still likely have to poll periodically, so I don’t know if that would solve the lag.

Instead of using WebCoRE variables, another approach is to use an attribute on a custom virtual device. When device values are changed, those subscribed events are immediately pushed over to SharpTools and down to your browser.

The HTTP stuff all happens directly in your browser, so it won’t work with Alexa… but if you are using a Virtual Device then you could definitely use that in Alexa (as long as it’s a supported type like a switch, etc.)

In this particular setup, I’m wondering if a Virtual Thermostat doesn’t make more sense? It would show up in SharpTools like a thermostat control meaning you’d see the temperature in the center and the ability to directly adjust the temperature up and down quickly and easily (a much smoother user experience).

You could still use the temperature attribute in WebCoRE like a variable and would still have direct access to reading and changing the temperature as if it were your target temperature.

1 Like

Yes, I’ve got the refresh interval set to 10 seconds at the moment. I’m not sure of the AUP on Could I set it to 1 second?

I did think about the virtual thermostat. I might play with that one a bit later.

1 Like

You could, but as you noted that’s probably pushing the limits of the intentions of and the myjson service.

The Virtual Thermostat is definitely a better approach with respect to refreshing the data as it doesn’t have to poll. The data gets pushed from the virtual device to your browser, so it’s much more efficient. :slight_smile:

1 Like

I tried adding it as a simulated thermostat but that just appears as a switch. I changed it to a thermostatdevicetile and it now looks like a thermostat apart from being in F rather than C.

Oh, and if anyone knows why I get access denied in Chrome when I’m editing or adding things in the ST IDE I’d love to know. I have to do it in an incognito window and keep forgetting :frowning:

I have a custom Simulated Heating Thermostat driver I used when testing heat only thermostats… let me see if I can find a copy and post it.

1 Like

Well, I’m pretty sure I have a simplified Simulated Heating Thermostat somewhere, but I can’t seem to find it at the moment.

In the meantime, I think this version should get you going:
(it’s a modified version of the SmartThings simulated thermostat, focused just on heating)

1 Like

Tried that and it seems to work a treat. The only thing I’m struggling with is the steps. On the tile, it uses 0.5 steps. If I set it to 18.5 then the variable in webcore gets set to 18 (even though I have a decimal variable type). Then, a few seconds later, the target temp changes to 18 as well. Not a hug problem as I just need to tell my other half to only use integers if she wants to set the temp but I’m wondering if there’s a way round it.

Let me double check the driver. I vaguely recall the SmartThings version of the driver tries to round to integers.

1 Like

I’ve updated the GitHub gist to simplify the driver a bit (removed all the nonsense about proposing temperatures and evaluating them as integers).

Can you try updating your copy of the DTH with the new version and see if that helps?

1 Like

Thanks, Josh, but sorry, the only difference I can see is that the target on the tile stays at (for example) 20.5 whereas the variable in WebCoRE is 20.

Unless you have a hunger to get to the bottom of it, I wouldn’t worry to much. It’s no real issue to tell the other half to use integers.

Oh, I even deleted the tile from SharpTools and re-added it. Just in case. I wonder if it’s a WebCoRE issue?

It might be at this point. The device driver was originally rounding to an integer when setting the value which I’ve corrected in the latest driver.

I’m not intimately familiar with WebCoRE, but I just tried setting up a piston and it seems to be setting my local variable as expected:

I changed the thermostat value to 20.5 in SharpTools…


Then over in WebCoRE, it looks like the Piston was triggered and the variable was updated as expected (as shown in the logs and in the variable section in the bottom right of the page:

1 Like

Thanks, Josh. So that proves it’s definitely something at my end. When I created the variable, I created it as an integer and then changed it. I can set it manually to x.5 in WebCoRE but maybe there’s something funny if you change the variable type. I’m going to delete the variable and add a new one with a different name.

1 Like

Well, that’s a bug!

Just added a new variable a decimal. Updated my piston and, as you can see, it’s now showing 20.5.


@andy, just wanted to let you know that we have released the Variables feature today, and it should support this scenario pretty well. You can define a number variable to be used in the rule for setting the temperature or as a trigger. This variable can also be added to the dashboard so its value can be adjusted by tapping the tile. See the post below fore details, and let me know if you have any questions.