Skip to content

Commit edd2ee6

Browse files
authored
Merge pull request #4 from stjohnjohnson/push-events
Push current state every 30 minutes
2 parents 2b83d6b + aab5644 commit edd2ee6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

smartapps/stj/mqtt-bridge.src/mqtt-bridge.groovy

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ def initialize() {
508508

509509
// Update the bridge
510510
updateSubscription()
511+
// Auto-update every 30 minutes
512+
schedule("0 0/30 * * * ?", updateSubscription)
511513
}
512514

513515
// Update the bridge"s subscription
@@ -522,6 +524,12 @@ def updateSubscription() {
522524
}
523525
settings[key].each {device ->
524526
attributes[attribute].push(device.displayName)
527+
// Send current value
528+
inputHandler([
529+
displayName: device.displayName,
530+
value: device.currentState(attribute).value,
531+
name: attribute
532+
])
525533
}
526534
}
527535
}
@@ -533,7 +541,6 @@ def updateSubscription() {
533541
])
534542

535543
log.debug "Updating subscription: ${json}"
536-
537544
bridge.deviceNotification(json)
538545
}
539546

0 commit comments

Comments
 (0)