Skip to content

Commit

Permalink
improve logging on event latencies
Browse files Browse the repository at this point in the history
  • Loading branch information
imnotbob authored Jun 14, 2017
1 parent b790f4c commit 1d58675
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions smartapps/tonesto7/nst-automations.src/nst-automations.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ definition(
appSetting "devOpt"
}

def appVersion() { "5.1.2" }
def appVerDate() { "6-13-2017" }
def appVersion() { "5.1.3" }
def appVerDate() { "6-14-2017" }

preferences {
//startPage
Expand Down Expand Up @@ -1305,7 +1305,9 @@ def getAutoActionData() {
}

def automationGenericEvt(evt) {
LogAction("${evt?.name.toUpperCase()} Event | Device: ${evt?.displayName} | Value: (${strCapitalize(evt?.value)})", "trace", true)
def startTime = now()
def eventDelay = startTime - evt.date.getTime()
LogAction("${evt?.name.toUpperCase()} Event | Device: ${evt?.displayName} | Value: (${strCapitalize(evt?.value)}) with a delay of ${eventDelay}ms", "trace", true)
if(isRemSenConfigured() && settings?.vthermostat) {
atomicState.needChildUpdate = true
}
Expand Down Expand Up @@ -1342,7 +1344,9 @@ def watchDogPage() {
}

def automationSafetyTempEvt(evt) {
LogAction("Event | Thermostat Safety Temp Exceeded: '${evt.displayName}' (${evt.value})", "trace", true)
def startTime = now()
def eventDelay = startTime - evt.date.getTime()
LogAction("Event | Thermostat Safety Temp Exceeded: '${evt.displayName}' (${evt.value}) with a delay of ${eventDelay}ms", "trace", true)
if(atomicState?.disableAutomation) { return }
else {
if(evt?.value == "true") {
Expand Down Expand Up @@ -1493,7 +1497,9 @@ def getLastMotionInActiveSec(mySched) {
}

def automationMotionEvt(evt) {
LogAction("${evt?.name.toUpperCase()} Event | Device: '${evt?.displayName}' | Motion: (${strCapitalize(evt?.value)})", "trace", true)
def startTime = now()
def eventDelay = startTime - evt.date.getTime()
LogAction("${evt?.name.toUpperCase()} Event | Device: '${evt?.displayName}' | Motion: (${strCapitalize(evt?.value)}) with a delay of ${eventDelay}ms", "trace", true)
if(atomicState?.disableAutomation) { return }
else {
storeLastEventData(evt)
Expand Down Expand Up @@ -3268,7 +3274,9 @@ def extTmpTempCheck(cTimeOut = false) {
}

def extTmpGenericEvt(evt) {
LogAction("${evt?.name.toUpperCase()} Event | Device: ${evt?.displayName} | Value: (${strCapitalize(evt?.value)})", "trace", true)
def startTime = now()
def eventDelay = startTime - evt.date.getTime()
LogAction("${evt?.name.toUpperCase()} Event | Device: ${evt?.displayName} | Value: (${strCapitalize(evt?.value)}) with a delay of ${eventDelay}ms", "trace", true)
storeLastEventData(evt)
extTmpDpOrTempEvt("${evt?.name}")
}
Expand Down Expand Up @@ -3557,7 +3565,9 @@ def conWatCheck(cTimeOut = false) {
}

def conWatContactEvt(evt) {
LogAction("${evt?.name.toUpperCase()} Event | Device: ${evt?.displayName} | Value: (${strCapitalize(evt?.value)})", "trace", true)
def startTime = now()
def eventDelay = startTime - evt.date.getTime()
LogAction("${evt?.name.toUpperCase()} Event | Device: ${evt?.displayName} | Value: (${strCapitalize(evt?.value)}) with a delay of ${eventDelay}ms", "trace", true)
if(atomicState?.disableAutomation) { return }
else {
def conWatTstat = settings?.schMotTstat
Expand Down Expand Up @@ -3776,7 +3786,9 @@ def leakWatCheck() {
}

def leakWatSensorEvt(evt) {
LogAction("${evt?.name.toUpperCase()} Event | Device: ${evt?.displayName} | Value: (${strCapitalize(evt?.value)})", "trace", true)
def startTime = now()
def eventDelay = startTime - evt.date.getTime()
LogAction("${evt?.name.toUpperCase()} Event | Device: ${evt?.displayName} | Value: (${strCapitalize(evt?.value)}) with a delay of ${eventDelay}ms", "trace", true)
if(atomicState?.disableAutomation) { return }
else {
def curMode = leakWatTstat?.currentThermostatMode.toString()
Expand Down Expand Up @@ -3921,7 +3933,9 @@ def isNestModesConfigured() {
}

def nModeGenericEvt(evt) {
LogAction("${evt?.name.toUpperCase()} Event | Device: ${evt?.displayName} | Value: (${strCapitalize(evt?.value)})", "trace", true)
def startTime = now()
def eventDelay = startTime - evt.date.getTime()
LogAction("${evt?.name.toUpperCase()} Event | Device: ${evt?.displayName} | Value: (${strCapitalize(evt?.value)}) with a delay of ${eventDelay}ms", "trace", true)
if(atomicState?.disableAutomation) { return }
storeLastEventData(evt)
if(nModeDelay) {
Expand Down

0 comments on commit 1d58675

Please sign in to comment.