/**
* Copyright 2020 Markus Liljergren (https://oh-lalabs.com)
*
* Version: v1.1.1.1123T
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* NOTE: This is an auto-generated file and most comments have been removed!
*
*/
// BEGIN:getDefaultImports()
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
import java.security.MessageDigest
// END: getDefaultImports()
metadata {
definition (name: "Tasmota - Universal CT/RGB/RGB+CW+WW (Child)", namespace: "tasmota", author: "Markus Liljergren", filename: "tasmota-universal-ct-rgb-cw-ww-child", importUrl: "https://raw.githubusercontent.com/markus-li/Hubitat/release/drivers/expanded/tasmota-universal-ct-rgb-cw-ww-child-expanded.groovy") {
capability "Actuator"
capability "Switch"
capability "Light"
capability "SwitchLevel"
capability "ChangeLevel"
capability "ColorControl"
capability "ColorTemperature"
capability "ColorMode"
capability "Refresh"
capability "LightEffects"
// BEGIN:getMinimumChildAttributes()
attribute "driver", "string"
// END: getMinimumChildAttributes()
attribute "effectNumber", "number"
command "setPixelColor", [[name:"RGB*", type: "STRING", description: "RGB in HEX, eg: #FF0000"],
[name:"Pixel Number*", type: "NUMBER", description: "Pixel to change the color of (1 to \"Addressable Pixels\")"]]
command "setAddressableRotation", [[name:"Addressable Rotation*", type: "NUMBER", description: "1..512 = set amount of pixels to rotate (up to Addressable Pixels value)"]]
command "setEffectWidth", [[name:"Addressable Effect Width*", type: "ENUM", description: "This width is used by Addressable pixel effects",
constraints: ["0", "1", "2", "3", "4"]]]
command "setColorByName", [[name:"Color Name*", type: "ENUM", description: "Choose a color",
constraints: ["#FF0000":"Red",
"#00FF00":"Green",
"#0000FF":"Blue",
"#FFFF00":"Yellow",
"#00FFFF":"Cyan",
"#FF00FF":"Pink",
"#FFFFFFFFFF":"White"]]]
command "toggle"
// BEGIN:getMetadataCommandsForHandlingTasmotaRGBWDevices()
command "setEffectWithSpeed", [[name:"Effect number*", type: "NUMBER", description: "Effect number to enable"],
[name:"Speed", type: "NUMBER", description: "1..40 = set speed, it represents the time in 0.5s to fade from 0 to 100%"]]
command "setNextEffectWithSpeed", [[name:"Speed", type: "NUMBER", description: "1..40 = set speed, it represents the time in 0.5s to fade from 0 to 100%"]]
command "setPreviousEffectWithSpeed", [[name:"Speed", type: "NUMBER", description: "1..40 = set speed, it represents the time in 0.5s to fade from 0 to 100%"]]
command "setEffectSingleColor", [[name:"Speed", type: "NUMBER", description: "1..40 = set speed, it represents the time in 0.5s to fade from 0 to 100%"]]
command "setEffectCycleUpColors", [[name:"Speed", type: "NUMBER", description: "1..40 = set speed, it represents the time in 0.5s to fade from 0 to 100%"]]
command "setEffectCycleDownColors", [[name:"Speed", type: "NUMBER", description: "1..40 = set speed, it represents the time in 0.5s to fade from 0 to 100%"]]
command "setEffectRandomColors", [[name:"Speed", type: "NUMBER", description: "1..40 = set speed, it represents the time in 0.5s to fade from 0 to 100%"]]
// END: getMetadataCommandsForHandlingTasmotaRGBWDevices()
// BEGIN:getMetadataCommandsForHandlingTasmotaDimmerDevices()
command "modeWakeUp", [[name:"Wake Up Duration*", type: "NUMBER", description: "1..3000 = set wake up duration in seconds"],
[name:"Level", type: "NUMBER", description: "1..100 = target dimming level"] ]
// END: getMetadataCommandsForHandlingTasmotaDimmerDevices()
}
preferences {
// BEGIN:getDefaultMetadataPreferences()
input(name: "debugLogging", type: "bool", title: styling_getLogo() + styling_addTitleDiv("Enable debug logging"), description: "" , defaultValue: false, submitOnChange: true, displayDuringSetup: false, required: false)
input(name: "infoLogging", type: "bool", title: styling_addTitleDiv("Enable info logging"), description: "", defaultValue: true, submitOnChange: true, displayDuringSetup: false, required: false)
// END: getDefaultMetadataPreferences()
input(name: "hideColorTemperatureCommands", type: "bool", title: styling_addTitleDiv("Hide Color Temperature Commands"), defaultValue: false, displayDuringSetup: false, required: false)
input(name: "hideEffectCommands", type: "bool", title: styling_addTitleDiv("Hide Effect Commands"), defaultValue: true, displayDuringSetup: false, required: false)
input(name: "hideColorCommands", type: "bool", title: styling_addTitleDiv("Hide Color Commands"), defaultValue: false, displayDuringSetup: false, required: false)
input(name: "isAddressable", type: "bool", title: styling_addTitleDiv("Addressable Light"), description: styling_addDescriptionDiv("Treat as an Addressable Light"), defaultValue: false, displayDuringSetup: false, required: false)
input(name: "addressablePixels", type: "number", title: styling_addTitleDiv("Addressable Pixels"), description: styling_addDescriptionDiv("1..512 = set amount of pixels in strip or ring and reset Rotation"), displayDuringSetup: false, required: false, defaultValue: 30)
}
// BEGIN:getMetadataCustomizationMethods()
metaDataExporter()
if(isCSSDisabled() == false) {
preferences {
input(name: "hiddenSetting", description: "" + getDriverCSSWrapper(), title: "None", displayDuringSetup: false, type: "paragraph", element: "paragraph")
}
}
// END: getMetadataCustomizationMethods()
}
// BEGIN:getDeviceInfoFunction()
String getDeviceInfoByName(infoName) {
Map deviceInfo = ['name': 'Tasmota - Universal CT/RGB/RGB+CW+WW (Child)', 'namespace': 'tasmota', 'author': 'Markus Liljergren', 'filename': 'tasmota-universal-ct-rgb-cw-ww-child', 'importUrl': 'https://raw.githubusercontent.com/markus-li/Hubitat/release/drivers/expanded/tasmota-universal-ct-rgb-cw-ww-child-expanded.groovy']
return(deviceInfo[infoName])
}
// END: getDeviceInfoFunction()
/* These functions are unique to each driver */
void parse(List