Fix MQTT message trigger (#282)

Fixes https://github.com/OttoWinter/esphomelib/issues/335
This commit is contained in:
Otto Winter 2019-01-02 12:29:29 +01:00 committed by GitHub
parent 2b432ea829
commit eddaee3a80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -173,7 +173,7 @@ def to_code(config):
add(mqtt.set_reboot_timeout(config[CONF_REBOOT_TIMEOUT])) add(mqtt.set_reboot_timeout(config[CONF_REBOOT_TIMEOUT]))
for conf in config.get(CONF_ON_MESSAGE, []): for conf in config.get(CONF_ON_MESSAGE, []):
rhs = mqtt.make_message_trigger(conf[CONF_TOPIC]) rhs = App.register_component(mqtt.make_message_trigger(conf[CONF_TOPIC]))
trigger = Pvariable(conf[CONF_TRIGGER_ID], rhs) trigger = Pvariable(conf[CONF_TRIGGER_ID], rhs)
if CONF_QOS in conf: if CONF_QOS in conf:
add(trigger.set_qos(conf[CONF_QOS])) add(trigger.set_qos(conf[CONF_QOS]))