mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-10 16:07:23 -06:00
only trigger ETL if newState != oldState
This commit is contained in:
@@ -164,6 +164,14 @@ func callEntityListeners(app *App, msgBytes []byte) {
|
|||||||
return
|
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 {
|
for _, l := range listeners {
|
||||||
// Check conditions
|
// Check conditions
|
||||||
if c := checkWithinTimeRange(l.betweenStart, l.betweenEnd); c.fail {
|
if c := checkWithinTimeRange(l.betweenStart, l.betweenEnd); c.fail {
|
||||||
|
|||||||
Reference in New Issue
Block a user