Overview
The MQTT Trigger feature in ANSVIS allows users to publish trigger events to an MQTT broker. MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol used for machine-to-machine communication, ideal for IoT (Internet of Things) applications and real-time data transfer.
Steps to Configure an MQTT Trigger:
1. Access the Event Action Configuration
- Navigate to the Event Action Configuration panel in the ANSVIS Client.
- From the Event Action Type dropdown, select MQTT. This will open the MQTT trigger configuration panel.
2. Choose an MQTT Broker Option
- Start a local MQTT message broker: If you do not have an external MQTT broker, you can enable this option to start a local MQTT broker on your machine.
- External MQTT Server: If you want to publish events to an external MQTT broker, leave this unchecked and proceed with configuring the external server details.
3. Configure the External MQTT Server
- External MQTT Server: Enter the IP address or hostname of the MQTT broker where the event data will be published.
- Port: Specify the port number for the MQTT broker. The default MQTT port is
1883
.
4. Set the Topic Name
- Topic Name: Enter the MQTT topic where the event data will be published. Topics in MQTT are structured like a hierarchy, and clients subscribe to specific topics to receive messages. For example, you could use a topic like
ansvis/events/camera1
.
5. Filter the Data
- Only Last Rule: Check this option if you want to send event data only from the most recent rule that triggered.
- Include Images: Check this option to include related images (if any) in the MQTT message.
6. Set Ping Interval
- Ping Every: Specify a time interval (in seconds) to send a "ping" message to the MQTT broker to maintain the connection. If no ping is required, leave it set to
0
.
7. Save the Configuration
- After configuring all fields, click Save to store the MQTT trigger settings.
- The system will now publish event data to the specified MQTT topic whenever the configured trigger occurs.
Example Scenario:
If you want ANSVIS to publish event data to an MQTT broker running on 192.168.1.100
at port 1883
, with the topic name ansvis/events/camera1
:
- Enter
192.168.1.100
in the External MQTT Server field. - Set the Port to
1883
. - Specify the Topic Name as
ansvis/events/camera1
. - Check Only Last Rule if you want only the latest rule's data to be published.
- Click Save to apply the configuration.