Real-time MQTT Status

Real-time MQTT Status 1.0.1

riskable

New Member
riskable submitted a new resource:

Real-time MQTT Status - Publishes real-time OBS status info via MQTT at a configurable interval

This script will regularly publish real-time (JSON-encoded) OBS status information to the configured MQTT host, port, and channel at the specified interval. I wrote this is so I could make my own fully-automated IoT "RECORDING" sign:


Examples of what gets published:

Right when OBS starts up (if the script is enabled) or if you "Exit" OBS without first stopping any recording/streaming:
JSON:
{"recording": false, "streaming": false, "paused": false...
Read more about this resource...
 

ASchneider

New Member
Hello sir! Thanks for this great project! I was not able to get it working tough, I'm using Home Assistant with an MQTT broker addon.

These are my settings:

Code:
# Default values for the configurable options:
INTERVAL = 5 # Update interval (in seconds)
MQTT_HOST = 192.168.20.8 # Hostname of your MQTT server
MQTT_PORT = 1883 # Default MQTT port is 1883
MQTT_CHANNEL = "obs/status"

# This is how we keep track of the current status:
STATUS = {
    "recording": True,
    "streaming": True,
    "paused": True,
    "replay_buffer": True, # If it's active or not
    "fps": 0,
    "frame_time_ns": 0,
    "frames": 0,
    "lagged_frames": 0,
I think the problem might be related to the way I've installed Python; from the MS Store... Not sure what path should I put in OBS scripts settings...

I was also wondering if there's a way to set authentication information so I don't need to turn on anonymous login on my HA.

Thanks a lot!
 

glikely

New Member
Thanks for this script. I needed a way to drive tally lights from OBS and I was able to modify this script to do want I needed. The tally lights are just ESP8266 devices running Tasmota firmware and wired up to an WS2812 RGB LED. On each scene change the script checks to see if one of the listed sources has become active/inactive, and updates an MQTT topic for the source. Specifically, "cmnd/<sourcename>/color".

I've pushed my changes up to github. Anyone interested can find it here:


20201002_154107_cropped.jpg
 

glikely

New Member
Had a problem with the script that was causing the UI to freeze for short periods. Calling CLIENT.loop() may block for 1 second, delaying things like scene changes and UI updates. The solution I found was to replace calls to CLIENT.loop() in the event handlers with a call to CLIENT.loop_start() in the setup path which puts the update loop into a separate thread. Fixed version is in my github repo linked above
 
Top