diff --git a/esphomeyaml/config_validation.py b/esphomeyaml/config_validation.py index aa7e68ddd0..68e96c5b44 100644 --- a/esphomeyaml/config_validation.py +++ b/esphomeyaml/config_validation.py @@ -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 diff --git a/tests/test2.yaml b/tests/test2.yaml index f2b8beaec0..954bca77b6 100644 --- a/tests/test2.yaml +++ b/tests/test2.yaml @@ -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