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

Removed unused drivers and apps

parent 41e53f3c
definition(
name: "Boot Me Up Child",
namespace: "stephack",
author: "Stephan Hackett",
description: "Activate WOL Magic Packet",
category: "Convenience",
parent: "stephack:Boot Me Up Scottie",
iconUrl: "",
iconX2Url: "",
iconX3Url: "")
preferences {
section("Choose Switch") {
input "myDevice", "capability.switch", required: true, title: "Choose a Switch"
input "myMac", "text", required: true, title: "MAC of workstation"
input "logEnable", "bool", title: "Enable Debug Logging?"
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
subscribe(myDevice, "switch.on", myHandler)
}
def myHandler(evt) {
if(logEnable) log.debug "${myDevice} activated"
sendHubCommand(createWOL())
}
def createWOL(evt) {
def newMac = myMac.replaceAll(":","").replaceAll("-","")
if(logEnable) log.debug "Sending Magic Packet to: $newMac"
def result = new hubitat.device.HubAction (
"wake on lan $newMac",
hubitat.device.Protocol.LAN,
null
)
return result
}
/*
* Boot Me Up Manager (Parent)
*
* Author: Stephan Hackett
*
*
*
*/
definition(
name: "Boot Me Up Scottie",
namespace: "stephack",
singleInstance: true,
author: "Stephan Hackett",
description: "Activate WOL Magic Packet - Parent Manager",
category: "My Apps",
iconUrl: "",
iconX2Url: "",
iconX3Url: "",
)
preferences {
page(name: "mainPage")
}
def mainPage() {
return dynamicPage(name: "mainPage", title: "", install: true, uninstall: true) {
if(!state.BmuInstalled) {
section("Hit Done to install Boot Me Up Manager App!") {
}
}
else {
section("Create a new Boot Me Up Instance.") {
app(name: "childApps", appName: "Boot Me Up Child", namespace: "stephack", title: "New Boot Me Up Instance", multiple: true)
}
}
}
}
def installed() {
state.BmuInstalled = true
initialize()
}
def updated() {
unsubscribe()
initialize()
}
def initialize() {
}
/**
* Hue Revert
*
* Copyright 2018 Stephan Hackett
*
* 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: "Hue Revert",
namespace: "stephack",
author: "Stephan Hackett",
description: "Revert Hue to Custom Defaults",
category: "My Apps",
iconUrl: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png",
iconX2Url: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png",
iconX3Url: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png"
)
preferences {
section("") {
input ("controlDevice", "capability.switch", title: "Select Control Switch:")
input ("bulbs", "capability.colorTemperature", title: "Select bulbs:", multiple:true)
input ("defTemp", "number", title: "Set Default Temp to Revert To:")
}
}
def initialize() {
subscribe(controlDevice, "switch.on", revertHandler)
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def revertHandler(evt) {
def bulbState
//runIn(5,test)
bulbs.each {
it.refresh()
log.info it.displayName + " were " + it.currentSwitch
bulbState = it.currentSwitch
it.setColorTemperature(defTemp)
if(bulbState) it."${bulbState}"()
}
}
def test(){
log.info "test"
bulbs.each {
}
}
/**
* Mode Alert
*
* Copyright 2018 Stephan Hackett
*
* 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: "Mode Alert",
namespace: "stephack",
author: "Stephan Hackett",
description: "Send notifications when Mode changes",
category: "My Apps",
iconUrl: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png",
iconX2Url: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png",
iconX3Url: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png"
)
preferences {
section("") {
//input("phone", "phone", title: "Enter phone # to receive SMS notification:", description: "Phone Number", required: false)
input("myDevice", "capability.speechSynthesis", title: "Send push notification to:", description: "Choose notification device:", required: false)
//input("message", "text", title: "Enter message to send:")
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
subscribe(location, "mode", modeChangeHandler)
}
def modeChangeHandler(evt){
myDevice.speak("[L]${evt.value} Mode is now active")
}
/**
* Occupancy Child
*
* Copyright 2018 Stephan Hackett
*
* 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.
*
*
* todo: add levels per mode; set temps
*
*
*/
def version(){"v0.2.180826"}
definition(
name: "Occupancy Child",
namespace: "stephack",
author: "Stephan Hackett",
description: "Motion Lighting My way",
category: "My Apps",
parent: "stephack:Occupancy Lighting",
iconUrl: "",
iconX2Url: "",
iconX3Url: ""
)
preferences {
section("") {
input "motionSensors", "capability.motionSensor", title: "Select Motion Sensors:", required: true, multiple:true
input "mySwitches", "capability.switch", title: "Switches to Turn On:", multiple:true
input "myDimmers", "capability.switchLevel", title: "Select Dimmers to Set:", multiple:true, submitOnChange: true
if(myDimmers){
input "onLevel", "number", title: "Level when Turned on:", required: true
input "dimFirst", "bool", title: "Dim before turning off?", required: false, submitOnChange: true
if(dimFirst){
input "dimLevel", "number", title: "Level when Dimmed:", required: true
input "dimTime", "number", title: "Inactivity Timeout before Lights Dim:", required: true
}
}
input "offTime", "number", title: "Timeout before All Lights Turn Off:", required: true
input "enableSwitch", "capability.switch", title: "Choose switch that enables/disables automation:", required: false
}
}
def initialize() {
state.version = version()
if(!app.label || app.label == "default")app.updateLabel(defaultLabel())
subscribe(motionSensors, "motion", motionHandler)
// parent.createVS(app.id,app.label)
}
def defaultLabel() {
return "${motionSensors} Settings"
}
//def uninstalled() {
// parent.removeVS(app.id)
//}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def allInactive(){//ensures ALL motion sensors are inactive
def allInactive = true
motionSensors.each {eachMotion->
if(eachMotion.currentValue("motion") == "active"){
allInactive = false
}
}
return allInactive
}
def motionHandler(evt) {
if(!enableSwitch || enableSwitch.currentValue("switch") == "on"){
//log.info evt.value
if(evt.value == "inactive" && allInactive()) {
log.info "Inactive received. Starting Timeouts"
if(dimFirst) runIn(dimTime, dimLights)
runIn(offTime, setOff)
}
if(evt.value == "active") {
state.lastActive = now()
log.info "Active received. Setting Dimmers/Switches"
if(myDimmers) setDimmers()
if(mySwitches) setSwitch()
}
}
}
def dimLights(){
def delta = (now() - (state.lastActive ?:0))/1000
if(delta < dimTime) {
log.info "Cancelling Dim: Time Since Last Active = ${delta} and Dim Window = ${dimTime}"
}
else {
myDimmers.each {eachLight->
if(eachLight.currentSwitch == "on") eachLight.setLevel(dimLevel)////only dims if light is on (prevents light from turning back on after physical off)
}
}
}
def setDimmers() {
myDimmers.setLevel(onLevel)
}
def setSwitch() {
mySwitches.on()
}
def setOff() {
def delta = (now() - (state.lastActive ?:0))/1000
if(delta < offTime) {
log.info "Cancelling Off: Time Since Last Active= ${delta} and Off Window = ${offTime}"
}
else if(myDimmers) myDimmers.off()
else if(mySwitches) mySwitches.off()
}
/*
* Occupancy Lighting (Parent App)
*
* Author: Stephan Hackett
*
*
*
*/
definition(
name: "Occupancy Lighting",
namespace: "stephack",
singleInstance: true,
author: "Stephan Hackett",
description: "Create Occupancy Lighting Child Apps",
category: "My Apps",
iconUrl: "",
iconX2Url: "",
iconX3Url: "",
)
preferences {
page(name: "mainPage")
}
def mainPage() {
return dynamicPage(name: "mainPage", title: "", install: true, uninstall: true) {
if(!state.isInstalled) {
section("Hit Done to install My Occupancy Lighting Apps!") {
}
}
else {
def childApps = getAllChildApps()
section("Create a new occupancy automation.") {
app(name: "childApps", appName: "Occupancy Child", namespace: "stephack", title: "<img src=https://raw.githubusercontent.com/stephack/Hubitat/master/resources/images/New.png height=50 width=50> New Occupancy Settings", multiple: true)
}
}
}
}
def installed() {
state.isInstalled = true
initialize()
}
def updated() {
unsubscribe()
initialize()
}
def initialize() {
}
/*
def initialize() {
//createContainer()
}
def createContainer() {
log.info "Creating Virtual Container"
def childDevice = getAllChildDevices()?.find {it.device.deviceNetworkId == "VC-${app.id}"}
if (!childDevice) {
childDevice = addChildDevice("stephack", "Virtual Container", "VC-${app.id}", null,[completedSetup: true, label: "Container - ${app.label}"])
log.info "Created Container [${childDevice}]"
}
else {
log.info "Container already exists"
}
}
def createVS(appId,appName) {
log.info "Creating Virtual Switch within App Container"
def childDevice = getAllChildDevices()?.find {it.device.deviceNetworkId == "VC-${app.id}"}
if (childDevice) {
childDevice.addVS(appId,appName)
}
else {
log.info "Virtual Container not found!!"
}
}
def removeVS(childId) {
log.info "Sending delete request to Container: ${childId}"
def childDevice = getAllChildDevices()
childDevice.each {
it.removeVS(childId)
}
}
def uninstalled() {
removeChildDevices(getChildDevices())
}
private removeChildDevices(delete) {
delete.each {
deleteChildDevice(it.deviceNetworkId)
}
}
*/
/**
*
* 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.
*
* GE Zwave Plus Dimmer Switch (Supports Double Taps but not Associations)
*
* Copyright 2018 Stephan Hackett
*
*/
def version() {"v1.0.20190111"}
metadata {
definition (name: "GE Zwave Plus Dimmer Switch", namespace: "stephack", author: "Stephan Hackett and Chris Nussbaum") {
capability "Switch"
capability "PushableButton"
capability "Refresh"
capability "Switch Level"
capability "Sensor"
capability "Actuator"
capability "Light"
command "doubleTapUpper"
command "doubleTapLower"
command "inverted"
command "notInverted"
command "configure"
command "indicatorWhenOn"
command "indicatorWhenOff"
command "indicatorNever"
// These include version because there are older firmwares that don't support double-tap or the extra association groups
fingerprint mfr:"0063", prod:"4944", model:"3038", ver: "5.26", deviceJoinName: "GE Z-Wave Plus Wall Dimmer"
fingerprint mfr:"0063", prod:"4944", model:"3039", ver: "5.19", deviceJoinName: "GE Z-Wave Plus 1000W Wall Dimmer"
fingerprint mfr:"0063", prod:"4944", model:"3130", ver: "5.21", deviceJoinName: "GE Z-Wave Plus Toggle Dimmer"
fingerprint mfr:"0063", prod:"4944", model:"3135", ver: "5.26", deviceJoinName: "Jasco Z-Wave Plus Wall Dimmer"
fingerprint mfr:"0063", prod:"4944", model:"3136", ver: "5.21", deviceJoinName: "Jasco Z-Wave Plus 1000W Wall Dimmer"
fingerprint mfr:"0063", prod:"4944", model:"3137", ver: "5.20", deviceJoinName: "Jasco Z-Wave Plus Toggle Dimmer"
}
}
def getCommandClassVersions() {
[
0x20: 1, // Basic
0x26: 3, // SwitchMultilevel
0x56: 1, // Crc16Encap
0x70: 1, // Configuration
]
}
def parse(String description) {
//log.debug "Description: ${description}"
def result = null
if (description != "updated") {
def cmd = zwave.parse(description, commandClassVersions)
//log.debug "CMD: ${cmd}"
if (cmd) {
result = zwaveEvent(cmd)
log.debug("'$description' parsed to $result")
} else {
log.debug("Couldn't zwave.parse '$description'")
}
}
result
}
def zwaveEvent(hubitat.zwave.commands.basicv1.BasicReport cmd) {
//log.info "bv1Report"
dimmerEvents(cmd)
}
def zwaveEvent(hubitat.zwave.commands.basicv1.BasicSet cmd) {
//log.info "bv1BasicSet"
buttonEvents(cmd)
}
def zwaveEvent(hubitat.zwave.commands.switchmultilevelv3.SwitchMultilevelReport cmd) {
//log.info "sv3Report"
dimmerEvents(cmd)
}
def zwaveEvent(hubitat.zwave.commands.crc16encapv1.Crc16Encap cmd) {
//log.info "CrC"
def versions = commandClassVersions
def version = versions[cmd.commandClass as Integer]
def ccObj = version ? zwave.commandClass(cmd.commandClass, version) : zwave.commandClass(cmd.commandClass)
def encapsulatedCommand = ccObj?.command(cmd.command)?.parse(cmd.data)
if (encapsulatedCommand) {
zwaveEvent(encapsulatedCommand)
}
}
def zwaveEvent(hubitat.zwave.Command cmd) {
//log.info "not interested"
// Handles all Z-Wave commands we aren't interested in
[:]
}
def dimmerEvents(hubitat.zwave.Command cmd) {
//log.info "dimmerEvent"
def result = []
def value = (cmd.value ? "on" : "off")
def switchEvent = createEvent(name: "switch", value: value, descriptionText: "$device.displayName was turned $value")
result << switchEvent
if (cmd.value) {
result << createEvent(name: "level", value: cmd.value, descriptionText: "$device.displayName brightness set to $cmd.value", unit: "%")
}
return result
}
def buttonEvents(hubitat.zwave.Command cmd){
//log.info "buttonEvent"
if (cmd.value == 255) {
createEvent(name: "pushed", value: 1, descriptionText: "$device.displayName Upper Paddle Double-tapped (Button 1)", isStateChange: true, type: "physical")
}
else if (cmd.value == 0) {
createEvent(name: "pushed", value: 2, descriptionText: "$device.displayName Lower Paddle Double-tapped (Button 2)", isStateChange: true, type: "physical")
}
}
def on() {