mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Binary sensor map implementation (#551)
* add binary_sensor_map c code * add python file * fixed python and C++ code for new framework * renamed add_sensor to add_channel * travis * Updates - Use struct for channels_ array - heap allocation is not really necessary here. - any_active can also be written as mask != 0 - Update setup priority to DATA - Use shorter TAG (name is already long; not important) - Quotes around name - Add icon to sensor - Use new cv.typed_schema - Change CONF_CHANNEL to CONF_BINARY_SENSOR - makes it clearer that this option accepts a binary sensor (and not for example an int) - Add test Co-authored-by: Otto Winter <otto@otto-winter.com>
This commit is contained in:
		
				
					committed by
					
						 Otto Winter
						Otto Winter
					
				
			
			
				
	
			
			
			
						parent
						
							5893506528
						
					
				
				
					commit
					9d26c16471
				
			| @@ -152,6 +152,16 @@ sensor: | ||||
|     sensors: | ||||
|       - id: custom_sensor | ||||
|         name: Custom Sensor | ||||
|   - platform: binary_sensor_map | ||||
|     name: Binary Sensor Map | ||||
|     type: group | ||||
|     channels: | ||||
|       - binary_sensor: bin1 | ||||
|         value: 10.0 | ||||
|       - binary_sensor: bin2 | ||||
|         value: 15.0 | ||||
|       - binary_sensor: bin3 | ||||
|         value: 100.0 | ||||
|  | ||||
| time: | ||||
| - platform: homeassistant | ||||
| @@ -196,12 +206,15 @@ binary_sensor: | ||||
|   - platform: mpr121 | ||||
|     channel: 1 | ||||
|     name: "touchkey1" | ||||
|     id: bin1 | ||||
|   - platform: mpr121 | ||||
|     channel: 2 | ||||
|     name: "touchkey2" | ||||
|     id: bin2 | ||||
|   - platform: mpr121 | ||||
|     channel: 3 | ||||
|     name: "touchkey3" | ||||
|     id: bin3 | ||||
|     on_press: | ||||
|       then: | ||||
|         - switch.toggle: mpr121_toggle | ||||
|   | ||||
		Reference in New Issue
	
	Block a user