Skip to content

Feature Request: MQTT trigger #98

Closed
@wsw70

Description

@wsw70

Note: the original tile of the question was "[question] how to run a always-on script?"

I am converting my automation from AppDaemon to pyscript and some of them depend on MQTT (as a client). A typical case is a switch emitting to MQTT topic I want to listen to and act accordingly.

This means that such a script is not triggered by anything but runs in the background, responds to some events it manages itself (MQTT messages in my case), and then contacts HA for some actions (switching on a light for instance).

Is it possible to run such a script? The only cases I saw in the documentation are ones that react to something (either time based, or coming from HA)

One solution would be to use HA to manage the MQTT messages, but there are problems with this in some cases (see https://community.home-assistant.io/t/how-to-get-the-name-of-the-actual-state-topic-in-an-mqtt-sensor/248541 for an example). Using HA is doable but I would prefer to avoid automations there and move everything to pyscript for consistency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions