Setting value of Virtual Temp Sensor

I have a piston that averages all temperature sensors if any of them change, and stores it in a global variable. That part works great.

I am then trying to set the value of a virtual temperature sensor (named “Average Temp”), but it never changes. When I look at it in “Things”, it still has a null value. What am I missing?

My guess is that it has something to do with the variable being a decimal. Can you make it just a whole number and see if that works?

Tried it with @avgTemp being a number instead of decimal, but it’s still not updating. It looks like the only way I can change the temperature of a simulated temp sensor is by doing it manually with the +/- buttons in the tile.

Any other ideas on how to get a global variable (average temperature) to show up in a device, so that I can display it in SmartTiles?

EDIT:

I can change the value of the simulated temp sensor if I use Level% instead of temperature, which is odd (it also truncates the decimal part of @avgTemp, instead of rounding it correctly).

Anybody know why this is? Is there a new DTH for the simulated temp sensor that fixes this, or is it an issue with CoRE?

@ady624 ?

I expect that a virtual temp sensor is not meant to be set… it’s a sensor not an actuator…

So I’m not sure it’s a bug, but you are just trying to use it for something it’s not intended, if you can find a DTH for it, it should be fairly easy to add the functionality to set the temperature as you would with a Thermostat DTH, rather than a temperatureMeasurement DTH

1 Like

Being that it’s simulated, I would think that it should definitely be able to be set… since it can’t get the temperature any other way. :slight_smile:

I would assume the intention is to use the buttons as you describe to manually set… as usually this is for use in the simulator in IDE…

Maybe (and I see your point), but why does CoRE see “temperature” as an attribute for the device, and have a method to set it?

And why would I be able to set it using the “level %” attribute, but not “temperature”? That doesn’t make any sense at all.

I suspect it’s a non official capability in CoRE… perhaps used by some custom DTHs

I suspect what you are calling isn’t in this list below, if that’s the case this then becomes dodgy ground…

http://docs.smartthings.com/en/latest/capabilities-reference.html

I suspect then in the absence of an official setTemperature, that setLevel is used, and I have a feeling I remember seeing this elsewhere, possibly with how Alexa works, set level and temperature are inter-operable…

If you can find the DTH for the device you are using, I could update it though to include whatever CoRE is parsing…

1 Like

So have done a little homework for you… :slight_smile:

setTemperature(value) is supported in the DTH, but doesn’t exist in CoRE probably for the same reason as detailed in my previous post… you could add the command yourself, but updating CoRE will remove this. I think your best option is just to use setLevel, which I assume isn’t an issue?

DTH below:

also on my hunt… you may want to look at the below as there are a couple of smartApps doing exactly what you want to do:

2 Likes

Look at the DTH in the following thread, you can probably modify it so you can have CoRE update the virtual temp sensor using a web call.

2 Likes

You guys are alright, no matter what everyone says about you. :slight_smile:

The set level approach seems to be working ok, so I’ll probably just run with it…especially since both CoRE and SmartTiles are going to be obsolete sooner than later with webCoRE and Action Tiles just around the corner. And, who knows how they will deal with it.

Thanks for the help!

3 Likes