mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-10 04:07:28 -06:00
refactor: move event_types into types/ pkg, make methods public, small fixes
This commit is contained in:
@@ -93,7 +93,7 @@ func (b eventListenerBuilder3) ExceptionDates(t time.Time, tl ...time.Time) even
|
||||
}
|
||||
|
||||
func (b eventListenerBuilder3) ExceptionRange(start, end time.Time) eventListenerBuilder3 {
|
||||
b.eventListener.exceptionRanges = append(b.eventListener.exceptionRanges, types.TimeRange{start, end})
|
||||
b.eventListener.exceptionRanges = append(b.eventListener.exceptionRanges, types.TimeRange{Start: start, End: end})
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -153,22 +153,22 @@ func callEventListeners(app *App, msg ws.ChanMsg) {
|
||||
|
||||
for _, l := range listeners {
|
||||
// Check conditions
|
||||
if c := checkWithinTimeRange(l.betweenStart, l.betweenEnd); c.fail {
|
||||
if c := CheckWithinTimeRange(l.betweenStart, l.betweenEnd); c.fail {
|
||||
continue
|
||||
}
|
||||
if c := checkThrottle(l.throttle, l.lastRan); c.fail {
|
||||
if c := CheckThrottle(l.throttle, l.lastRan); c.fail {
|
||||
continue
|
||||
}
|
||||
if c := checkExceptionDates(l.exceptionDates); c.fail {
|
||||
if c := CheckExceptionDates(l.exceptionDates); c.fail {
|
||||
continue
|
||||
}
|
||||
if c := checkExceptionRanges(l.exceptionRanges); c.fail {
|
||||
if c := CheckExceptionRanges(l.exceptionRanges); c.fail {
|
||||
continue
|
||||
}
|
||||
if c := checkEnabledEntity(app.state, l.enabledEntities); c.fail {
|
||||
if c := CheckEnabledEntity(app.state, l.enabledEntities); c.fail {
|
||||
continue
|
||||
}
|
||||
if c := checkDisabledEntity(app.state, l.disabledEntities); c.fail {
|
||||
if c := CheckDisabledEntity(app.state, l.disabledEntities); c.fail {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user