GithubHelp home page GithubHelp logo

maxbroome / vmix-to-mqtt Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 27 KB

A simple python script that looks at vMix's built in API, and will send an MQTT message based on the set parameter.

License: GNU General Public License v3.0

Python 100.00%

vmix-to-mqtt's Introduction

vMix to MQTT Script

This Python script allows you to monitor the recording status of vMix, a live production and streaming software, and send MQTT messages based on its recording state. You can customize the MQTT messages and topics to integrate vMix with your home automation or other applications.

Prerequisites

Before using this script, make sure you have the following prerequisites:

  1. Python: You need to have Python installed on your system. You can download it from Python's official website.

  2. Required Python Libraries: This script uses the following Python libraries, which can be installed using pip:

    • xml.etree.ElementTree
    • requests
    • paho.mqtt.client
    • schedule

    You can install these libraries using the following command:

    pip install xml.etree.ElementTree requests paho-mqtt schedule
  3. vMix: You need to have vMix installed and running with its API enabled on port 8088.

  4. MQTT Broker: Set up an MQTT broker and have its IP address ready, as you'll need it to configure the script.

Customization

You need to customize the script with your specific configuration:

  1. Replace the following variables with your own values:

    • vMix_ip: Set this to your vMix server's IP address.
    • mqtt_broker_ip: Set this to the IP address of your MQTT broker.
    • start_recording_topic: Set this to the MQTT topic where you want to send the "start recording" message.
    • stop_recording_topic: Set this to the MQTT topic where you want to send the "stop recording" message.
  2. You can also customize the MQTT message payloads by modifying the send_mqtt_message function, the default is to turn the device On when recording, and Off when not.

Usage

To use this script, follow these steps:

  1. Clone or download this repository to your local machine.

  2. Install the necessary libraries stated previously

  3. Customize the script as described in the "Customization" section.

  4. Open a terminal and navigate to the folder where you saved the script.

  5. Run the script using the following command:

    python3 main.py

The script will monitor vMix's recording status and send MQTT messages to the specified topics whenever the recording state changes.

Command-line Options

  • --logs or -l: Enable log messages. If enabled, the script will display additional information for debugging purposes.

Notes

  • The script uses the schedule library to periodically check vMix's recording status. By default, it checks every 10 seconds. You can modify the schedule as needed in the check_recording function.

  • The script will continuously run in the terminal until you manually stop it (e.g., by pressing Ctrl+C).

  • Make sure the MQTT broker is running and accessible from the machine where you run the script.

  • This script is designed to run on a continuous basis. You can use tools like systemd (on Linux) or Task Scheduler (on Windows) to ensure it runs automatically when your system starts.

  • Monitor the script's console output for information about the recording status and MQTT messages.

With ❤️ from Max Broomfield

vmix-to-mqtt's People

Contributors

maxbroome avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.