obycode
(Brice; SmartRulesApp.com)
September 28, 2015, 5:15pm
6
Ok, so first, you’ll need to create a virtual switch. You can find some info on that here:
Virtual / Simulated Device Types are functional “Things” but are not physical devices you have. Installing them allows you to control them via SmartApp’s just as you would a physical smart device.
Creating Virtual Devices - On/Off Switches
There are many reasons you’d have the need for a virtual switch.
You want one switch to control multiple other switches and/or commands.
You have a multi relay device and want to control the relays individually. (currently ST doesn’t support this)
You could use virtual switches the same way you’d use Hello Home Actions, to take care of multiple actions or state changes with the change of your virtual switch state.
To create a Virtual Switch
Login to the IDE @ https://graph.api.smartthings.com/
Click “My Devices”
Click the “New Device” Button
Ente…
Then you’ll need to create a SmartApp that has a switch and a thermostat as an input. Subscribe to the switch and when it is turned off, you’ll want to call the off()
method on your thermostat, and when it is turned on, you’ll want to call the auto()
method. Here is a good place for getting started with SmartApps:
http://docs.smartthings.com/en/latest/smartapp-developers-guide/index.html
If you prefer to learn from examples, you can look at this SmartApp which also subscribes to a switch and takes some actions:
/**
* 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.
*
* The Big Switch
*
* Author: SmartThings
*
* Date: 2013-05-01
*/
definition(
name: "The Big Switch",
This file has been truncated. show original