mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
		
			
				
	
	
		
			99 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			99 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| esphome:
 | |
|   name: areas-devices-test
 | |
|   # Define top-level area
 | |
|   area:
 | |
|     id: living_room_area
 | |
|     name: Living Room
 | |
|   # Define additional areas
 | |
|   areas:
 | |
|     - id: bedroom_area
 | |
|       name: Bedroom
 | |
|     - id: kitchen_area
 | |
|       name: Kitchen
 | |
|   # Define devices with area assignments
 | |
|   devices:
 | |
|     - id: light_controller_device
 | |
|       name: Light Controller
 | |
|       area_id: living_room_area  # Uses top-level area
 | |
|     - id: temp_sensor_device
 | |
|       name: Temperature Sensor
 | |
|       area_id: bedroom_area
 | |
|     - id: motion_detector_device
 | |
|       name: Motion Detector
 | |
|       area_id: living_room_area  # Reuses top-level area
 | |
|     - id: smart_switch_device
 | |
|       name: Smart Switch
 | |
|       area_id: kitchen_area
 | |
| 
 | |
| host:
 | |
| api:
 | |
| logger:
 | |
| 
 | |
| # Sensors assigned to different devices
 | |
| sensor:
 | |
|   - platform: template
 | |
|     name: Light Controller Sensor
 | |
|     device_id: light_controller_device
 | |
|     lambda: return 1.0;
 | |
|     update_interval: 0.1s
 | |
| 
 | |
|   - platform: template
 | |
|     name: Temperature Sensor Reading
 | |
|     device_id: temp_sensor_device
 | |
|     lambda: return 2.0;
 | |
|     update_interval: 0.1s
 | |
| 
 | |
|   - platform: template
 | |
|     name: Motion Detector Status
 | |
|     device_id: motion_detector_device
 | |
|     lambda: return 3.0;
 | |
|     update_interval: 0.1s
 | |
| 
 | |
|   - platform: template
 | |
|     name: Smart Switch Power
 | |
|     device_id: smart_switch_device
 | |
|     lambda: return 4.0;
 | |
|     update_interval: 0.1s
 | |
| 
 | |
| # Switches with the same name on different devices to test device_id lookup
 | |
| switch:
 | |
|   # Switch with no device_id (defaults to 0)
 | |
|   - platform: template
 | |
|     name: Test Switch
 | |
|     id: test_switch_main
 | |
|     optimistic: true
 | |
|     turn_on_action:
 | |
|       - logger.log: "Turning on Test Switch on Main Device (no device_id)"
 | |
|     turn_off_action:
 | |
|       - logger.log: "Turning off Test Switch on Main Device (no device_id)"
 | |
| 
 | |
|   - platform: template
 | |
|     name: Test Switch
 | |
|     device_id: light_controller_device
 | |
|     id: test_switch_light_controller
 | |
|     optimistic: true
 | |
|     turn_on_action:
 | |
|       - logger.log: "Turning on Test Switch on Light Controller"
 | |
|     turn_off_action:
 | |
|       - logger.log: "Turning off Test Switch on Light Controller"
 | |
| 
 | |
|   - platform: template
 | |
|     name: Test Switch
 | |
|     device_id: temp_sensor_device
 | |
|     id: test_switch_temp_sensor
 | |
|     optimistic: true
 | |
|     turn_on_action:
 | |
|       - logger.log: "Turning on Test Switch on Temperature Sensor"
 | |
|     turn_off_action:
 | |
|       - logger.log: "Turning off Test Switch on Temperature Sensor"
 | |
| 
 | |
|   - platform: template
 | |
|     name: Test Switch
 | |
|     device_id: motion_detector_device
 | |
|     id: test_switch_motion_detector
 | |
|     optimistic: true
 | |
|     turn_on_action:
 | |
|       - logger.log: "Turning on Test Switch on Motion Detector"
 | |
|     turn_off_action:
 | |
|       - logger.log: "Turning off Test Switch on Motion Detector"
 |