mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 06:33:51 +00:00 
			
		
		
		
	[switch] Add trigger `on_state` (#10108)
				
					
				
			This commit is contained in:
		| @@ -9,6 +9,18 @@ switch: | ||||
|     name: "Template Switch" | ||||
|     id: the_switch | ||||
|     optimistic: true | ||||
|     on_state: | ||||
|       - if: | ||||
|           condition: | ||||
|             - lambda: return x; | ||||
|           then: | ||||
|             - logger.log: "Switch turned ON" | ||||
|           else: | ||||
|             - logger.log: "Switch turned OFF" | ||||
|     on_turn_on: | ||||
|       - logger.log: "Switch is now ON" | ||||
|     on_turn_off: | ||||
|       - logger.log: "Switch is now OFF" | ||||
|  | ||||
| esphome: | ||||
|   on_boot: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user