Code by Scott שאול בן ישוע
Inovelli-Scene-Creator.groovy 6.6 KB
Newer Older
1
/*
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
2
 *	Hubitat Import URL: https://raw.githubusercontent.com/sgrayban/ABC-Button/master/apps/Inovelli-Scene-Creator/Inovelli-Scene-Creator.groovy
Stephan Hackett's avatar
Stephan Hackett committed
3
4
 *
 *
5
6
 *	Advanced Button Controller (Parent/Child Version)
 *
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
7
8
 *	Original Author: Stephan Hackett
 *  Modified for Inovelli Scene control by Scott Grayban (Scott_Inovelli)
Stephan Hackett's avatar
Stephan Hackett committed
9
 *	
10
 */
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
11
def version(){"v1.0"}
12
13

definition(
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
14
15
    name: "Inovelli Scene Creator",
    namespace: "Inovelli",
16
    singleInstance: true,
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
17
18
    author: "Scott Grayban",
    description: "Configure scenes for your Inovelli devices.",
19
    category: "My Apps",
Stephan Hackett's avatar
Stephan Hackett committed
20
21
22
    iconUrl: "https://cdn.rawgit.com/stephack/ABC/master/resources/images/abc2.png",
    iconX2Url: "https://cdn.rawgit.com/stephack/ABC/master/resources/images/abc2.png",
    iconX3Url: "https://cdn.rawgit.com/stephack/ABC/master/resources/images/abc2.png",
23
24
25
26
)

preferences {
	page(name: "mainPage")
27
    page(name: "aboutPage", nextPage: "mainPage")
28
29
30
31
}

def mainPage() {
	return dynamicPage(name: "mainPage", title: "", install: true, uninstall: true) {
32
33
        if(!state.abcInstalled) {
            section("Hit Done to install ABC App!") {
Stephan Hackett's avatar
Stephan Hackett committed
34
        	}
35
36
        }
        else {
Stephan Hackett's avatar
Stephan Hackett committed
37
38
39
40
41
42
    		def childApps = getAllChildApps()
        	def childVer = "Initial Setup - Version Unknown"
        	if(childApps.size() > 0) {
        		childVer = childApps.first().version()
        	}
			section(){
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
43
				def appHead = "<img src=https://raw.githubusercontent.com/sgrayban/ABC-Button/master/apps/Inovelli-Scene-Creator/resources/Inovelli-Scene-App.png height=80 width=80> \n${checkForUpdate()}"
Stephan Hackett's avatar
Stephan Hackett committed
44
45
46
				paragraph "<div style='text-align:center'>${appHead}</div>"
			}
        	section("Create a new button device mapping.") {
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
47
            	app(name: "childApps", appName: "Inovelli Scene Creator Child", namespace: "Inovelli", title: "<img src=https://raw.githubusercontent.com/sgrayban/ABC-Button/master/apps/Inovelli-Scene-Creator/resources/New.png height=50 width=50>      New Button Device Mapping", multiple: true)
Stephan Hackett's avatar
Stephan Hackett committed
48
49
50
51
52
53
54
        	}
			section("") {
				href (name: "aboutPage", title: "User's Guide", 
       				description: "",
       				page: "aboutPage"
				)		
   			}
55
        }
56
57
58
59
    }
}

def installed() {
60
    state.abcInstalled = true
61
62
63
64
65
66
67
68
69
	initialize()
}

def updated() {
	unsubscribe()
	initialize()
}

def initialize() {
Stephan Hackett's avatar
Stephan Hackett committed
70
}
71

Stephan Hackett's avatar
Stephan Hackett committed
72
def checkForUpdate(){
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
73
	def params = [uri: "https://raw.githubusercontent.com/sgrayban/ABC-Button/master/apps/Inovelli-Scene-Creator/parent.json",
Stephan Hackett's avatar
Stephan Hackett committed
74
75
76
77
78
79
80
81
82
83
				   	contentType: "application/json"]
       	try {
			httpGet(params) { response ->
				def results = response.data
				def appStatus
				if(version() == results.currVersion){
					appStatus = "<small>Parent ${version()}</small><br>${results.noUpdateImg}"
				}
				else {
					appStatus = "<small>Parent ${version()}</small><br>${results.updateImg}${results.changeLog}"
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
84
					log.warn "Inovelli Scene Creator App does not appear to be the latest version: Please update."
Stephan Hackett's avatar
Stephan Hackett committed
85
86
87
88
89
90
91
				}
				return appStatus
			}
		} 
        catch (e) {
        	log.error "Error:  $e"
    	}
92
93
94
95
96
97
98
99
100
101
}

def aboutPage() {
	dynamicPage(name: "aboutPage", title: none){
        textHelp()
	}
}

