Hello, I am new to the forums and smartthings development. I have added the unsupported Nest device, and it works great, but wanted a way to automatically set the status based on the location’s mode. I created a simple app to watch for the mode.
/**
* Modify Nest Presence with Hub Status
*
* Copyright 2014 Dan VanWinkle
*
* 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.
*
*/
definition(
name: "Modify Nest Presence with Hub Status",
namespace: "danvanwinkle",
author: "Dan VanWinkle",
description: "Modify Nest Presence with Hub Status",
category: "My Apps",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png"
)
preferences {
section("Change the status of the following Nest...") {
input("nest", "device.nest", required: true)
}
section("To home with the following mode...") {
input("presentMode", "mode", title: "Mode?", required: false)
}
section("And to away with the following mode...") {
input("awayMode", "mode", title: "Mode?", required: false)
}
}
def installed() {
log.debug("Installed with settings: ${settings}")
initialize()
}
def updated() {
log.debug("Updated with settings: ${settings}")
unsubscribe()
initialize()
}
def initialize() {
subscribe(location, locationChanged)
log.debug("Starting to update ${nest.displayName} to home with mode ${presentMode} and to away with mode ${awayMode}.")
}
def locationChanged(evt) {
def currentPresence = nest.currentPresence
if (currentPresence != "present" && presentMode == evt.value) {
log.debug("Changing ${nest} to home")
nest.present()
} else if (currentPresence != "away" && awayMode == evt.value) {
log.debug("Changing ${nest} to away")
nest.away()
}
}
Everything with this code works amazingly in the Simulator, and even works with my physical device. The problem occurs when I try adding the SmartApp to my iOS app, it does not list the physical nest device in the input options.
Is this a known bug or am I doing something incorrectly to make this work on device?
Yes, the nest does have the capability of Thermostat, but with the Smart app, I was hoping that I could limit it to a Nest (assuming that one day Smartthings will have a store similar to MCV’s).
I was able to install the smart app just fine through the Simulator, and it seems to be working somehow, even though it is not installed through the smartphone app.
Do you know if there is an issue tracker for smartthings?
@jthurston422, I have it working, but I still cannot add the app through my phone, I can only add it through the simulator. It is not able to see “device.nest”. I know that I could do what @stevesell suggested and change the code to read “compatibility.thermostat”, but the issue with that is that it would work on any thermostat, not just the nest, and the nest. A normal thermostat does not have the methods “away” and “present”, so this would be bad coding in my opinion.
preferences {
section(“Change the status of the following Nest…”)
{
input (“nest”, “capability.thermostat”)
}
section(“To home with the following mode…”)
{
input(“presentMode”, “mode”, title: “Mode?”, required: false)
}
section(“And to away with the following mode…”)
{
input(“awayMode”, “mode”, title: “Mode?”, required: false)
}
}
def installed() {
log.debug(“Installed with settings: ${settings}”)
initialize()
}
def updated() {
log.debug(“Updated with settings: ${settings}”)
unsubscribe()
initialize()
}
def initialize() {
subscribe(location, locationChanged)
log.debug(“Starting to update ${nest.displayName} to home with mode ${presentMode} and to away with mode ${awayMode}.”)
}
Technically, you could just install this smart app on each. You could however make a simple change to allow you to select multiple Nest devices then loop through them in the code.