Fix MQTT Not Working in dev branch (#527)

* Fix MQTT not working

* Fix minor typo causing compile error
This commit is contained in:
mtl010957 2019-05-07 15:19:30 -04:00 committed by Otto Winter
parent 27f431a027
commit c569d022ec
2 changed files with 4 additions and 3 deletions

View file

@ -150,12 +150,13 @@ def exp_mqtt_message(config):
@coroutine_with_priority(40.0) @coroutine_with_priority(40.0)
def to_code(config): def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config)
cg.add_library('AsyncMqttClient', '0.8.2') cg.add_library('AsyncMqttClient', '0.8.2')
cg.add_define('USE_MQTT') cg.add_define('USE_MQTT')
cg.add_global(mqtt_ns.using) cg.add_global(mqtt_ns.using)
var = cg.new_Pvariable(config[CONF_ID])
cg.add(var.set_broker_address(config[CONF_BROKER])) cg.add(var.set_broker_address(config[CONF_BROKER]))
cg.add(var.set_broker_port(config[CONF_PORT])) cg.add(var.set_broker_port(config[CONF_PORT]))
cg.add(var.set_username(config[CONF_USERNAME])) cg.add(var.set_username(config[CONF_USERNAME]))

View file

@ -55,7 +55,7 @@ template<typename... Ts> class Trigger {
bool is_running() { bool is_running() {
if (this->automation_parent_ == nullptr) if (this->automation_parent_ == nullptr)
return false; return false;
return this->automation_parent_.is_running(); return this->automation_parent_->is_running();
} }
protected: protected: