This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const SmartApp = require('@smartthings/smartapp'); | |
const { json } = require('body-parser'); | |
require('dotenv').config(); | |
const server = module.exports = express(); | |
server.use(bodyParser.json()); | |
const app = new SmartApp() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SmartApp = require('@smartthings/smartapp'); | |
const deviceStates = {switch: 'off'}//1-10 | |
module.exports = new SmartApp() | |
.appId('smartApp connector') | |
.disableCustomDisplayName(true) | |
.permissions(['w:devices:*', 'r:locations:*','x:devices:*', 'i:deviceprofiles:*', 'r:devices:*']) | |
.page('mainPage', (ctx, page, configData) => { | |
page.section('Device label:', section => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Sample for precondition", | |
"actions": [ | |
{ | |
"if":{ | |
"equals": { | |
"left":{ | |
"string": "pushed" | |
}, | |
"right":{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Function called when the command of the Custom Capability is executed (from the app, API or SmartApp) | |
def setAttr(String arg){ | |
log.trace("attr ${arg}") | |
sendEvent(name:"attr",value:arg) | |
state.configValue = 0 | |
switch(arg){ | |
case 'option1': | |
state.configValue= 20 | |
break; | |
case 'option2': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Rule with several conditions but no depth", | |
"actions": [ | |
{ | |
"if": { | |
"equals": { | |
"right": { | |
"device": { | |
"devices": [ | |
"Dimmer1-ID" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const SmartApp = require('@smartthings/smartapp'); | |
require('dotenv').config(); | |
const server = module.exports = express(); | |
server.use(bodyParser.json()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dashboard": { | |
"states": [ | |
{ | |
"component": "main", | |
"capability": "switch", | |
"version": 1, | |
"values": [] | |
} | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local caps = require "st.capabilities" | |
local zcl_clusters = require "st.zigbee.zcl.clusters" | |
local ZigbeeDriver = require "st.zigbee" | |
local constants = require "st.zigbee.constants" | |
local defaults = require "st.zigbee.defaults" | |
local contact_sensor_defaults = require "st.zigbee.defaults.contactSensor_defaults" | |
local data_types = require "st.zigbee.data_types" | |
local fancy_switch_def = [[{ | |
"id": "commonsmall09402.copySwitch", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const SmartApp = require('@smartthings/smartapp'); | |
require('dotenv').config(); | |
const server = module.exports = express(); | |
server.use(bodyParser.json()); |