Skip to content

Instantly share code, notes, and snippets.

Avatar

Nayely Zarazua nayelyzarazua-bluetrail

View GitHub Profile
View testEffectCap.txt
{
"type": "dth",
"dashboard": {
"states": [
{
"component": "main",
"capability": "switch",
"version": 1,
"values": [],
"patch": []
@nayelyzarazua-bluetrail
nayelyzarazua-bluetrail / snippet.js
Last active Nov 25, 2020
OAuth_API_withSubscriptions
View snippet.js
const RESTrequest = require('request');
/*
* Create Subscription Request
*/
let subscription = {
"sourceType": "CAPABILITY",
"capability": {
"locationId": "xxxxx-xxxx-xxxx-xxxx",
"capability": "switch",
"attribute": "switch",
View groovySmartApp.groovy
/**
* largeTextSolution
*
* Copyright 2020 Smart Things
*
* 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
*
View EvohomeSmartApp.groovy
/**
* Copyright 2016 David Lomas (codersaur)
*
* Name: Evohome (Connect)
*
* Author: David Lomas (codersaur)
*
* Date: 2016-04-05
*
* Version: 0.08
@nayelyzarazua-bluetrail
nayelyzarazua-bluetrail / server.js
Created Dec 8, 2020
SmartApp_securityStateSubscription
View server.js
'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());
View connector.js
const {SchemaConnector, DeviceErrorTypes} = require('st-schema');
const deviceStates = { switch: 'off',switch2: 'off', temperature: 40, humidity:80, healthStatus:'online', healthStatus2:'online',listElement:'monthFlow'}//1-10
const connector = new SchemaConnector()
.enableEventLogging(2)
.discoveryHandler((accessToken, response) => {
const d = response.addDevice('st-schema-component', 'st-schema-component', 'e0c682fd-46d9-4fee-8bdd-9edc5da7e053')
//Device manufacturer
d.manufacturerName('xxxx');
View capability.jsonc
//definition
{
"id": "xxxx.customlock",
"version": 1,
"status": "proposed",
"name": "customlock",
"attributes": {
"lockstate": {
"schema": {
"type": "object",
@nayelyzarazua-bluetrail
nayelyzarazua-bluetrail / rule.json
Last active Dec 15, 2020
Rule_customCapabilities
View rule.json
{
"name": "Automation w custom capabilities",
"actions": [
{
"if": {
"greaterThan": {
"left": {
"device": {
"devices": [
"device-id"
@nayelyzarazua-bluetrail
nayelyzarazua-bluetrail / server.js
Last active Oct 16, 2021
SmartApp_HealthCheck_Subscription
View server.js
'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());
@nayelyzarazua-bluetrail
nayelyzarazua-bluetrail / device_config.json
Last active Dec 22, 2020
deviceConfiguration_enabledValues
View device_config.json
{
"type": "dth",
"dashboard": {
"states": [
{
"component": "main",
"capability": "temperatureMeasurement",
"version": 1,
"values": [],
"patch": []