From c9ab454c3c31edb3bdcc0a305bdd42b1b7f08632 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Fri, 14 Jun 2019 12:40:14 +0200 Subject: [PATCH] Fix globals.set (#635) * Fix globals.set * Update __init__.py --- esphome/components/globals/__init__.py | 3 ++- tests/test1.yaml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/esphome/components/globals/__init__.py b/esphome/components/globals/__init__.py index 4dce6e7583..e7030978ed 100644 --- a/esphome/components/globals/__init__.py +++ b/esphome/components/globals/__init__.py @@ -50,6 +50,7 @@ def globals_set_to_code(config, action_id, template_arg, args): full_id, paren = yield cg.get_variable_with_full_id(config[CONF_ID]) template_arg = cg.TemplateArguments(full_id.type, *template_arg) var = cg.new_Pvariable(action_id, template_arg, paren) - templ = yield cg.templatable(config[CONF_VALUE], args, None) + templ = yield cg.templatable(config[CONF_VALUE], args, None, + to_exp=cg.RawExpression) cg.add(var.set_value(templ)) yield var diff --git a/tests/test1.yaml b/tests/test1.yaml index 47b6aaeab5..e1f0e8cb7a 100644 --- a/tests/test1.yaml +++ b/tests/test1.yaml @@ -1276,6 +1276,9 @@ text_sensor: id: template_text state: |- return "Hello World2"; + - globals.set: + id: glob_int + value: '0' - platform: template name: Template Text Sensor id: template_text