Improve detection of connection
This commit is contained in:
		@@ -278,24 +278,26 @@ api:
 | 
				
			|||||||
    - logger.log:
 | 
					    - logger.log:
 | 
				
			||||||
        format: "Client %s (IP %s) connected to API"
 | 
					        format: "Client %s (IP %s) connected to API"
 | 
				
			||||||
        args: ["client_info.c_str()", "client_address.c_str()"]
 | 
					        args: ["client_info.c_str()", "client_address.c_str()"]
 | 
				
			||||||
    - script.execute: light_off
 | 
					 | 
				
			||||||
    - if:
 | 
					    - if:
 | 
				
			||||||
        condition:
 | 
					        condition:
 | 
				
			||||||
          - switch.is_on: enable_voice_support
 | 
					          - switch.is_on: enable_voice_support
 | 
				
			||||||
        then:
 | 
					        then:
 | 
				
			||||||
          - micro_wake_word.start:
 | 
					          - micro_wake_word.start:
 | 
				
			||||||
 | 
					    - script.execute: light_off
 | 
				
			||||||
 | 
					    - delay: 1s
 | 
				
			||||||
 | 
					    - script.execute: light_off
 | 
				
			||||||
  on_client_disconnected:
 | 
					  on_client_disconnected:
 | 
				
			||||||
    - logger.log:
 | 
					    - logger.log:
 | 
				
			||||||
        format: "Client %s (IP %s) disconnected from API"
 | 
					        format: "Client %s (IP %s) disconnected from API"
 | 
				
			||||||
        args: ["client_info.c_str()", "client_address.c_str()"]
 | 
					        args: ["client_info.c_str()", "client_address.c_str()"]
 | 
				
			||||||
    - light.turn_on:
 | 
					 | 
				
			||||||
        id: output_led
 | 
					 | 
				
			||||||
        effect: flash_white
 | 
					 | 
				
			||||||
    - if:
 | 
					    - if:
 | 
				
			||||||
        condition:
 | 
					        condition:
 | 
				
			||||||
          - switch.is_on: enable_voice_support
 | 
					          - switch.is_on: enable_voice_support
 | 
				
			||||||
        then:
 | 
					        then:
 | 
				
			||||||
          - micro_wake_word.stop:
 | 
					          - micro_wake_word.stop:
 | 
				
			||||||
 | 
					    - light.turn_on:
 | 
				
			||||||
 | 
					        id: output_led
 | 
				
			||||||
 | 
					        effect: flash_white
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ota:
 | 
					ota:
 | 
				
			||||||
  platform: esphome
 | 
					  platform: esphome
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user