Fix MQTT on_message trigger (#583)

Fixes https://github.com/esphome/issues/issues/363
Fixes https://github.com/esphome/issues/issues/364
This commit is contained in:
Otto Winter 2019-05-31 11:17:46 +02:00 committed by GitHub
parent b9609286ea
commit 8be733efee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -87,7 +87,7 @@ void DeepSleepComponent::begin_sleep(bool manual) {
ESP.deepSleep(*this->sleep_duration_);
#endif
}
float DeepSleepComponent::get_setup_priority() const { return -100.0f; }
float DeepSleepComponent::get_setup_priority() const { return setup_priority::LATE; }
void DeepSleepComponent::prevent_deep_sleep() { this->prevent_ = true; }
} // namespace deep_sleep

View file

@ -41,7 +41,8 @@ MQTTClientComponent = mqtt_ns.class_('MQTTClientComponent', cg.Component)
MQTTPublishAction = mqtt_ns.class_('MQTTPublishAction', automation.Action)
MQTTPublishJsonAction = mqtt_ns.class_('MQTTPublishJsonAction', automation.Action)
MQTTMessageTrigger = mqtt_ns.class_('MQTTMessageTrigger',
automation.Trigger.template(cg.std_string))
automation.Trigger.template(cg.std_string),
cg.Component)
MQTTJsonMessageTrigger = mqtt_ns.class_('MQTTJsonMessageTrigger',
automation.Trigger.template(cg.JsonObjectConstRef))
MQTTComponent = mqtt_ns.class_('MQTTComponent', cg.Component)
@ -217,6 +218,7 @@ def to_code(config):
cg.add(trig.set_qos(conf[CONF_QOS]))
if CONF_PAYLOAD in conf:
cg.add(trig.set_payload(conf[CONF_PAYLOAD]))
yield cg.register_component(trig, conf)
yield automation.build_automation(trig, [(cg.std_string, 'x')], conf)
for conf in config.get(CONF_ON_JSON_MESSAGE, []):