Create temperature tile from other device

Hi . I’m pretty new to smartthings and still figuring things out.

I’ve been trying to figure out how to have my fibaro smokealarm also show up as a temperature tile in the smartthings app.

I can see the temperature if i click in on the smoke device, but I would like to have this show as a own device.

Can I create a virtual device from a existing one where I only show the Tile I want?

If anybody point me in the right direction I would appreciate it.

You should be able to change it in the tiles settings in the device handler on your regions IDE.

if your using a custome DH
in the metadata { section, look for main the Tile listed in there is what appars in the app first

But can I create an additional virtual device if I want the smokealarm aswell as the temerature as two different ones?

as far as i know you would need an app to take the subscribe to the temprature and pass it over to a “Simulated Temperature Sensor”

not a big job
done below, need ot test/see what data comes from the subscription befor sending it over to the device

Did it work ok??

1 Like

app

/**
* Copyright 2015 SmartThings
*
* Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
* Author: mark
* version 2 user defineable timeout before checking if door opened or closed correctly. Raised default to 25 secs. You can reduce it to 15 secs. if you have custom simulated door with < 6 sec wait.
*/

definition(
    name: "tempHandler",
    namespace: "Mark-C-uk",
    author: "Mark Cockcroft",
    description: "Simulated thermostats",
    category: "Convenience",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/garage_contact.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/garage_contact@2x.png"
)

preferences {
	section("Choose the thermstat to provide reading"){
		input "tempin", "capability.temperature", title: "temp provider", required: true
	}
    section("Choose the Virtual thermostat"){
		input "tempout", "capability.temperature", title: "temp reciver", required: false
	}
}

def installed() {
	installer()
}
def updated() {
	unsubscribe()
	installer()
}
def installer(){
	def Tin = tempin.currenttemperature
	def Tout = tempout.currenttemperature
    
    subscribe(tempin, "temperature", tempHandler)
	log.debug "updated ... temp of $Tin is $tempin and $tempout is $Tout"
    
//    if (Tin != Tout) { // sync them up if need be set virtual same as actual
//       tempout.temperature("$tin")
//	}    
}

def tempHandler(evt){
//testing
log.debug "$evt.unit"
log.debug "evt.value"    
    //tempout.temperature("$tin")    
}

DH
/**
* virttemp
*
* Copyright 2019 Mark Cockcroft
*
* Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*/
metadata {
definition (name: “virttemp”, namespace: “Mark-C-uk”, author: “Mark Cockcroft”, cstHandler: true) {
capability “Temperature Measurement”
}

	simulator {
		// TODO: define status and reply messages here
	}

	 tiles {
        valueTile("temperature", "device.temperature", width: 2, height: 2) {
            state("temperature", label:'${currentValue}',
                backgroundColors:[
                    [value: 31, color: "#153591"],
                    [value: 44, color: "#1e9cbb"],
                    [value: 59, color: "#90d2a7"],
                    [value: 74, color: "#44b621"],
                    [value: 84, color: "#f1d801"],
                    [value: 95, color: "#d04e00"],
                    [value: 96, color: "#bc2323"]
                ]
            )
        }
        main "temperature"
        details("temperature")
}
}

// parse events into attributes
def parse(String description) {
	log.debug "Parsing '${description}'"
	// TODO: handle 'temperature' attribute

}

def temperature (value , unit){
log.debug "recived $value, $unit"
sendEvent(name:"temperature", value: "$value °$unit")
}
1 Like

Hi Mark. When trying to configure the smartapp I don’t get to choose temp provider or temp reciever.

It says " You can’t currently add this"

Do I have to manually add them in the code?

Best regards
Are Strande

fixed, tested polished a bit

1 Like

Wow. Thanks Mark.

That did it.

Appreciate it.

Seems I was too quick there. It updated the temperature one time. And it has not done it after that. Is there a possibility to add a polling time?

Best regards
Are Strande

Check you are using my latest. I hadn’t finished it to send

My bad should be
subscribe(tempin, “temperature”, tempHandler)

Hi.
It seems to work fine now. Thanks Mark.

@mark_cockcroft I just sorta discovered your work with simulated devices (and I LOVE it!) and I set up the temp handler. It works great in the old app and if you tap on the device itself in the new app. But on the main screen of the new app, it always just says “checking status”. Have you run into this and/or do you have any suggestions?

As an aside, it also shows the celsius symbol in the new app even though the temps are in fahrenheit and I didn’t see any place to change this (not a big deal, just thought I’d mention it in case you had some thoughts about it)

@mark_cockcroft Great SmartApp and DH, exactly what I searched for.
But, I got the same problem in the New Smartthings App as @doncaruana.
The tile just shows "checking status, do you or anybody else have a suggestion how to solve it?

I jumped from ST about a year ago, with the new app they were making it harder and harder

1 Like

Ok, thanks for your reply.

Hubitat has much more flexibility

1 Like