Code by Scott שאול בן ישוע
Verified Commit bc06b914 authored by Sha'ul ben Yeshua's avatar Sha'ul ben Yeshua 🎗
Browse files

lots of code changes and locked app to only allow Inovelli devices

parent fdaccc47
......@@ -43,21 +43,24 @@ def chooseButton() {
def appHead = "<img src=https://raw.githubusercontent.com/sgrayban/ABC-Button/master/apps/Inovelli-Scene-Creator/resources/Inovelli-Scene-App.png> \n${checkForUpdate()}"
paragraph "<div style='text-align:center'>${appHead}</div>"
}
section(getFormat("header", "${getImage("Device", "45")}"+" Step 1: Select Your Button Device")) {
section(getFormat("header", "${getImage("Device", "45")}"+" Step 1: Select Your Inovelli Device")) {
input "buttonDevice", "capability.pushableButton", title: getFormat("section", "Button Device"), description: "Tap to Select", multiple: false, required: true, submitOnChange: true
}
if(buttonDevice){
state.buttonType = buttonDevice.typeName
if(state.buttonType.contains("Aeon Minimote")) state.buttonType = "Aeon Minimote"
if(logEnable) log.debug "Device Type is now set to: "+state.buttonType
state.buttonCount = manualCount?: buttonDevice.currentValue('numberOfButtons')
section(getFormat("header", "${getImage("Button", "45")}"+" Step 2: Configure Your Buttons")) {
if(state.buttonCount<1) {
if(!state.buttonType.contains("Inovelli")) {
paragraph "<center><h2><b>The selected button device is not supported.\n"+
"Please select a Inovelli Scene capable switch</b></h2></center>"
}
else if(state.buttonCount<1) {
paragraph "The selected button device did not report the number of buttons it has. Please specify in the Advanced Config section below."
}
else {
for(i in 1..state.buttonCount){
href "configButtonsPage", title: getFormat("section", "${getImage("Button", "30")}" + " Button ${i}"), state: getDescription(i)!="Tap to configure"? "complete": null, description: getDescription(i), params: [pbutton: i]
href "configButtonsPage", title: getFormat("section", "${getImage("Button", "30")}" + " Tapped ${i}x"), state: getDescription(i)!="Tap to configure"? "complete": null, description: getDescription(i), params: [pbutton: i]
}
}
}
......@@ -83,7 +86,7 @@ def chooseButton() {
def configButtonsPage(params) {
if (params.pbutton != null) state.currentButton = params.pbutton.toInteger()
dynamicPage(name: "configButtonsPage", title: "CONFIGURE BUTTON ${state.currentButton}:\n${state.buttonType}", getButtonSections(state.currentButton))
dynamicPage(name: "configButtonsPage", title: "CONFIGURE TAP ${state.currentButton}x:\n${state.buttonType}", getButtonSections(state.currentButton))
}
def getButtonSections(buttonNumber) {
......@@ -95,12 +98,12 @@ def getButtonSections(buttonNumber) {
myDetail = state.details.find{it.sOrder==i}
//
section(title: myDetail.secLabel, hideable: true, hidden: !(shallHide("${myDetail.id}${buttonNumber}"))) {
if(showPush(myDetail.desc)) input "${myDetail.id}${buttonNumber}_pushed", myDetail.cap, title: "When Pushed", multiple: myDetail.mul, required: false, submitOnChange: collapseAll, options: myDetail.opt
if(showPush(myDetail.desc)) input "${myDetail.id}${buttonNumber}_pushed", myDetail.cap, title: "When tapped ▲ ${state.currentButton}x", multiple: myDetail.mul, required: false, submitOnChange: collapseAll, options: myDetail.opt
if(myDetail.sub && isReq("${myDetail.id}${buttonNumber}_pushed")) input "${myDetail.sub}${buttonNumber}_pushed", myDetail.subType, title: myDetail.sTitle, multiple: false, required: !myDetail.sNotReq, description: myDetail.sDesc, options: myDetail.subOpt
if(myDetail.sub2 && isReq("${myDetail.id}${buttonNumber}_pushed")) input "${myDetail.sub2}${buttonNumber}_pushed", myDetail.subType, title: myDetail.s2Title, multiple: false, required: !myDetail.s2NotReq, description: myDetail.s2Desc, options: myDetail.subOpt
if(myDetail.sub3 && isReq("${myDetail.id}${buttonNumber}_pushed")) input "${myDetail.sub3}${buttonNumber}_pushed", myDetail.subType, title: myDetail.s3Title, multiple: false, required: !myDetail.s3NotReq, description: myDetail.s3Desc, options: myDetail.subOpt
if(showHeld(myDetail.desc)) input "${myDetail.id}${buttonNumber}_held", myDetail.cap, title: "When Held", multiple: myDetail.mul, required: false, submitOnChange: collapseAll, options: myDetail.opt
if(showHeld(myDetail.desc)) input "${myDetail.id}${buttonNumber}_held", myDetail.cap, title: "When tapped ▼ ${state.currentButton}x", multiple: myDetail.mul, required: false, submitOnChange: collapseAll, options: myDetail.opt
if(myDetail.sub && isReq("${myDetail.id}${buttonNumber}_held")) input "${myDetail.sub}${buttonNumber}_held", myDetail.subType, title: myDetail.sTitle, multiple: false, required: !myDetail.sNotReq, description: myDetail.sDesc, options: myDetail.subOpt
if(myDetail.sub2 && isReq("${myDetail.id}${buttonNumber}_held")) input "${myDetail.sub2}${buttonNumber}_held", myDetail.subType, title: myDetail.s2Title, multiple: false, required: !myDetail.s2NotReq, description: myDetail.s2Desc, options: myDetail.subOpt
if(myDetail.sub3 && isReq("${myDetail.id}${buttonNumber}_held")) input "${myDetail.sub3}${buttonNumber}_held", myDetail.subType, title: myDetail.s3Title, multiple: false, required: !myDetail.s3NotReq, description: myDetail.s3Desc, options: myDetail.subOpt
......@@ -147,7 +150,7 @@ def getButtonSections(buttonNumber) {
}
def getImage(type, mySize) {
def loc = "<img src=https://raw.githubusercontent.com/stephack/Hubitat/master/resources/images/"
def loc = "<img src=https://raw.githubusercontent.com/sgrayban/ABC-Button/master/resources/images/"
if(type == "Device") return "${loc}Device.png height=${mySize} width=${mySize}> "
if(type == "Button") return "${loc}Button.png height=${mySize} width=${mySize}> "
if(type == "Switches") return "${loc}Switches.png height=${mySize} width=${mySize}> "
......@@ -211,8 +214,8 @@ def showRelease(desc) {
def getDescription(dNumber) {
def descript = ""
if(!(settings.find{it.key.contains("_${dNumber}_")})) return "Tap to configure"
if(settings.find{it.key.contains("_${dNumber}_pushed")}) descript = "\nPUSHED:"+getDescDetails(dNumber,"_pushed")+"\n"
if(settings.find{it.key.contains("_${dNumber}_held")}) descript = descript+"\nHELD:"+getDescDetails(dNumber,"_held")+"\n"
if(settings.find{it.key.contains("_${dNumber}_pushed")}) descript = "\nTapped ▲:"+getDescDetails(dNumber,"_pushed")+"\n"
if(settings.find{it.key.contains("_${dNumber}_held")}) descript = descript+"\nTapped ▼:"+getDescDetails(dNumber,"_held")+"\n"
if(settings.find{it.key.contains("_${dNumber}_doubleTapped")}) descript = descript+"\nTAPx2:"+getDescDetails(dNumber,"_doubleTapped")+"\n"
if(settings.find{it.key.contains("_${dNumber}_released")}) descript = descript+"\nRELEASED:"+getDescDetails(dNumber,"_released")+"\n"
return descript
......
......@@ -15,7 +15,7 @@ definition(
namespace: "Inovelli",
singleInstance: true,
author: "Scott Grayban",
description: "Configure scenes for your Inovelli devices.",
description: "Configure scenes for your Inovelli button devices.",
category: "My Apps",
iconUrl: "https://raw.githubusercontent.com/sgrayban/ABC-Button/master/apps/Inovelli-Scene-Creator/resources/Inovelli-Scene-App.png",
iconX2Url: "https://raw.githubusercontent.com/sgrayban/ABC-Button/master/apps/Inovelli-Scene-Creator/resources/Inovelli-Scene-App.png",
......@@ -43,7 +43,7 @@ def mainPage() {
def appHead = "<img src=https://raw.githubusercontent.com/sgrayban/ABC-Button/master/apps/Inovelli-Scene-Creator/resources/Inovelli-Scene-App.png> \n${checkForUpdate()}"
paragraph "<div style='text-align:center'>${appHead}</div>"
}
section("Create a new button device mapping.") {
section("Create a new Inovelli scene mapping.") {
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)
}
section("") {
......@@ -99,11 +99,10 @@ def aboutPage() {
private def textHelp() {
def text =
section("<img src=https://raw.githubusercontent.com/stephack/Hubitat/master/resources/images/abc2.png height=36 width=36> User's Guide - Advanced Button Controller") {
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"+
section("<img src=https://raw.githubusercontent.com/sgrayban/ABC-Button/master/apps/Inovelli-Scene-Creator/resources/Inovelli-Scene-App.png> User's Guide - Inovelli's Scene Creator") {
paragraph "This smartapp allows you to use a device with buttons\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+'."
" a version of @stephack 'ABC 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."+
......@@ -111,8 +110,7 @@ private def textHelp() {
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."
paragraph "Allows you to give your buton device full speaker control including: Play/Pause, NextTrack, Mute, VolumeUp/Down."
}
section("Available Control Options are:"){
paragraph " Switches - Turn On \n"+
......@@ -152,17 +150,4 @@ private def textHelp() {
" Speech Notifications \n"+
" 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."
}
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"+
" 2. The Fast Picos - with pushed events followed by released events (no held events)."
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment