${tooltipText}
${hrefLabel}
";
}
def pageDeviceConfiguration(params) {
String tooltipStyle = "";
dynamicPage (name: "pageDeviceConfiguration", title: "Mobile Device Configuration", nextPage: "pageApplyConfiguration", install: false, uninstall: false) {
section("") {
paragraph "Select the permissions you want to grant for Mobile Controller on your mobile device: ${tooltipStyle}"
input ("btMonitor", "bool", title: "Monitor Bluetooth Connections? ${getZindexToggle('btMonitor')} ${getTooltipHTML('Bluetooth Monitoring', 'Allow Mobile Controller to detect devices paired to the mobile device. Child devices will be created in HE to capture the connection status for each bluetooth device.', 'https://github.com/sburke781/MobileController/blob/master/Settings.md#bluetooth-monitoring')}", required: true, submitOnChange: true, defaultValue: false)
input ("wifiMonitor", "bool", title: "Monitor Wi-Fi Connections? ${getZindexToggle('wifiMonitor')} ${getTooltipHTML('Wi-Fi Monitoring','Allow Mobile Controller to detect connections to a specified list of Wi-Fi networks, allowing easy switching between local and cloud communications and contributing to presence detection.', 'https://github.com/sburke781/MobileController/blob/master/Settings.md#wi-fi-monitoring')}", required: true, submitOnChange: true, defaultValue: false)
input ("callMonitor", "bool", title: "Monitor Calls? ${getZindexToggle('callMonitor')} ${getTooltipHTML('Call Monitoring', 'Allow Mobile Controller to detect incoming, ongoing and missed calls, reporting the call status to HE.', 'https://github.com/sburke781/MobileController/blob/master/Settings.md#call-monitoring')}", required: true, submitOnChange: true, defaultValue: false)
input ("msgMonitor", "bool", title: "Monitor Messages? ${getZindexToggle('msgMonitor')} ${getTooltipHTML('Message Monitoring', 'Allow Mobile Controller to detect new or unread SMS/MMS messages on the mobile device, reporting the status back to HE.', 'https://github.com/sburke781/MobileController/blob/master/Settings.md#message-monitoring')}", required: true, submitOnChange: true, defaultValue: false)
input ("syncModes", "bool", title: "Synchronize HE Modes? ${getZindexToggle('syncModes')} ${getTooltipHTML('Synchronizing HE Modes', 'Changes to the HE mode will be communicated to and stored on the mobile device, allowing use of the mode in custom automations on the mobile device.', 'https://github.com/sburke781/MobileController/blob/master/Settings.md#synchronizing-he-modes')}", required: true, submitOnChange: true, defaultValue: false)
input ("controlModes", "bool", title: "Allow Control of HE Mode From The Device? ${getZindexToggle('controlModes')} ${getTooltipHTML('Control HE Modes', 'Allows changes to the HE mode to be initiated on the mobile device through elements such as a home-screen widget.', 'https://github.com/sburke781/MobileController/blob/master/Settings.md#control-he-modes')}", required: true, submitOnChange: true, defaultValue: false)
input ("cloudComms", "bool", title: "Allow Cloud Communication? ${getZindexToggle('cloudComms')} ${getTooltipHTML('Cloud Communication', 'Allows the mobile controller to send status updates and other commands from the mobile device when not connected to the HE hub over a local Wi-Fi or VPN connection.', 'https://github.com/sburke781/MobileController/blob/master/Settings.md#cloud-communication')}", required: true, submitOnChange: true, defaultValue: false)
input ("useVPN", "bool", title: "Communicate using VPN Connection When Available? ${getZindexToggle('useVPN')} ${getTooltipHTML('VPN Connection', 'If a VPN connection is available (connected) on the mobile device, this will be used when communicating from HE to the mobile device.', 'https://github.com/sburke781/MobileController/blob/master/Settings.md#vpn-connection')}", required: true, submitOnChange: true, defaultValue: false)
input ("vpnIP", "string", title: "Mobile Device VPN IP Address", required: false, submitOnChange: true, defaultValue: '')
paragraph "Click Next to apply the configuration settings"
}
}
}
// ------------------------- end of Simon's tooltips methods -------------------------
@CompileStatic
void testFunc( par) {
parse('catchall: 0104 EF00 01 01 0040 00 7770 01 00 0000 02 01 00556701000100')
}
// catchall: 0104 EF00 01 01 0040 00 7770 01 00 0000 02 01 00556701000100
void test(String par) {
long startTime = now()
logDebug "test() started at ${startTime}"
//parse('catchall: 0104 EF00 01 01 0040 00 7770 01 00 0000 02 01 00556701000100')
def parpar = 'catchall: 0104 EF00 01 01 0040 00 7770 01 00 0000 02 01 00556701000100'
for (int i=0; i<100; i++) {
testFunc(parpar)
}
long endTime = now()
logDebug "test() ended at ${endTime} (duration ${endTime - startTime}ms)"
}
// /////////////////////////////////////////////////////////////////// Libraries //////////////////////////////////////////////////////////////////////
// ~~~~~ start include (168) kkossev.illuminanceLib ~~~~~
/* groovylint-disable CompileStatic, CouldBeSwitchStatement, DuplicateListLiteral, DuplicateNumberLiteral, DuplicateStringLiteral, ImplicitClosureParameter, ImplicitReturnStatement, Instanceof, LineLength, MethodCount, MethodSize, NoDouble, NoFloat, NoWildcardImports, ParameterCount, ParameterName, PublicMethodsBeforeNonPublicMethods, UnnecessaryElseStatement, UnnecessaryGetter, UnnecessaryPublicModifier, UnnecessarySetter, UnusedImport */ // library marker kkossev.illuminanceLib, line 1
library( // library marker kkossev.illuminanceLib, line 2
base: 'driver', // library marker kkossev.illuminanceLib, line 3
author: 'Krassimir Kossev', // library marker kkossev.illuminanceLib, line 4
category: 'zigbee', // library marker kkossev.illuminanceLib, line 5
description: 'Zigbee Illuminance Library', // library marker kkossev.illuminanceLib, line 6
name: 'illuminanceLib', // library marker kkossev.illuminanceLib, line 7
namespace: 'kkossev', // library marker kkossev.illuminanceLib, line 8
importUrl: 'https://raw.githubusercontent.com/kkossev/hubitat/development/libraries/illuminanceLib.groovy', // library marker kkossev.illuminanceLib, line 9
version: '3.0.1', // library marker kkossev.illuminanceLib, line 10
documentationLink: '' // library marker kkossev.illuminanceLib, line 11
) // library marker kkossev.illuminanceLib, line 12
/* // library marker kkossev.illuminanceLib, line 13
* Zigbee Illuminance Library // library marker kkossev.illuminanceLib, line 14
* // library marker kkossev.illuminanceLib, line 15
* Licensed Virtual the Apache License, Version 2.0 (the "License"); you may not use this file except // library marker kkossev.illuminanceLib, line 16
* in compliance with the License. You may obtain a copy of the License at: // library marker kkossev.illuminanceLib, line 17
* // library marker kkossev.illuminanceLib, line 18
* http://www.apache.org/licenses/LICENSE-2.0 // library marker kkossev.illuminanceLib, line 19
* // library marker kkossev.illuminanceLib, line 20
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed // library marker kkossev.illuminanceLib, line 21
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License // library marker kkossev.illuminanceLib, line 22
* for the specific language governing permissions and limitations under the License. // library marker kkossev.illuminanceLib, line 23
* // library marker kkossev.illuminanceLib, line 24
* ver. 3.0.0 2024-04-06 kkossev - added illuminanceLib.groovy // library marker kkossev.illuminanceLib, line 25
* // library marker kkossev.illuminanceLib, line 26
* TODO: illum threshold not working! // library marker kkossev.illuminanceLib, line 27
* TODO: check illuminanceInitializeVars() and illuminanceProcessTuyaDP() usage // library marker kkossev.illuminanceLib, line 28
*/ // library marker kkossev.illuminanceLib, line 29
static String illuminanceLibVersion() { '3.0.1' } // library marker kkossev.illuminanceLib, line 31
static String illuminanceLibStamp() { '2024/04/26 8:06 AM' } // library marker kkossev.illuminanceLib, line 32
metadata { // library marker kkossev.illuminanceLib, line 34
// no capabilities // library marker kkossev.illuminanceLib, line 35
// no attributes // library marker kkossev.illuminanceLib, line 36
// no commands // library marker kkossev.illuminanceLib, line 37
preferences { // library marker kkossev.illuminanceLib, line 38
// no prefrences // library marker kkossev.illuminanceLib, line 39
} // library marker kkossev.illuminanceLib, line 40
} // library marker kkossev.illuminanceLib, line 41
@Field static final Integer DEFAULT_ILLUMINANCE_THRESHOLD = 10 // library marker kkossev.illuminanceLib, line 43
void customParseIlluminanceCluster(final Map descMap) { // library marker kkossev.illuminanceLib, line 45
if (descMap.value == null || descMap.value == 'FFFF') { return } // invalid or unknown value // library marker kkossev.illuminanceLib, line 46
final int value = hexStrToUnsignedInt(descMap.value) // library marker kkossev.illuminanceLib, line 47
int lux = value > 0 ? Math.round(Math.pow(10, (value / 10000))) : 0 // library marker kkossev.illuminanceLib, line 48
handleIlluminanceEvent(lux) // library marker kkossev.illuminanceLib, line 49
} // library marker kkossev.illuminanceLib, line 50
void handleIlluminanceEvent(int illuminance, boolean isDigital=false) { // library marker kkossev.illuminanceLib, line 52
Map eventMap = [:] // library marker kkossev.illuminanceLib, line 53
if (state.stats != null) { state.stats['illumCtr'] = (state.stats['illumCtr'] ?: 0) + 1 } else { state.stats = [:] } // library marker kkossev.illuminanceLib, line 54
eventMap.name = 'illuminance' // library marker kkossev.illuminanceLib, line 55
Integer illumCorrected = Math.round((illuminance * ((settings?.illuminanceCoeff ?: 1.00) as float))) // library marker kkossev.illuminanceLib, line 56
eventMap.value = illumCorrected // library marker kkossev.illuminanceLib, line 57
eventMap.type = isDigital ? 'digital' : 'physical' // library marker kkossev.illuminanceLib, line 58
eventMap.unit = 'lx' // library marker kkossev.illuminanceLib, line 59
eventMap.descriptionText = "${eventMap.name} is ${eventMap.value} ${eventMap.unit}" // library marker kkossev.illuminanceLib, line 60
Integer timeElapsed = Math.round((now() - (state.lastRx['illumTime'] ?: now())) / 1000) // library marker kkossev.illuminanceLib, line 61
Integer minTime = settings?.minReportingTime ?: DEFAULT_MIN_REPORTING_TIME // library marker kkossev.illuminanceLib, line 62
Integer timeRamaining = (minTime - timeElapsed) as Integer // library marker kkossev.illuminanceLib, line 63
Integer lastIllum = device.currentValue('illuminance') ?: 0 // library marker kkossev.illuminanceLib, line 64
Integer delta = Math.abs(lastIllum - illumCorrected) // library marker kkossev.illuminanceLib, line 65
if (delta < ((settings?.illuminanceThreshold ?: DEFAULT_ILLUMINANCE_THRESHOLD) as int)) { // library marker kkossev.illuminanceLib, line 66
logDebug "