refactor all automation types to take a list

This commit is contained in:
Sam Lewis
2023-10-22 18:07:42 -04:00
parent 3ec6608714
commit 824d6c12d1
4 changed files with 36 additions and 42 deletions

View File

@@ -121,9 +121,6 @@ func (sb scheduleBuilderEnd) EnabledWhen(entityId, state string, runOnNetworkErr
if entityId == "" {
panic(fmt.Sprintf("entityId is empty in EnabledWhen entityId='%s' state='%s'", entityId, state))
}
if len(sb.schedule.disabledEntities) != 0 {
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))
}
i := internal.EnabledDisabledInfo{
Entity: entityId,
State: state,
@@ -141,9 +138,6 @@ func (sb scheduleBuilderEnd) DisabledWhen(entityId, state string, runOnNetworkEr
if entityId == "" {
panic(fmt.Sprintf("entityId is empty in EnabledWhen entityId='%s' state='%s'", entityId, state))
}
if len(sb.schedule.enabledEntities) != 0 {
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))
}
i := internal.EnabledDisabledInfo{
Entity: entityId,
State: state,