You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A single function can have any or all of the decorator types specified, but at most one of each type.
In such a case how can I monitor several events of the same type (say - two MQTT topics, or several actions)?
My current solution is to have intermediate functions, each having one decorator, and both calling the actual function that handles the event - but there may be a better solution?
The text was updated successfully, but these errors were encountered:
For @state_trigger and @time_trigger you can specify multiple arguments (or lists of arguments), so a single function can be triggered by multiple state expressions or time specifications.
For @event_trigger and @mqtt_trigger you can currently only specify a single event or mqtt topic, although mqtt supports wildcards, so one trigger can capture multiple topics if they have similar names that can be matched by a wildcard.
@event_trigger could be extended to support multiple event names if there is interest. In the meantime, @dlashua's solution is the best one in the few cases where a common handler function for different events is needed.
For @state_trigger and @time_trigger you can specify multiple arguments (or lists of arguments), so a single function can be triggered by multiple state expressions or time specifications.
The documentation states
In such a case how can I monitor several events of the same type (say - two MQTT topics, or several actions)?
My current solution is to have intermediate functions, each having one decorator, and both calling the actual function that handles the event - but there may be a better solution?
The text was updated successfully, but these errors were encountered: