Code by Scott שאול בן ישוע
Inovelli-Scene-Creator.groovy 6.71 KB
Newer Older
1
/*
Stephan Hackett's avatar
Stephan Hackett committed
2
3
4
 *	Hubitat Import URL: https://raw.githubusercontent.com/stephack/Hubitat/master/apps/Advanced%20Button%20Controller%20(ABC)/Advanced_Button_Controller.groovy
 *
 *
5
6
7
8
 *	Advanced Button Controller (Parent/Child Version)
 *
 *	Author: Stephan Hackett
 * 
Stephan Hackett's avatar
Stephan Hackett committed
9
10
11
12
13
14
 *	
 *	01/14/19 - added url to Raw code at the top of the parent/child apps
 *			 - adjusted logging
 *			 - update checking code is now done through json file (Thanks to @Cobra for his guidance)
 *
 *	07/03/18 - added pictures and Update check
15
16
 * 
 */
Stephan Hackett's avatar
Stephan Hackett committed
17
def version(){"v0.2.190114"}
18
19

definition(
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
20
21
    name: "Inovelli Scene Creator",
    namespace: "Inovelli",
22
    singleInstance: true,
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
23
24
    author: "Scott Grayban",
    description: "Configure scenes for your Inovelli devices.",
25
    category: "My Apps",
Stephan Hackett's avatar
Stephan Hackett committed
26
27
28
    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",
29
30
31
32
)

preferences {
	page(name: "mainPage")
33
    page(name: "aboutPage", nextPage: "mainPage")
34
35
36
37
}

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

def installed() {
66
    state.abcInstalled = true
67
68
69
70
71
72
73
74
75
	initialize()
}

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

def initialize() {
Stephan Hackett's avatar
Stephan Hackett committed
76
}
77

Stephan Hackett's avatar
Stephan Hackett committed
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
def checkForUpdate(){
	def params = [uri: "https://raw.githubusercontent.com/stephack/Hubitat/master/apps/Advanced%20Button%20Controller%20(ABC)/parent.json",
				   	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}"
					log.warn "ABC Parent App does not appear to be the latest version: Please update."
				}
				return appStatus
			}
		} 
        catch (e) {
        	log.error "Error:  $e"
    	}
98
99
100
101
102
103
104
105
106
107
}

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

private def textHelp() {
	def text =
Stephan Hackett's avatar
Stephan Hackett committed
108
	section("<img src=https://raw.githubusercontent.com/stephack/Hubitat/master/resources/images/abc2.png height=36 width=36> User's Guide - Advanced Button Controller") {
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
    	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
124
        paragraph "	Switches - Turn On \n"+
125
        "	Switches - Turn Off \n"+
Stephan Hackett's avatar
Stephan Hackett committed
126
        "	Switches - Toggle \n\n"+
127
            
128
129
        "	Dimmers - Set Level (Group 1) \n"+
        "	Dimmers - Set Level (Group 2) \n"+
Stephan Hackett's avatar
Stephan Hackett committed
130
131
132
133
        "	Dimmers - Inc Level \n"+
        "	Dimmers - Dec Level \n"+
        "	Dimmers - Toggle on to Level \n"+
        "	Dimmers - Ramp Up/Down (Smooth Dimming) \n\n"+
134
            
Stephan Hackett's avatar
Stephan Hackett committed
135
136
        "	Color Lights - Set Temperature \n"+
        "	Color Lights - Set Color \n\n"+
137
        
Stephan Hackett's avatar
Stephan Hackett committed
138
139
140
141
142
143
        "	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"+
144
145
146
            
         "	Fans - Set Speed \n"+
        "	Fans - Cycle Speed \n"+    
Stephan Hackett's avatar
Stephan Hackett committed
147
148
149
150
151
152
        "	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"+	
153
154
            
        "	Locks - Unlock Only \n"+
Stephan Hackett's avatar
Stephan Hackett committed
155
		"	Scenes - Cycle Scenes \n"+	
156
        "	Shades - Up, Down, or Stop \n"+
157
        "	Sirens - Toggle \n"+
158
        "	Speech Notifications \n"+
159
160
161
162
163
164
165
166
167
168
169
        "	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."
	}
170
171
	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
172
    	" 2. The Fast Picos - with pushed events followed by released events (no held events)."
173
174
	}
}