mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-07 22:07:13 -06:00
rename to DisabledWhen and EnabledWhen
This commit is contained in:
@@ -160,12 +160,12 @@ func (b elBuilder3) RunOnStartup() elBuilder3 {
|
|||||||
Enable this listener only when the current state of {entityId} matches {state}.
|
Enable this listener only when the current state of {entityId} matches {state}.
|
||||||
If there is a network error while retrieving state, the listener runs if {runOnNetworkError} is true.
|
If there is a network error while retrieving state, the listener runs if {runOnNetworkError} is true.
|
||||||
*/
|
*/
|
||||||
func (b elBuilder3) EnabledEntity(entityId, state string, runOnNetworkError bool) elBuilder3 {
|
func (b elBuilder3) EnabledWhen(entityId, state string, runOnNetworkError bool) elBuilder3 {
|
||||||
if entityId == "" || state == "" {
|
if entityId == "" || state == "" {
|
||||||
panic(fmt.Sprintf("Either entityId or state is empty in EnabledEntity entityId='%s' state='%s'", entityId, state))
|
panic(fmt.Sprintf("Either entityId or state is empty in EnabledWhen entityId='%s' state='%s'", entityId, state))
|
||||||
}
|
}
|
||||||
if b.entityListener.enabledEntity != "" {
|
if b.entityListener.enabledEntity != "" {
|
||||||
panic(fmt.Sprintf("You can't use EnabledEntity and DisabledEntity together. Error occurred while setting EnabledEntity on an entity listener with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
panic(fmt.Sprintf("You can't use EnabledWhen and DisabledWhen together. Error occurred while setting EnabledWhen on an entity listener with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
||||||
}
|
}
|
||||||
b.entityListener.enabledEntity = entityId
|
b.entityListener.enabledEntity = entityId
|
||||||
b.entityListener.enabledEntityState = state
|
b.entityListener.enabledEntityState = state
|
||||||
@@ -177,12 +177,12 @@ func (b elBuilder3) EnabledEntity(entityId, state string, runOnNetworkError bool
|
|||||||
Disable this listener when the current state of {entityId} matches {state}.
|
Disable this listener when the current state of {entityId} matches {state}.
|
||||||
If there is a network error while retrieving state, the listener runs if {runOnNetworkError} is true.
|
If there is a network error while retrieving state, the listener runs if {runOnNetworkError} is true.
|
||||||
*/
|
*/
|
||||||
func (b elBuilder3) DisabledEntity(entityId, state string, runOnNetworkError bool) elBuilder3 {
|
func (b elBuilder3) DisabledWhen(entityId, state string, runOnNetworkError bool) elBuilder3 {
|
||||||
if entityId == "" || state == "" {
|
if entityId == "" || state == "" {
|
||||||
panic(fmt.Sprintf("Either entityId or state is empty in EnabledEntity entityId='%s' state='%s'", entityId, state))
|
panic(fmt.Sprintf("Either entityId or state is empty in EnabledWhen entityId='%s' state='%s'", entityId, state))
|
||||||
}
|
}
|
||||||
if b.entityListener.enabledEntity != "" {
|
if b.entityListener.enabledEntity != "" {
|
||||||
panic(fmt.Sprintf("You can't use EnabledEntity and DisabledEntity together. Error occurred while setting DisabledEntity on an entity listener with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
panic(fmt.Sprintf("You can't use EnabledWhen and DisabledWhen together. Error occurred while setting DisabledWhen on an entity listener with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
||||||
}
|
}
|
||||||
b.entityListener.disabledEntity = entityId
|
b.entityListener.disabledEntity = entityId
|
||||||
b.entityListener.disabledEntityState = state
|
b.entityListener.disabledEntityState = state
|
||||||
|
|||||||
@@ -102,12 +102,12 @@ func (b eventListenerBuilder3) ExceptionRange(start, end time.Time) eventListene
|
|||||||
Enable this listener only when the current state of {entityId} matches {state}.
|
Enable this listener only when the current state of {entityId} matches {state}.
|
||||||
If there is a network error while retrieving state, the listener runs if {runOnNetworkError} is true.
|
If there is a network error while retrieving state, the listener runs if {runOnNetworkError} is true.
|
||||||
*/
|
*/
|
||||||
func (b eventListenerBuilder3) EnabledEntity(entityId, state string, runOnNetworkError bool) eventListenerBuilder3 {
|
func (b eventListenerBuilder3) EnabledWhen(entityId, state string, runOnNetworkError bool) eventListenerBuilder3 {
|
||||||
if entityId == "" || state == "" {
|
if entityId == "" || state == "" {
|
||||||
panic(fmt.Sprintf("Either entityId or state is empty in eventListener.EnabledEntity entityId='%s' state='%s' runOnNetworkError='%t'", entityId, state, runOnNetworkError))
|
panic(fmt.Sprintf("Either entityId or state is empty in eventListener EnabledWhen entityId='%s' state='%s' runOnNetworkError='%t'", entityId, state, runOnNetworkError))
|
||||||
}
|
}
|
||||||
if b.eventListener.enabledEntity != "" {
|
if b.eventListener.enabledEntity != "" {
|
||||||
panic(fmt.Sprintf("You can't use EnabledEntity and DisabledEntity together. Error occurred while setting EnabledEntity entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
panic(fmt.Sprintf("You can't use EnabledWhen and DisabledWhen together. Error occurred while setting EnabledWhen entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
||||||
}
|
}
|
||||||
b.eventListener.enabledEntity = entityId
|
b.eventListener.enabledEntity = entityId
|
||||||
b.eventListener.enabledEntityState = state
|
b.eventListener.enabledEntityState = state
|
||||||
@@ -119,12 +119,12 @@ func (b eventListenerBuilder3) EnabledEntity(entityId, state string, runOnNetwor
|
|||||||
Disable this listener when the current state of {entityId} matches {state}.
|
Disable this listener when the current state of {entityId} matches {state}.
|
||||||
If there is a network error while retrieving state, the listener runs if {runOnNetworkError} is true.
|
If there is a network error while retrieving state, the listener runs if {runOnNetworkError} is true.
|
||||||
*/
|
*/
|
||||||
func (b eventListenerBuilder3) DisabledEntity(entityId, state string, runOnNetworkError bool) eventListenerBuilder3 {
|
func (b eventListenerBuilder3) DisabledWhen(entityId, state string, runOnNetworkError bool) eventListenerBuilder3 {
|
||||||
if entityId == "" || state == "" {
|
if entityId == "" || state == "" {
|
||||||
panic(fmt.Sprintf("Either entityId or state is empty in eventListener.EnabledEntity entityId='%s' state='%s' runOnNetworkError='%t'", entityId, state, runOnNetworkError))
|
panic(fmt.Sprintf("Either entityId or state is empty in eventListener EnabledWhen entityId='%s' state='%s' runOnNetworkError='%t'", entityId, state, runOnNetworkError))
|
||||||
}
|
}
|
||||||
if b.eventListener.enabledEntity != "" {
|
if b.eventListener.enabledEntity != "" {
|
||||||
panic(fmt.Sprintf("You can't use EnabledEntity and DisabledEntity together. Error occurred while setting DisabledEntity entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
panic(fmt.Sprintf("You can't use EnabledWhen and DisabledWhen together. Error occurred while setting DisabledWhen entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
||||||
}
|
}
|
||||||
b.eventListener.disabledEntity = entityId
|
b.eventListener.disabledEntity = entityId
|
||||||
b.eventListener.disabledEntityState = state
|
b.eventListener.disabledEntityState = state
|
||||||
|
|||||||
12
interval.go
12
interval.go
@@ -114,12 +114,12 @@ func (ib intervalBuilderEnd) ExceptionRange(start, end time.Time) intervalBuilde
|
|||||||
Enable this interval only when the current state of {entityId} matches {state}.
|
Enable this interval only when the current state of {entityId} matches {state}.
|
||||||
If there is a network error while retrieving state, the interval runs if {runOnNetworkError} is true.
|
If there is a network error while retrieving state, the interval runs if {runOnNetworkError} is true.
|
||||||
*/
|
*/
|
||||||
func (ib intervalBuilderEnd) EnabledEntity(entityId, state string, runOnNetworkError bool) intervalBuilderEnd {
|
func (ib intervalBuilderEnd) EnabledWhen(entityId, state string, runOnNetworkError bool) intervalBuilderEnd {
|
||||||
if entityId == "" || state == "" {
|
if entityId == "" || state == "" {
|
||||||
panic(fmt.Sprintf("Either entityId or state is empty in EnabledEntity entityId='%s' state='%s'", entityId, state))
|
panic(fmt.Sprintf("Either entityId or state is empty in EnabledWhen entityId='%s' state='%s'", entityId, state))
|
||||||
}
|
}
|
||||||
if ib.interval.enabledEntity != "" {
|
if ib.interval.enabledEntity != "" {
|
||||||
panic(fmt.Sprintf("You can't use EnabledEntity and DisabledEntity together. Error occurred while setting EnabledEntity on an entity listener with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
panic(fmt.Sprintf("You can't use EnabledWhen and DisabledWhen together. Error occurred while setting EnabledWhen on an entity listener with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
||||||
}
|
}
|
||||||
ib.interval.enabledEntity = entityId
|
ib.interval.enabledEntity = entityId
|
||||||
ib.interval.enabledEntityState = state
|
ib.interval.enabledEntityState = state
|
||||||
@@ -131,12 +131,12 @@ func (ib intervalBuilderEnd) EnabledEntity(entityId, state string, runOnNetworkE
|
|||||||
Disable this interval when the current state of {entityId} matches {state}.
|
Disable this interval when the current state of {entityId} matches {state}.
|
||||||
If there is a network error while retrieving state, the interval runs if {runOnNetworkError} is true.
|
If there is a network error while retrieving state, the interval runs if {runOnNetworkError} is true.
|
||||||
*/
|
*/
|
||||||
func (ib intervalBuilderEnd) DisabledEntity(entityId, state string, runOnNetworkError bool) intervalBuilderEnd {
|
func (ib intervalBuilderEnd) DisabledWhen(entityId, state string, runOnNetworkError bool) intervalBuilderEnd {
|
||||||
if entityId == "" || state == "" {
|
if entityId == "" || state == "" {
|
||||||
panic(fmt.Sprintf("Either entityId or state is empty in EnabledEntity entityId='%s' state='%s'", entityId, state))
|
panic(fmt.Sprintf("Either entityId or state is empty in EnabledWhen entityId='%s' state='%s'", entityId, state))
|
||||||
}
|
}
|
||||||
if ib.interval.enabledEntity != "" {
|
if ib.interval.enabledEntity != "" {
|
||||||
panic(fmt.Sprintf("You can't use EnabledEntity and DisabledEntity together. Error occurred while setting DisabledEntity on an entity listener with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
panic(fmt.Sprintf("You can't use EnabledWhen and DisabledWhen together. Error occurred while setting DisabledWhen on an entity listener with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
||||||
}
|
}
|
||||||
ib.interval.disabledEntity = entityId
|
ib.interval.disabledEntity = entityId
|
||||||
ib.interval.disabledEntityState = state
|
ib.interval.disabledEntityState = state
|
||||||
|
|||||||
12
schedule.go
12
schedule.go
@@ -121,12 +121,12 @@ func (sb scheduleBuilderEnd) OnlyOnDates(t time.Time, tl ...time.Time) scheduleB
|
|||||||
Enable this schedule only when the current state of {entityId} matches {state}.
|
Enable this schedule only when the current state of {entityId} matches {state}.
|
||||||
If there is a network error while retrieving state, the schedule runs if {runOnNetworkError} is true.
|
If there is a network error while retrieving state, the schedule runs if {runOnNetworkError} is true.
|
||||||
*/
|
*/
|
||||||
func (sb scheduleBuilderEnd) EnabledEntity(entityId, state string, runOnNetworkError bool) scheduleBuilderEnd {
|
func (sb scheduleBuilderEnd) EnabledWhen(entityId, state string, runOnNetworkError bool) scheduleBuilderEnd {
|
||||||
if entityId == "" || state == "" {
|
if entityId == "" || state == "" {
|
||||||
panic(fmt.Sprintf("Either entityId or state is empty in EnabledEntity entityId='%s' state='%s'", entityId, state))
|
panic(fmt.Sprintf("Either entityId or state is empty in EnabledWhen entityId='%s' state='%s'", entityId, state))
|
||||||
}
|
}
|
||||||
if sb.schedule.enabledEntity != "" {
|
if sb.schedule.enabledEntity != "" {
|
||||||
panic(fmt.Sprintf("You can't use EnabledEntity and DisabledEntity together. Error occurred while setting EnabledEntity on a schedule with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
panic(fmt.Sprintf("You can't use EnabledWhen and DisabledWhen together. Error occurred while setting EnabledWhen on a schedule with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
||||||
}
|
}
|
||||||
sb.schedule.enabledEntity = entityId
|
sb.schedule.enabledEntity = entityId
|
||||||
sb.schedule.enabledEntityState = state
|
sb.schedule.enabledEntityState = state
|
||||||
@@ -138,12 +138,12 @@ func (sb scheduleBuilderEnd) EnabledEntity(entityId, state string, runOnNetworkE
|
|||||||
Disable this schedule when the current state of {entityId} matches {state}.
|
Disable this schedule when the current state of {entityId} matches {state}.
|
||||||
If there is a network error while retrieving state, the schedule runs if {runOnNetworkError} is true.
|
If there is a network error while retrieving state, the schedule runs if {runOnNetworkError} is true.
|
||||||
*/
|
*/
|
||||||
func (sb scheduleBuilderEnd) DisabledEntity(entityId, state string, runOnNetworkError bool) scheduleBuilderEnd {
|
func (sb scheduleBuilderEnd) DisabledWhen(entityId, state string, runOnNetworkError bool) scheduleBuilderEnd {
|
||||||
if entityId == "" || state == "" {
|
if entityId == "" || state == "" {
|
||||||
panic(fmt.Sprintf("Either entityId or state is empty in EnabledEntity entityId='%s' state='%s'", entityId, state))
|
panic(fmt.Sprintf("Either entityId or state is empty in EnabledWhen entityId='%s' state='%s'", entityId, state))
|
||||||
}
|
}
|
||||||
if sb.schedule.enabledEntity != "" {
|
if sb.schedule.enabledEntity != "" {
|
||||||
panic(fmt.Sprintf("You can't use EnabledEntity and DisabledEntity together. Error occurred while setting DisabledEntity on a schedule with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
panic(fmt.Sprintf("You can't use EnabledWhen and DisabledWhen together. Error occurred while setting DisabledWhen on a schedule with params entityId=%s state=%s runOnNetworkError=%t", entityId, state, runOnNetworkError))
|
||||||
}
|
}
|
||||||
sb.schedule.disabledEntity = entityId
|
sb.schedule.disabledEntity = entityId
|
||||||
sb.schedule.disabledEntityState = state
|
sb.schedule.disabledEntityState = state
|
||||||
|
|||||||
Reference in New Issue
Block a user