/** * Reliable Locks v1.4 * * Copyright 2019 Joel Wetzel * * 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 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License * for the specific language governing permissions and limitations under the License. * */ definition( name: "Reliable Locks", namespace: "joelwetzel", author: "Joel Wetzel", description: "An app that will create virtual locks that 'wrap' your physical lock devices, making them more reliable.", category: "Convenience", iconUrl: "", iconX2Url: "", iconX3Url: "") preferences { page name: "mainPage", title: "", install: true, uninstall: true } def installed() { log.info "Installed with settings: ${settings}" initialize() } def updated() { log.info "Updated with settings: ${settings}" unsubscribe() initialize() } def initialize() { log.info "There are ${childApps.size()} child apps" childApps.each { child -> log.info "Child app: ${child.label}" } } def installCheck() { state.appInstalled = app.getInstallationState() if (state.appInstalled != 'COMPLETE') { section{paragraph "Please hit 'Done' to install '${app.label}' parent app "} } else { log.info "Parent Installed OK" } } def getFormat(type, myText=""){ if(type == "header-green") return "
${myText}
" if(type == "line") return "\n
" if(type == "title") return "

${myText}

" } def display(){ section() { paragraph getFormat("line") paragraph "
Reliable Locks - @joelwetzel
Click here for more Hubitat apps/drivers on my GitHub!
" } } def mainPage() { dynamicPage(name: "mainPage") { installCheck() if (state.appInstalled == 'COMPLETE') { section(getFormat("title", "${app.label}")) { paragraph "An app that will create virtual locks that 'wrap' your physical lock devices, making them more reliable." } section("Reliable Locks:") { app(name: "anyOpenApp", appName: "Reliable Locks Instance", namespace: "joelwetzel", title: "Add a new Reliable Lock", multiple: true) } display() } } }