diff --git a/esphomeyaml/components/globals.py b/esphomeyaml/components/globals.py index 757822d749..d9a6cf0978 100644 --- a/esphomeyaml/components/globals.py +++ b/esphomeyaml/components/globals.py @@ -9,8 +9,8 @@ GlobalVariableComponent = esphomelib_ns.class_('GlobalVariableComponent', Compon GLOBAL_VAR_SCHEMA = vol.Schema({ vol.Required(CONF_ID): cv.declare_variable_id(GlobalVariableComponent), - vol.Required(CONF_TYPE): cv.string, - vol.Optional(CONF_INITIAL_VALUE): cv.string, + vol.Required(CONF_TYPE): cv.string_strict, + vol.Optional(CONF_INITIAL_VALUE): cv.string_strict, vol.Optional(CONF_RESTORE_VALUE): cv.boolean, }).extend(cv.COMPONENT_SCHEMA.schema) diff --git a/tests/test1.yaml b/tests/test1.yaml index fadd001008..d3acfa95c3 100644 --- a/tests/test1.yaml +++ b/tests/test1.yaml @@ -1001,3 +1001,22 @@ stepper: max_speed: 250 steps/s acceleration: 100 steps/s^2 deceleration: 200 steps/s^2 + + +globals: +- id: glob_int + type: int + restore_value: yes + initial_value: '0' +- id: glob_float + type: float + restore_value: yes + initial_value: '0.0f' +- id: glob_bool + type: bool + restore_value: no + initial_value: 'true' +- id: glob_string + type: std::string + restore_value: no + # initial_value: ""