github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/doc/content/en/docs/dashboard/automation/conditions.md (about) 1 2 --- 3 title: "Conditions" 4 linkTitle: "Conditions" 5 date: 2021-10-20 6 description: > 7 8 --- 9 10 {{< figure src="/smart-home/condition_window1.png" >}} 11 12 13 14 15 16 A condition defines an additional check that needs to be performed before executing the scenario. This condition can check the current state of a device or other factors. The condition is an optional component, and if it is present, the execution of the scenario will depend on its result. 17 18 Example implementation of a condition handler: 19 ```coffeescript 20 automationCondition = (entityId)-> 21 entity = EntityGetState(entityId) 22 if !entity || !entity.state 23 return false 24 if entity.state.name == 'ON' 25 return true 26 return false 27 ```