mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-24 13:14:10 +00:00
added an initialization of the atomicState.eventBuffer if the eventBuffer is null when handling an event
This commit is contained in:
@@ -341,6 +341,13 @@ def eventHandler(name, value) {
|
|||||||
|
|
||||||
def eventBuffer = atomicState.eventBuffer
|
def eventBuffer = atomicState.eventBuffer
|
||||||
def epoch = now() / 1000
|
def epoch = now() / 1000
|
||||||
|
|
||||||
|
// if for some reason this code block is being run
|
||||||
|
// but the SmartApp wasn't propery setup during install
|
||||||
|
// we need to set initialize the eventBuffer.
|
||||||
|
if (!atomicState.eventBuffer) {
|
||||||
|
atomicState.eventBuffer = []
|
||||||
|
}
|
||||||
eventBuffer << [key: "$name", value: "$value", epoch: "$epoch"]
|
eventBuffer << [key: "$name", value: "$value", epoch: "$epoch"]
|
||||||
|
|
||||||
log.debug eventBuffer
|
log.debug eventBuffer
|
||||||
|
|||||||
Reference in New Issue
Block a user