Emulating a thermostat from a multi-sensor

Background: Google home doesn’t recognize sensors, just switches, buttons, and thermostats. What I’m trying to do is set up a sensing device (smartthings multisensor in this case) so that I can say “what’s the temperature outside?”

I’ve tried all of the thermostat device handlers, and they either don’t correctly read the smartthings sensor and report something other than temperature, or simply don’t read anything.

I know nothing about coding, but I can copy paste to create a new device handler and that basic sort of stuff. What I would really like is some way to have a virtual, simulated, or emulated thermostat that reads the temperature sensor component of the switch as a thermostat would so that Google home will recognize it and I can then ask about the outside temperature. We live in a weird area where the general Google answer just doesn’t cut it.

Appreciate any help you can provide!

I’ve been posting with another guy all week on exactly this topic!

Let me find the link… Y’all should collaborate.

Oh… Your use case is actually much simpler than the project below! But it’s not bad extra info.

So you’re saying Google Home only works with thermostats, not temperature sensors? That doesn’t sound right to me.

Correct - not sure how they decided what was going to be recognized. Maybe they weren’t expecting a use case for sensors… Although you can ask if a light is on, you’d think it would be helpful to be able to ask about a device (is a door open, etc).

The api is opening up this month, maybe they’ll start allowing full smartthings queries.

So after some trial and error, I’ve found something…

The device handler is “thermostat capability” but the problem is it reads in Celsius :confused:

Not knowing anything here, but I’d guess if you knew how that handler was set up, one could copy it and switch Celsius to Fahrenheit? Is that possible? Is that specific handler code known?

Thanks in advance :slight_smile:

Which Device Type Handler? Is the code in the SmartThings Community GitHub repo?

If it is an officially certified device, then that’s a bug… It should use the units of the Location settings.

If the source code is available, then you can make a personal copy and add units conversion.

Thanks for your help,
The selectable device type is “thermostat capability,” but I can’t find any more about it. I’ve tried searching github, but can’t find it. I’ve also tried making a custom device handler using a template but it’s one of the few that isn’t listed. I tried a general search and can’t find any useful information about it.

Surely it must be available somewhere? Who’s a good person to ask, given that it seems to be “official?” It’s in the standard list of devices to choose from, I surely didn’t add it :slight_smile:

It really seems to be the perfect option - the only thing other than changing from Celsius to Fahrenheit I’d want to do is change the polling frequency - it looks like it’s getting data every 5min, when every 15-20min would do. I assume more frequent polling kills batteries on non-hardwired devices?

Thanks for your help, I spend a lot of time (too much time really) helping people on other forums so I appreciate it. If you ever wind up with a Google home and need help, let me know!

I may have figured it out, very simply. Like I said - code is even more difficult than reading Russian for me. I’m a veterinarian :slight_smile:

All I did was find the handler for the actual device - a Smartthings multi-sensor. Copied that, and entered “capability"Thermostat” under the metadata info. Google Home now recognizes it and it’s in F^o. On top of that, it should be polling it at the same rate it would’ve for the multisensor. (maybe it was doing that to begin with - seems like it was only reporting when there was a temperature change)

I’m not home to check it out, but the temperature seems right and is climbing. This should work. I may want to play around with the tiles and values it’s giving out, but I can probably learn that with a little trial and error. Don’t really need to see the open/close status and all that, but a big temperature value might be helpful.

We’ll see how this goes. Thanks for your help to this point!

1 Like

Got it - was able to delete the tiles for movement, and open/close while leaving the temperature, battery, and refresh tiles.

It’s exactly what I wanted now!

1 Like

That’s definitely the right approach! Good job :raised_hands:.

This sort of mirrors what I am trying to do, I have CoRE turning my heating on and off, and monitoring temp sensor throughout the house.

Whilst it is working fine, it would be good to have visibility of the setpoint via ActionTiles, I have not yet found a way of getting this to work well, I have tried most of the suggestions above, in essence, I just want a Virtual Thermostat that is mirroring what is happening within the CoRE smartapp.

I’ll keep on trying and I post any solutions I come up with

Let me know where you are stuck (preferably by sharing a link to your code on GitHub…).

Be sure you are trying to implement Capability “Thermostat Heating Setpoint” in the “Virtual Thermostat” and you have implemented the associated Attribute and Command. If the Attribute exists, ActionTiles will display it. If the Command exists, ActionTiles can call it.


Hi, I have this working now, thanks, what I am now struggling with is to get the thermostat to display current temperature as the minimum of a number of temp sensors, I can update the thermostat, its more getting the min value.

1 Like

I don’t do enough Groovy or Java programming to do this off the top of my head … but I bet someone knows and might chime in.

In the meantime, you can Google for “groovy java find minimum value in a map or collection” or similar such terms; the results might be very complex or easy. SmartThings doesn’t let you import special math and other data classes, but there some iterators are built in.

Here’s the Groovy sample that came up as a first result:

def money = [cents: 5, dime: 2, quarter: 3]
// Determine max entry.
assert money.max { it.value }.value == 5
assert money.max { it.key }.key == 'quarter'  // Use String comparison for key.
assert money.max { a, b ->
    a.key.size() <=> b.key.size()
}.key == 'quarter'  // Use Comparator and compare key size.
// Determine min entry.
assert money.min { it.value }.value == 2
assert money.min { it.key }.key == 'cents'  // Use String comparison for key.
assert money.min { a, b ->
    a.key.size() <=> b.key.size()
}.key == 'dime'  // Use Comparator and compare key size.