mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 08:55:22 +01:00
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:
parent
b9609286ea
commit
8be733efee
2 changed files with 4 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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, []):
|
||||
|
|
Loading…
Reference in a new issue