private def textHelp() {
	def text =
Stephan Hackett's avatar
Stephan Hackett committed
102
	section("<img src=https://raw.githubusercontent.com/stephack/Hubitat/master/resources/images/abc2.png height=36 width=36> User's Guide - Advanced Button Controller") {
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
    	paragraph "This smartapp allows you to use a device with buttons including, but not limited to:\n\n  Aeon Labs Minimotes\n"+
    	"  HomeSeer HS-WD100+ switches**\n  HomeSeer HS-WS100+ switches\n  Lutron Picos***\n\n"+
		"It is a heavily modified version of @dalec's 'Button Controller Plus' which is in turn"+
        " a version of @bravenel's 'Button Controller+'."
   	}
	section("Some of the included changes are:"){
        paragraph "A complete revamp of the configuration flow. You can now tell at a glance, what has been configured for each button."+
        "The button configuration page has been collapsed by default for easier navigation."
        paragraph "The original apps were hardcoded to allow configuring 4 or 6 button devices."+
        " This app will automatically detect the number of buttons on your device or allow you to manually"+
        " specify (only needed if device does not report on its own)."
		paragraph "Allows you to give your buton device full speaker control including: Play/Pause, NextTrack, Mute, VolumeUp/Down."+
    	"(***Standard Pico remotes can be converted to Audio Picos)\n\nThe additional control options have been highlighted below."
	}
	section("Available Control Options are:"){
Stephan Hackett's avatar
Stephan Hackett committed
118
        paragraph "	Switches - Turn On \n"+
119
        "	Switches - Turn Off \n"+
Stephan Hackett's avatar
Stephan Hackett committed
120
        "	Switches - Toggle \n\n"+
121
            
122
123
        "	Dimmers - Set Level (Group 1) \n"+
        "	Dimmers - Set Level (Group 2) \n"+
Stephan Hackett's avatar
Stephan Hackett committed
124
125
126
127
        "	Dimmers - Inc Level \n"+
        "	Dimmers - Dec Level \n"+
        "	Dimmers - Toggle on to Level \n"+
        "	Dimmers - Ramp Up/Down (Smooth Dimming) \n\n"+
128
            
Stephan Hackett's avatar
Stephan Hackett committed
129
130
        "	Color Lights - Set Temperature \n"+
        "	Color Lights - Set Color \n\n"+
131
        
Stephan Hackett's avatar
Stephan Hackett committed
132
133
134
135
136
137
        "	Speaker - Toggle Play/Pause \n"+
        "	Speaker - Increment Volume \n"+
        "	Speaker - Decrement Volume \n"+
        "	Speaker - Next Track \n"+
        "	Speaker - Mute/Unmute \n"+
        "	Speaker - Cycle Preset \n\n"+
138
139
140
            
         "	Fans - Set Speed \n"+
        "	Fans - Cycle Speed \n"+    
Stephan Hackett's avatar
Stephan Hackett committed
141
142
143
144
145
146
        "	Fans - Legacy Cycle (Low, Medium, High, Off) \n\n"+  
			
		"	Modes - Set Mode \n"+
		"	Modes - Set HSM \n\n"+	
			
		"	Rules - Run, Stop, Pause, Resume, Evaluate, Set Boolean \n\n"+	
147
148
            
        "	Locks - Unlock Only \n"+
Stephan Hackett's avatar
Stephan Hackett committed
149
		"	Scenes - Cycle Scenes \n"+	
150
        "	Shades - Up, Down, or Stop \n"+
151
        "	Sirens - Toggle \n"+
152
        "	Speech Notifications \n"+
153
154
155
156
157
158
159
160
161
162
163
        "	SMS Notifications"
	}
	section ("** Quirk for HS-WD100+ on Button 5 & 6:"){
        paragraph "Because a dimmer switch already uses Press&Hold to manually set the dimming level"+
        " please be aware of this operational behavior. If you only want to manually change"+
        " the dim level to the lights that are wired to the switch, you will automatically"+
        " trigger the 5/6 button event as well. And the same is true in reverse. If you"+ 
        " only want to trigger a 5/6 button event action with Press&Hold, you will be manually"+
        " changing the dim level of the switch simultaneously as well.\n"+
        "This quirk doesn't exist of course with the HS-HS100+ since it is not a dimmer."
	}
164
165
	section("*** Lutron Pico:"){
        paragraph "There are 2 types of Pico configurations in HE:\n 1. The Standard Picos - with pushed events and held events (followed by released events).\n"+
Stephan Hackett's avatar
Stephan Hackett committed
166
    	" 2. The Fast Picos - with pushed events followed by released events (no held events)."
167
168
	}
}