only trigger ETL if newState != oldState

This commit is contained in:
Sam Lewis
2022-11-10 20:32:32 -05:00
parent f6c68fe8ca
commit 83998b5e7e

View File

@@ -164,6 +164,14 @@ func callEntityListeners(app *App, msgBytes []byte) {
return
}
// if new state is same as old state, don't call
// event listener. I noticed this with iOS app location,
// every time I refresh the app it triggers a device_tracker
// entity listener.
if msg.Event.Data.NewState.State == msg.Event.Data.OldState.State {
return
}
for _, l := range listeners {
// Check conditions
if c := checkWithinTimeRange(l.betweenStart, l.betweenEnd); c.fail {