mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Home Assistant platform tests
This commit is contained in:
parent
52dbd35118
commit
01b49e8d59
2 changed files with 33 additions and 3 deletions
|
@ -687,13 +687,17 @@ def file_(value):
|
|||
return value
|
||||
|
||||
|
||||
ENTITY_ID_PATTERN = re.compile(r"^([a-z0-9]+)\.([a-z0-9]+)$")
|
||||
ENTITY_ID_CHARACTERS = 'abcdefghijklmnopqrstuvwxyz0123456789_'
|
||||
|
||||
|
||||
def entity_id(value):
|
||||
value = string_strict(value).lower()
|
||||
if ENTITY_ID_PATTERN.match(value) is None:
|
||||
raise vol.Invalid(u"Invalid entity ID: {}".format(value))
|
||||
if value.count('.') != 1:
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ mqtt:
|
|||
username: 'debug'
|
||||
password: 'debug'
|
||||
|
||||
api:
|
||||
|
||||
i2c:
|
||||
sda: 21
|
||||
scl: 22
|
||||
|
@ -142,6 +144,12 @@ sensor:
|
|||
- platform: apds9960
|
||||
type: blue
|
||||
name: APDS9960 Blue
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.hello_world
|
||||
id: ha_hello_world
|
||||
|
||||
time:
|
||||
- platform: homeassistant
|
||||
|
||||
apds9960:
|
||||
address: 0x20
|
||||
|
@ -202,8 +210,26 @@ text_sensor:
|
|||
name: "Template Text Sensor"
|
||||
lambda: |-
|
||||
return {"Hello World"};
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.hello_world2
|
||||
id: ha_hello_world2
|
||||
|
||||
script:
|
||||
- id: my_script
|
||||
then:
|
||||
- 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
|
||||
|
|
Loading…
Reference in a new issue