Automation: Add trigger context and expose to action
This commit is contained in:
parent
c4913a87e4
commit
4e568f8b99
20 changed files with 232 additions and 69 deletions
|
@ -30,7 +30,14 @@ def trigger(hass, config, action):
|
|||
def mqtt_automation_listener(msg_topic, msg_payload, qos):
|
||||
"""Listen for MQTT messages."""
|
||||
if payload is None or payload == msg_payload:
|
||||
action()
|
||||
action({
|
||||
'trigger': {
|
||||
'platform': 'mqtt',
|
||||
'topic': msg_topic,
|
||||
'payload': msg_payload,
|
||||
'qos': qos,
|
||||
}
|
||||
})
|
||||
|
||||
mqtt.subscribe(hass, topic, mqtt_automation_listener)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue