mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Home Assistant platform tests
This commit is contained in:
		| @@ -687,13 +687,17 @@ def file_(value): | |||||||
|     return value |     return value | ||||||
|  |  | ||||||
|  |  | ||||||
| ENTITY_ID_PATTERN = re.compile(r"^([a-z0-9]+)\.([a-z0-9]+)$") | ENTITY_ID_CHARACTERS = 'abcdefghijklmnopqrstuvwxyz0123456789_' | ||||||
|  |  | ||||||
|  |  | ||||||
| def entity_id(value): | def entity_id(value): | ||||||
|     value = string_strict(value).lower() |     value = string_strict(value).lower() | ||||||
|     if ENTITY_ID_PATTERN.match(value) is None: |     if value.count('.') != 1: | ||||||
|         raise vol.Invalid(u"Invalid entity ID: {}".format(value)) |         raise vol.Invalid("Entity ID must have exactly one dot in it") | ||||||
|  |     for x in value.split('.'): | ||||||
|  |         for c in x: | ||||||
|  |             if c not in ENTITY_ID_CHARACTERS: | ||||||
|  |                 raise vol.Invalid("Invalid character for entity ID: {}".format(c)) | ||||||
|     return value |     return value | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -31,6 +31,8 @@ mqtt: | |||||||
|   username: 'debug' |   username: 'debug' | ||||||
|   password: 'debug' |   password: 'debug' | ||||||
|  |  | ||||||
|  | api: | ||||||
|  |  | ||||||
| i2c: | i2c: | ||||||
|   sda: 21 |   sda: 21 | ||||||
|   scl: 22 |   scl: 22 | ||||||
| @@ -142,6 +144,12 @@ sensor: | |||||||
|   - platform: apds9960 |   - platform: apds9960 | ||||||
|     type: blue |     type: blue | ||||||
|     name: APDS9960 Blue |     name: APDS9960 Blue | ||||||
|  |   - platform: homeassistant | ||||||
|  |     entity_id: sensor.hello_world | ||||||
|  |     id: ha_hello_world | ||||||
|  |  | ||||||
|  | time: | ||||||
|  | - platform: homeassistant | ||||||
|  |  | ||||||
| apds9960: | apds9960: | ||||||
|   address: 0x20 |   address: 0x20 | ||||||
| @@ -202,8 +210,26 @@ text_sensor: | |||||||
|     name: "Template Text Sensor" |     name: "Template Text Sensor" | ||||||
|     lambda: |- |     lambda: |- | ||||||
|       return {"Hello World"}; |       return {"Hello World"}; | ||||||
|  |   - platform: homeassistant | ||||||
|  |     entity_id: sensor.hello_world2 | ||||||
|  |     id: ha_hello_world2 | ||||||
|  |  | ||||||
| script: | script: | ||||||
|   - id: my_script |   - id: my_script | ||||||
|     then: |     then: | ||||||
|       - lambda: 'ESP_LOGD("main", "Hello World!");' |       - lambda: 'ESP_LOGD("main", "Hello World!");' | ||||||
|  |  | ||||||
|  | stepper: | ||||||
|  |   - platform: uln2003 | ||||||
|  |     id: my_stepper | ||||||
|  |     pin_a: GPIO23 | ||||||
|  |     pin_b: GPIO24 | ||||||
|  |     pin_c: GPIO25 | ||||||
|  |     pin_d: GPIO26 | ||||||
|  |     sleep_when_done: no | ||||||
|  |     step_mode: HALF_STEP | ||||||
|  |     max_speed: 250 steps/s | ||||||
|  |  | ||||||
|  |     # Optional: | ||||||
|  |     acceleration: inf | ||||||
|  |     deceleration: inf | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user