mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Add ability to have same entity names on different sub devices (#9355)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
		| @@ -54,3 +54,45 @@ sensor: | ||||
|     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" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user